sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    Ruby selection

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 540 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