• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Selection.add ??? possible?

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 4 Posters 291 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.
  • A Offline
    artmusicstudio
    last edited by 21 Jul 2014, 22:37

    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
    • S Offline
      sdmitch
      last edited by 21 Jul 2014, 23:42

      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
      • T Offline
        TIG Moderator
        last edited by 21 Jul 2014, 23:57

        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
        • T Offline
          tt_su
          last edited by 22 Jul 2014, 09:53

          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
          1 / 1
          • First post
            1/4
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement