Hmm, didn't do the trick.
Looks like I have to code a function that gets the value then checks it before changing it. I thought I could skip this bit (based on the above example for ["DisplayInstanceAxes"]=false/true).
Hmm, didn't do the trick.
Looks like I have to code a function that gets the value then checks it before changing it. I thought I could skip this bit (based on the above example for ["DisplayInstanceAxes"]=false/true).
Thanks Didier!
I was able to generate a quick test menu for these options with your direction:
require 'sketchup.rb'
#########################################
if( not file_loaded?("Menu_Axis.rb") )
### CONTEXT MENU
UI.add_context_menu_handler do | menu |
submenuz=menu.add_submenu("Axis...")
submenu01=submenuz.add_item("Move Global Axis") { Sketchup.send_action "selectAxisTool;" }
submenu02=submenuz.add_item("Toggle Global Axis") { Sketchup.send_action "viewShowAxes;" }
submenu03=submenuz.add_item("Reset Global Axis ...?") { UI.messagebox("Missing Command!") }
submenu04=submenuz.add_item("XYZ Global Axis ...?") { UI.messagebox("Missing Command!") }
submenu05=submenuz.add_item("Align to Global Axis ...?") { UI.messagebox("Missing Command!") }
submenuz.add_separator
submenu06=submenuz.add_item("Move Local Axis ...?") { UI.messagebox("Missing Command!") }
submenu07=submenuz.add_item("Toggle Local Axis") { if Sketchup.active_model.rendering_options["DisplayInstanceAxes"]
Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=false
else
Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=true
end }
submenuz.add_separator
submenu08=submenuz.add_item("Toggle Edge Axis") { if Sketchup.active_model.rendering_options["EdgeColorMode"]
Sketchup.active_model.rendering_options["EdgeColorMode"]=1
else
Sketchup.active_model.rendering_options["EdgeColorMode"]=2
end }
submenu09=submenuz.add_item("Toggle Tool Crosshairs ...?") { UI.messagebox("Missing Command!") }
end #do
end #if
#-----------------------------------------------------------------------------
file_loaded("Menu_Axis.rb")
###
...although the EdgeColorMode doesn't want to toggle back and forth (hm!)
I poked through the API, but didn't find anything immediate that suggested the RESET, or TOOL CROSSHAIRS.
I'm trying to create a keystroke (or context menu command) to call the "Show Component Axes" option under Model Info/Components.
Does anyone know what this is?
By sorting out the current Axis-related items, I created this reference list:
Move Global Axes
desc: moves axis
key: "Tools/Axes"
code: { Sketchup.send_action "selectAxisTool:" }
Toggle Global Axes
desc: show/hide global axis
key: "View/Axes"
code: { Sketchup.send_action "viewShowAxes:" }
Reset Global Axes
desc: reset global axis to 0,0,0
key: "View/Reset axis (World)"
code: ?
Context Menu (over global axis):
- Place= desc: see "Axes tool" above
- Move= desc: Dialog Box (X,Y,Z)
...code: ?
- Reset= desc: see "Reset Axes" above
- Align= desc: Top view, centered on global axis
...code: ?
- Hide= desc: see "View Axes" above
Move Local Axes
desc: move component axis
key: "Edit/Item/Change Axes"
code: ?
"Toggle Local Axes"
desc: show component axis (in Model Info/Components)
key:
code: ?
Toggle Edges Axis
desc: color X,Y,Z axis-aligned edges
key: "View/Rendering/Edge/By Axis"
code: ?
Display Tool Crosshairs
desc: show/hide Tool crosshairs (in Preferences/Drawing)
key: "Drawing/Display Crosshairs"
code: ?