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_connected
returns an array of all connected geometry.
It works on anedge
or 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
face
and each link == anedge
without 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 eachedge
and get any other edges that share that vertex -edges=edge.start.edges
and 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
Advertisement