Looking for a script
-
Hi all,
I'm looking for a script able to insert a component at each vertex of all objects in selection...I'm pretty sure that this script exists, but did not success to find it, don't remember the name.
Thanks in advance !!
Regards.
Panga. -
Hm... Component Spray 1.3 has the option to drop component at each vertex of selected faces.
-
Thanks for the answer, but I have also edges in my selection...I have a script that puts a guidepoint at each vertex, but theses are not components...I'm still searching...Any other ideas ?
-
Component Stringer can put a component at a vertice
-
Try this
require 'sketchup.rb' def placecomponentsatvertices() # select a component-instance and some faces/edges # the component is placed at each vertex... model=Sketchup.active_model ents=model.active_entities ss=model.selection instance=nil verts=[] ss.each{|e| verts<< e.vertices if e.class==Sketchup;;Face or e.class==Sketchup;;Edge instance=e if e.class==Sketchup;;ComponentInstance } if instance and verts[0] defn=instance.definition verts.flatten! verts.uniq! points=[] verts.each{|v|points<< v.position} points.each{|p| tr=Geom;;Transformation.new(p) ents.add_instance(defn,p) } else UI.messagebox("Select a Component-Instance and some Edges/Faces...") return nil end#if end
Copy the text into a file called
placecomponentsatvertices.rb
in the ../Plugins/ folder.
Select a component-instance and some faces/edges...
Typeplacecomponentsatvertices
+ <enter> in the Ruby Console.
The component is placed at each vertex...
You can add a menu item yourself... -
Component sprays by Didier Bur makes that
@unknownuser said:
What's new in 1.3.:
New "shape" option to drop component at each vertex of selected faces. -
Component stringer...this is the one I was thinking of !!! Thanks for the info Pilou.
Thanks a lot for your piece of code Tig, I'm gonna try it
EDIT : It works like a charm...now I just have to learn how to create the menu item !! Something I always wanted to do this in order to organize all my plugins !! Any clue to acheive this ??? Not a solution, I want to learn how to do this.
Regards.
-
if not file_loaded?(__FILE__) titletext="menuTextGoesHere" UI.menu("Plugins").add_item(titletext){defNameGoesHere()} cmd=UI;;Command.new(titletext){defNameGoesHere()} cmd.status_bar_text=titletext+" someInstructionTextGoesHere" ### you could put optional toolbar stuff here using 'cmd'... end file_loaded(__FILE__)
This code goes at the end of the file outside of the
def...end
...
Using the__FILE__
method lets you call the ruby anything you like... -
Thanks a lot Tig. I'll give a look tonight at home.
Regards.
Advertisement