Ruby selection
-
Hello forum,
I have a model which consists of faces and unconnected lines. How do I select the lines only using Ruby? I have attached an image file.
Thanks
-
First we set up some references.
model = Sketchup.active_model ss = model.selectionThen depending on how you want to 'start' off your plugin...
edges = model.active_entities.grep(Sketchup::Edge)
An array of all edges in the active context***OR
edges = ss.grep(Sketchup::Edge)
An array of all edges in the current selection.***Now resolve the selection:
ss.clear ss.add(edges)***The 'rep' finds all edges, including those bordering faces.
So if you want to select just those edges without faces then you can extend the 'grep' code thus
... .grep(Sketchup::Edge).find_all{|e| e.faces.length == 0 }
The array 'edges' then just lists those edges without faces...
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