Skip to content

Instantly share code, notes, and snippets.

@Arty2
Created November 12, 2015 12:41
Show Gist options
  • Save Arty2/dadac9577ad9829d491d to your computer and use it in GitHub Desktop.
Save Arty2/dadac9577ad9829d491d to your computer and use it in GitHub Desktop.
SketchUp plugin — Provides a function to toggle EndPoints on/off
# Name : Toggle EndPoints
# Description : Provides a function to toggle EndPoints on/off
# Author : Heracles Papatheodorou
# Usage : Tools → Toggle EnPoints (hint: assign to keyboard shortcut)
# Date : 27.Jul.2004
# Type : tool
# History:
# 1.0 (2013.04.07) - Initial version.
require 'sketchup.rb'
def toggle_endpoints
#endpoints = Sketchup.active_model.rendering_options["DrawLineEnds"]
#how to pass by reference, I'll have to actually study Ruby
if (Sketchup.active_model.rendering_options["DrawLineEnds"] == true)
Sketchup.active_model.rendering_options["DrawLineEnds"] = false
else
Sketchup.active_model.rendering_options["DrawLineEnds"] = true
end
end
if( not file_loaded?("toggle_endpoints.rb.rb") )
# This will add a separator to the menu, but only once
add_separator_to_menu("Tools")
# To add an item to a menu, you identify the menu, and then
# provide a title to display and a block to execute. In this case,
# the block just calls the create_box function
UI.menu("Tools").add_item("Toggle EndPoints") { toggle_endpoints }
end
#-----------------------------------------------------------------------------
file_loaded("endpoints.rb")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment