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

Ruby How to Select All Connected

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 3 Posters 1.6k Views
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.
  • G Offline
    ghandi
    last edited by 27 Jul 2011, 11:11

    Hello Forum,

    There is a right-click option called "select all connected".
    is it also possible with ruby?

    Thank you

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 27 Jul 2011, 11:26

      Yes, you use the edge method
      http://code.google.com/apis/sketchup/docs/ourdoc/edge.html#all_connected
      or face method
      http://code.google.com/apis/sketchup/docs/ourdoc/face.html#all_connected
      to get an array of the connected edges/faces.
      e.g. assume we have reference to an 'edge'
      all = edge.all_connected model.selection.add(all)
      To find a list of just all connected edges you could filter the array to ignore faces etc... 🤓

      TIG

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gaieus
        last edited by 27 Jul 2011, 11:26

        Have look at this plugin:
        http://forums.sketchucation.com/viewtopic.php?t=14975

        Gai...

        1 Reply Last reply Reply Quote 0
        • G Offline
          ghandi
          last edited by 27 Jul 2011, 11:44

          Thank you very much. It works,
          but i'ts not exacty what I need.

          So I should have changed the question a bit.

          I need to select (all) connected edges to an accurve (created between to edges with Fillet.rb)

          Additionally the selection should not go to further edges or anything, only the two edges and the arccurve.
          So all_connected() wont work.

          (All this is for automatically handing them (the path) over to PipeAlongPath.rb)

          1 Reply Last reply Reply Quote 0
          • G Offline
            Gaieus
            last edited by 27 Jul 2011, 11:47

            If you are asking about ruby methods in order to write your own plugin, I'd rather move the topic to the developers forum. I will definitely not be able to help in this area... 😳

            Gai...

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 27 Jul 2011, 12:02

              I've moved this into the Developers' Forum as it's a general issue...

              You can get info about a curve.
              verts=curve.vertices returns the vertices, so if it's an arc etc then vf=verts.first and vl=verts.last are the end vertices.
              You can also get the start and end edges with ef=curve.first_edge and el=curve.last_edges
              You can get the edges that use any vertex with
              edges=vertex.edges so do that for vf and vl in turn - the array of edges will include the curve's edge so fedges=vf.edges; fedges.delete(ef); fedgeyouwant=fedges[0] ditto for vl/ el
              So you now have a way to find the two edges connected to ends of an curve.
              This assumes you have checked it's a curve, it's not looped etc; and if there isn't a connected edge you get 'nil'. or if there are more than connected edge then only the first one found is returned...

              TIG

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

              Advertisement