Plugin idea - component axes - button for show on/off
-
I am looking at this and trying to discern what you are asking in your last comment. Do you want to know how to assign the shortcut? If you have loaded that ruby script, and it is called DisplayInstanceAxes it should have become a member of the list of Functions. Scroll down the list, and if it is there, select it. You should be able to give it a key sequence in the Add Shortcut box. After that, click the + button.
If it is not in the list, but it is loaded properly in the Plugins folder, then perhaps close Sketchup and restart it then check if it is present in the Functions list. -
Axes tools by Thomthom is a cool one for place them!
-
I don't see DisplayInstanceAxes.
Robert
-
@RobertWan:
I don't either. I tried to implement this in Sketchup8.
However, this was my attempt:
I copypasted the text into Windows Notepad.(formatting looked same) Saved as filename: DisplayInstanceAxes-dbur.rb file to an intermediate folder and then copied that .rb file into Sketchup8 Plugins folder.
Opened Sketchup8 to look first in the Shortcut Functions list.
Did not see anything resembling, except View Axes, which I think is the function for Menu>View>Axes--the Global Axes, not the one you want in this case.
Looked in the Plugins drop down menu and did not see anything. Also, looked in all of the other Menu drop downs for any clue--not found.
So... there may be something else missing. -
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
-
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