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

Finding a Component/group axis?

Scheduled Pinned Locked Moved Developers' Forum
8 Posts 2 Posters 311 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.
  • C Offline
    Chris Fullmer
    last edited by 13 Mar 2009, 20:50

    Ok, I thought I knew how to do this, but I seem to be unable to figure it out.

    Lets say I have a nice ComponentInstance in my model. I want to find the 3d position (x,y,z) where it's axis is set. is that possible?

    Lately you've been tan, suspicious for the winter.
    All my Plugins I've written

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 13 Mar 2009, 21:58

      hm... I thought it would be myInstance.definition.insertion_point but it seem to only return a vector of (0,0,0)...

      I know that you can't set the axis via ruby, but I had thought you could read it... hm...

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • C Offline
        Chris Fullmer
        last edited by 13 Mar 2009, 22:02

        I think I just found what I was hoping to find. What I need is in the transformation array. It is position 13 = x, 14 = y and 15 = z. So:
        So select a component and run this in the webconsole and it puts the xyz position - hooray!

        puts Sketchup.active_model.selection[0].transformation.to_a[12]
        puts Sketchup.active_model.selection[0].transformation.to_a[13]
        puts Sketchup.active_model.selection[0].transformation.to_a[14]
        

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • C Offline
          Chris Fullmer
          last edited by 13 Mar 2009, 22:05

          Oh, you responded.

          I think the insert point exists because of some functionality that SU has built in to make it so that when you insert a component from the browser, it fixes itself to your cursor based on the last point that you used to move another instance of that component in-model. That is the insertion_point I think. Seems weird its an array. It says it should be a Point3d object.

          Chris

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 13 Mar 2009, 22:10

            Ah, yea. That gives the global position even if the instance is nested.

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 13 Mar 2009, 22:12

              @chris fullmer said:

              Oh, you responded.

              I think the insert point exists because of some functionality that SU has built in to make it so that when you insert a component from the browser, it fixes itself to your cursor based on the last point that you used to move another instance of that component in-model. That is the insertion_point I think. Seems weird its an array. It says it should be a Point3d object.

              Chris

              Yea, it was a Point3d object. Though, an array [0,0,0] can be used in place of Point3d.

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • C Offline
                Chris Fullmer
                last edited by 13 Mar 2009, 22:26

                tee-hee-he. You said aray, and for some reason my mind though of an array as it defines a vector line. My mind hes been working with normals on quite a few projects I think.

                Thanks for the input!

                Chris

                Lately you've been tan, suspicious for the winter.
                All my Plugins I've written

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 13 Mar 2009, 22:33

                  Actually, I think I said it returned a vector... ... ...I'm going to go to bed now. Wires are getting crossed again...

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  1 / 1
                  • First post
                    1/8
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement