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

    How to get the insertion point of a component?

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 479 Views 3 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.
    • C Offline
      confitex architure
      last edited by

      how to get the insertion point of a component in the active model? That means the position of the component.

      ss = Sketchup.active_model.selection
      for e in ss
         if (e.kind_of?(Sketchup;;ComponentInstance) ) 
      	point = e.definition.insertion_point
      	puts point
         end
      end
      

      it shoud bevery simple but I don't get it: I get 0,0,0 with this code but the component is not on 0,0,0...
      What's could be wrong?
      Thanks !!!!!

      1 Reply Last reply Reply Quote 0
      • Didier BurD Offline
        Didier Bur
        last edited by

        Of course the insertion point of a component definition is always 0,0,0 !
        You have to use this instead:

        ss = Sketchup.active_model.selection
        for e in ss
           if (e.kind_of?(Sketchup;;ComponentInstance) )
           point = e.transformation.origin
           puts point
           end
        end
        

        Hope this helps,

        DB

        1 Reply Last reply Reply Quote 0
        • C Offline
          confitex architure
          last edited by

          Yes, It does help!
          Merci Didier.

          1 Reply Last reply Reply Quote 0
          • T Offline
            todd burch
            last edited by

            Yes, I remember now figuring this out when I wrote the 3D Text Tool.

            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