sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    List of Connected Items

    Scheduled Pinned Locked Moved Plugins
    3 Posts 2 Posters 342 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kwalkerman
      last edited by

      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"

      Box A Line 1.JPG

      Any idea how to create a plugin that could give a list of connected simple items?

      Thanks!

      --
      Karen

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        The method all_connected returns an array of all connected geometry.
        It works on an edge or a face.
        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_a

        If you are dealing only with the specific example you show then each box == a face and each link == an edge without a face, so the logic in your code is to make a list of all of every connected face [boxes] and all of the lines [edges] that match - edge.faces.length==0. Then look at the start/end of each of each edge and get any other edges that share that vertex - edges=edge.start.edges and then get those lines' faces face=edge.face[0], then you know line X is joined to face A etc...

        TIG

        1 Reply Last reply Reply Quote 0
        • K Offline
          kwalkerman
          last edited by

          Sweet! Thanks for the help. I'll give it a try.

          --
          Karen

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement