True, but we can hack at the problem given that the ruby script example allows
"Permission to use, copy, modify, and distribute this software for any purpose and without fee is hereby granted....provided that the above copyright notice appear in all"
Hi
I recommend that (if you haven't already) download Alex Schreyer: Ruby Code Editor
http://sketchucation.com/pluginstore?pln=as_rubyeditor
open it and checkout its features..
now to find the path to the plugin folder...
something like C:\Users\PHILIP\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins (it may pay to set a short cut to this)
So assuming you have down loaded the su_examples
So using the ruby editor...looking at the linetool example, it would seem pointless or impossible at this stage to completely understand all of whats going on, and I must admit I'm fairly new to this.
the # bits (grey) are comments, there is a lot about the mouse control, but I skip that.. no point reinventing the wheel.. but hello this is actually two tools...the second,cylinders that inherit functions from the first line tool..we can build our tool(s) on this. Most of the work already done
But first you probably notice how darn hard it is to run this script. We need to borrow a bit of code say from the box.rb and overwrite the linetool.rb to have easy access.
Close linetool.rb and open boxtool.rb
what makes it visible?..looking for key words...load...menu?
the section below
if( not file_loaded?("su_examples/box.rb") )
# This will add a separator to the menu, but only once
#Note: We don't translate the Menu names - the Ruby API assumes you are
#using English names for Menus.
%(#0000BF)[add_separator_to_menu("Draw")]
# 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
%(#0000BF)[UI.menu("Draw").add_item($exStrings.GetString("Box")) { create_box }]
end
can be copied and pasted into linetool.rb and change box in the two statements plus the menu text line to something descriptive
if( not file_loaded?("su_examples/linetool.rb") )
add_separator_to_menu("Draw")
UI.menu("Draw").add_item($exStrings.GetString("construct line")) { linetool }
same for the cylinder
add_separator_to_menu("Draw")
UI.menu("Draw").add_item($exStrings.GetString("%(#FF0000)[pipe line]")) { %(#FF0000)[cylindertool] }
end
you can run it to check
then if okay save to an appropriate folder
Now you need to close Sketchup and overwrite the existing with this one (perhaps saving a copy if you need to return to a previous version)
I found by overwriting, I am able to have the menu items appear when Sketchup opens
So with menu items we can now create some keyboard shortcuts, (window/preferences/shortcuts) say shift L, for the constuct line, and shift P, for the pipe
hopefully all works
any comments or code corrections,ideas welcome
so ends this part