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!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Selection.add ??? possible?

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 4 Posters 318 Views 4 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.
    • artmusicstudioA Offline
      artmusicstudio
      last edited by

      hi,
      when i have

      
      model = Sketchup.active_model
      sel = model.selection
      
      

      and create a edge-copy from a given edge (from an edge-array : edges)

      
      entities2 = Sketchup.active_model.entities
      vertex = edges[0].start
      pt_start = vertex.position
      			
      vertex = edges[0].end
      pt_end = vertex.position
      					
      edge2 = entities2.add_line(pt_start, pt_end)
      
      

      how could i ADD the new edge2 to the sel ??? (merge ?)
      is it possible?

      after this the further code should realise sel incl. the new adge2 as USER's SELECTION .

      thanx
      stan

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        I don't think Sketchup will allow you to place one edge on top another in the same context. The copy would have to be created in a group then sel.add edge2 would add it to the selection.

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

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

          sel.add(edge2)

          BUT best to test it's valid - edge2.valid?

          BUT beware!

          The entity must be in the model.active_entities context...
          You can 'cross-thread' selected entities BUT it will crash SketchUp...

          TIG

          1 Reply Last reply Reply Quote 0
          • tt_suT Offline
            tt_su
            last edited by

            Was that a question on how? Or did you experience issues with Selection.add (because that is exactly the API method to do what you requested: http://www.sketchup.com/intl/en/developer/docs/ourdoc/selection#add)

            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