Plugin idea - component axes - button for show on/off
-
Now is ok, thank you.
Robert
-
-
@sdmitch said:
The if opt=false and if opt=true should have been if opt==false and if opt==true.
In order to assign a shortcut to it, you need to assign it to a menu ie. Plugins. In the Preferences>Shortcuts, it will be listed as Plugins/DisplayAxes.
module Toggle > def self.dis() > opt=Sketchup.active_model.rendering_options["DisplayInstanceAxes"] > if opt==false > Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=true > end > if opt==true > Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=false > end > end > unless file_loaded?(__FILE__) > UI.menu("Plugins").add_item("DisplayAxes") {Toggle.dis} > file_loaded(__FILE__) > end > end >
Hi Sdmitch,can you teach me how to add "DisplayInstanceAxes" plugin in "SDM tools" sub menu?
-
replace
unless file_loaded?(__FILE__) UI.menu("Plugins").add_item("DisplayAxes") {Toggle.dis} file_loaded(__FILE__) end
with this
unless $sdm_tools_menu $sdm_tools_menu = UI.menu("Plugins").add_submenu("SDM Tools") $sdm_CorG_tools = $sdm_tools_menu.add_submenu("CorG Tool") end unless file_loaded?(__FILE__) $sdm_CorG_tools.add_item("DisplayAxes") { Toggle.dis } file_loaded(__FILE__) end
-
module Toggle
def self.dis()
opt=Sketchup.active_model.rendering_options["DisplayInstanceAxes"]
if opt==false
Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=true
end
if opt==true
Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=false
end
end
unless $sdm_tools_menu
$sdm_tools_menu = UI.menu("Plugins").add_submenu("SDM Tools")
$sdm_CorG_tools = $sdm_tools_menu.add_submenu("CorG Tool")
end
unless file_loaded?(FILE)
$sdm_CorG_tools.add_item("DisplayAxes") { Toggle.dis }
file_loaded(FILE)
endand i found this:
Error Loading File DisplayInstanceAxes.rb
Error: #<SyntaxError: C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/DisplayInstanceAxes.rb:18: syntax error, unexpected end-of-input, expecting keyword_end> -
and i found this to :
Error Loading File Multiple Offsets.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Multiple Offsets.rb:185:in
<top (required)>'
Error Loading File Multi_Offset_Tool.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Multi_Offset_Tool.rb:30:in
<top (required)>'
Error Loading File Rotated Box.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Rotated Box.rb:33:in
<top (required)>'
Error Loading File Rotated Circle_Cylinder.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Rotated Circle_Cylinder.rb:30:in
<top (required)>'
Error Loading File Stair Maker.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Stair Maker.rb:33:in
<top (required)>' -
This kind of utility is perfect for Custom Toolbars. I have added a toggle_instance_axes command which will be included in the next release. Let me know if you have any more suggestions.
-
@laudhi said:
module Toggle
def self.dis()
opt=Sketchup.active_model.rendering_options["DisplayInstanceAxes"]
if opt==false
Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=true
end
if opt==true
Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=false
end
end
unless $sdm_tools_menu
$sdm_tools_menu = UI.menu("Plugins").add_submenu("SDM Tools")
$sdm_CorG_tools = $sdm_tools_menu.add_submenu("CorG Tool")
end
unless file_loaded?(FILE)
$sdm_CorG_tools.add_item("DisplayAxes") { Toggle.dis }
file_loaded(FILE)
end
end#<---add thisand i found this:
Error Loading File DisplayInstanceAxes.rb
Error: #<SyntaxError: C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/DisplayInstanceAxes.rb:18: syntax error, unexpected end-of-input, expecting keyword_end>The end statement for the module is missing.
-
@laudhi said:
and i found this to :
Error Loading File Multiple Offsets.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Multiple Offsets.rb:185:in
<top (required)>'
Error Loading File Multi_Offset_Tool.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Multi_Offset_Tool.rb:30:in
<top (required)>'
Error Loading File Rotated Box.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Rotated Box.rb:33:in
<top (required)>'
Error Loading File Rotated Circle_Cylinder.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Rotated Circle_Cylinder.rb:30:in
<top (required)>'
Error Loading File Stair Maker.rb
Error: #<NoMethodError: undefined methodadd_item' for nil:NilClass> C:/Users/Laudhi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Stair Maker.rb:33:in
<top (required)>'Most if not all of these plugins had to be updated for SU2014 so start by downloading a new copy.
-
ok,thanks for your help Sdmitch....i will update with a new version...
-
i change the name DisplayInstanceAxes.rb to ToggleComAxes.rb and everything works fine now....
Advertisement