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

    Ruby selection

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 511 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.
    • Y Offline
      yalhassanpro
      last edited by

      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


      Capture.JPG

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

        First we set up some references.
        model = Sketchup.active_model ss = model.selection

        Then 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...

        TIG

        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