List of Connected Items
-
Hi,
I'd like to be able to create a list of connected items. Such as (see image):
"Box A" is Connected to "Line 1"
"Line 1" is connected to "Box A" and "Box B"
"Box B" is connected to "Line 1" and "Line 2"
"Line 2" is connected to "Box B" and "Box C"
"Box C" is Connected to "Line 2"
Any idea how to create a plugin that could give a list of connected simple items?
Thanks!
--
Karen -
The method
all_connectedreturns an array of all connected geometry.
It works on anedgeor aface.
You can then manipulate that array to exclude edges or faces etc as desired...
See http://code.google.com/apis/sketchup/docs/methods.html#index_aIf you are dealing only with the specific example you show then each box == a
faceand each link == anedgewithout aface, so the logic in your code is to make a list of all of every connectedface[boxes] and all of the lines [edges] that match -edge.faces.length==0. Then look at the start/end of each of eachedgeand get any other edges that share that vertex -edges=edge.start.edgesand then get those lines' facesface=edge.face[0], then you know line X is joined to face A etc... -
Sweet! Thanks for the help. I'll give it a try.
--
Karen
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