Right Click->Hide
-
I read the tutorials on code.google.com, but it doesn't help a lot.
I tried to look at the linetool.rb and I just got confused... -
@kolem said:
I tried to look at the linetool.rb and I just got confused...
Yea - that's the one I talked about. Not very good.
-
Maybe Jim's construction line tool is of help: http://sketchuptips.blogspot.com/2008/02/plugin-construction-line-tool.html
Have a look.As for SketchUp plguin writing in general:
You will find many useful links in this thread: http://forums.sketchucation.com/viewtopic.php?f=180&t=10142
It's worth noting that all plugins share the same environment, so it's important to learn how namespaces (modules and classes) works in Ruby - and use them. Otherwise you might end up with conflicts with other plugins.
And a big no-no is overriding basic Ruby and SketchUp methods. Then you will most likely break other people's scripts. -
Try this... take the 'linetool.rb' code and copy it - make a new tool class named 'HiddenLineTool' say...
and used that wherever 'LineTool' used to appear in the text, and also make a new def linetool >> defhiddenlinetool
etc...
Find the line of code that creates the geometry - it readsview.model.entities.add_line(p1,p2)
and adjust it so it readsmyline=view.model.entities.add_line(p1,p2)
and insert a new line of code immediately beneath that that readsmyline.hidden=true
Now when you draw the line it'll automatically become a 'hidden' line - I suggest that you have 'Hidden Geometry' switched 'on' whilst using this tool, otherwise you could get very confused...Note also that you could make another version of it [GuideLineTool ?] to draw a guide-line (cline) by changing that one line to
view.model.entities.add_cline(p1,p2)
instead -
ill try that, another issue is that i have a problem editing the code in the notepad, i get all the code in one long row, any suggestions?
-
@kolem said:
ill try that, another issue is that i have a problem editing the code in the notepad, i get all the code in one long row, any suggestions?
Get a better editor than Notepad. Get one that provides syntax highlighting - makes reading the code much easier.
I use Notepad++ http://notepad-plus-plus.org/ - free app with a support for a wide range of languages. -
thanks a lot!
well, I started off by looking at the code and I'm starting to get an idea of how things work.
i edited the linetool file and changed the class to 'hiddenlinetool', etc...
and added the line TIG wrote, however, I get an error:class/module name must be CONSTANT
with a referring to this line:
class hiddenlinetool
ideas?
-
Yes - constants in Ruby must start with capital letters.
-
The class would be
HiddenLineTool
but the shortcut defhiddenlinetool
... -
Ok, seems like it is going to work, now, how do i execute the tool?
window>preferences? -
To test type
hiddenlinetool
into the Ruby Console.
Later on when it's debugged to make a 'Plugins' Menu item use this code at the end - outside of the class etcif not file_loaded?(File.basename(__FILE__)) ### make command cmd=UI;;Command.new("Draw Hidden Line"){hiddenlinetool} cmd.status_bar_text="Draws a line and immediately hides it..." ### menu UI.menu("Plugins").add_item(cmd) file_loaded(File.basename(__FILE__)) end#if
To put the tool into the 'Draw' menu instead, you just change 'Plugins' to 'Draw'.....
-
never mind i got it working, thanks for the help
Advertisement