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

    Finding a Component/group axis?

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 2 Posters 346 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      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
      • thomthomT Offline
        thomthom
        last edited by

        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
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          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
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            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
            • thomthomT Offline
              thomthom
              last edited by

              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
              • thomthomT Offline
                thomthom
                last edited by

                @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
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  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
                  • thomthomT Offline
                    thomthom
                    last edited by

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

                    Advertisement