[REQ] replace construction point with component
-
Hi all,
I am looking for a plugin that will replace selected construction points with a component.
Anyone know of one.
Cheers. -
Better post ruby requests in the Ruby discussions forum (add [Request] to the topic title so people know you're requesting something rather than offering).
-
Could you give us an idea of the intended use? You could simply make that construction point a component itself and then right click > Reload component.
-
Imagine he has a set of construction points (imported) as place-holders for trees for instance. Now he wants to turn them into instances of the same component definition and yes, indeed, for the same reason; to be able to reload these construction point-components with real trees.
(Do I get a beer if I guessed correctly?)

Edit - as Jackson said, there is more chance for something in the ruby forum so I am moving the topic).
-
Assuming that you do not already have the points located, you can also make a point into a component, and insert it from the the component's menu. When you are done, "edit component" one of the component points, and insert your component into it.
-
you have earned yourself a light beer Gaieus,
I am working with LIDAR information which gives me a point cloud and I want to represent the trees in the park. I would like to select a tree and replace the construction points with leaf components. (probably just green diamonds) A large tree contains about 450 construction points. This would give me an accurate representation of the canopy. If I was to make each construction point a component then replace them I would have to make 450 separate points into components (no thanks)then replace them. A script which simply replaces the selected construction points with the selected component would do that nicely. A script which relaces the component points and aligns the component to radiate away from a central point would be awesum.
Cheers. -
Thanks for that code Tig. I will give that a try as soon as I have some time to experiment. Always wanted to have a go at scripts so nows my chance.
-
def cpoints2components() model=Sketchup.active_model ents=model.active_entities ss=model.selection instance=nil; cpoints=[] ss.each{|e| cpoints<<e if e.class==Sketchup;;ConstructionPoint instance=e if e.class==Sketchup;;ComponentInstance } if not instance or not cpoints[0] UI.messagebox("Must select an Instance of a Component and at least one Cpoint.") return nil end#if model.start_operation("cpoints2components") cpoints.each{|cpoint| tr=Geom;;Transformation.new(cpoint.position) ents.add_instance(instance.definition,tr) } model.commit_operation end#defCopy this into a file called cpoints2compos.rb in the Plugins Folder.
Select your Cpoints and one Instance of the required Component, type/pastecpoints2componentsinto the Ruby Console and it should swap them around. [Menu is easy too but I'll leave that to you...]
Cpoints are also left behind ... Delete Construction Geometry to erase them or tweak the code to erase! them afterwards... -
Looking forward to the results - really curious how it works.
-
@gaieus said:
Looking forward to the results - really curious how it works.
Hi there,
Just got back to this today.
The code worked really well thanks Tig.
Attached is the sketchup file I used to create the trees from LIDAR
Its a bit fiddly but the result could be useful.
More could be done to change the nature of the component to get a feel for different tree types.
Use the layers to turn off the constructino points to see what the trees look like. Note I havent done all the trees.
I added very basic lines as trunks and this helps visualise the tree a bit better.
Remember these are New Zealand trees so they might look different to yours.
Cheers.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement