Place components at guide points?
-
I am able to import a GPX file into Adobe Illustrator CS through a GIS plugin. It's showing tree locations on a specific site. When I export a CAD file of points, even if I change them to symbols in Illustrator, they are imported into SketchUp as Guide Points.
Is there a way to place a component using a guide point as reference? Similar to the "replace selected" in the components window. Or maybe there's a plugin that would let you "place component at guidepoint."
Thanks,
Fraser
Note I've tried this using QGIS to export as a DXF too with the same result.
I'm using SU on an iMac with 32GB RAM, OSX10 and SketchUp Pro 2017.
-
Let's assume you have all of the cpoints [aka guide-points] selected.
Let's also assume that you have a component definition named 'MyTree' [edit n=... below to suit what you actually have !]
This code snippet will add a component instance of MyTree at each point...n='MyTree';m=Sketchup.active_model;s=m.selection;ps=s.grep(Sketchup;;ConstructionPoint);m.start_operation('ex',true);d=m.definitions[n];ps.each{|pt|m.active_entities.add_instance(d, Geom;;Transformation.new(pt.position))}if d;m.commit_operation;
[mod=:21w308lk]Corrected typos in previous example, added operation block for one-step undo.[/mod:21w308lk]
-
Thanks for the response TIG. It sounds like a great solution. Where would I paste that line of code? Is this an option in SketchUp?
-
SketchUp's menu Window > Ruby Console.
Paste the whole line in the bottom section and press 'enter'.The Ruby Console is your friend and lets you run many useful 'snippets' of code...
Incidentally, my example code filters the cpoints from the current selection, so there's no need to be super-careful when making the selection...
-
Hmmm... I have a component called "2DTREE-CEDAR01". When I input your line of code with that replacing 'MyTree':
n='2DTREE-CEDAR01';m=Sketchup.active_model;ps=m.selection.grep(Sketchup::ConstructionPoint);d=
I get the following error:
Error: #<SyntaxError: <main>: syntax error, unexpected end-of-input
...Sketchup::ConstructionPoint);d=
... ^>
SketchUp:1:in `eval' -
My typos, sorry, I hadn't tested it - in a rush...
I have edited the original code - it should now work [I actually had time to test it this time!]...
It now also has an operation block, so it's one-step undo-able...Please redo the n=...; part to suit your component[s].
-
SUCCESS!
Thanks TIG!
-
There's an option for this (Insert Components at CPoints) in Thomthoms GuideTools too.
-
That worked wonderfully too!
Thanks cotty!
Advertisement