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

    How to get current active axis?

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 6 Posters 563 Views 6 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.
    • PixeroP Offline
      Pixero
      last edited by

      As the title says. How do I get the current active axis?

      1 Reply Last reply Reply Quote 0
      • jolranJ Offline
        jolran
        last edited by

        Tjena.

        Let say you get a face normal called new_z.
        You could say new_z is the upvector, if I remember correctly.
        Anyway. new_z must be a vector. That you use as current Z-axis.

        x_axez, y_axez, z_axez = new_z.axes
        
        1 Reply Last reply Reply Quote 0
        • PixeroP Offline
          Pixero
          last edited by

          Tjena!

          [Off Topic Swedish: Har du sett att vi startat ett svensk subforum? Gå in under dina inställningar och lägg till om du vill se det.]

          I should have been clearer, I'd like to get the axis of the current component beeng selected.

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

            Use component_instance.transformation.origin to get its location in its container and then
            component_instance.transformation.zaxis etc for the axes...
            See here: http://www.sketchup.com/intl/en/developer/docs/ourdoc/transformation
            These API notes are full of typos 😒 , BUT you should get the gist... 🤓

            TIG

            1 Reply Last reply Reply Quote 0
            • jolranJ Offline
              jolran
              last edited by

              OT

              @unknownuser said:

              [Off Topic Swedish: Har du sett att vi startat ett svensk subforum? Gå in under dina inställningar och lägg till om du vill se det.]

              Nej! Ska genast kolla. Tack 😄

              @unknownuser said:

              I'd like to get the axis of the current component beeng selected.

              Do you mean the Transformation.origin ?

              I mean it depends on how the component is built ?
              It could be a gluing component or face me.

              You could check out this topic.
              http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=57623%26amp;p=524693%26amp;hilit=get+component#p524693

              Edit TIG was faster.

              1 Reply Last reply Reply Quote 0
              • PixeroP Offline
                Pixero
                last edited by

                @tig said:

                Use component_instance.transformation.origin to get its location in its container and then
                component_instance.transformation.zaxis etc for the axes...
                See here: http://www.sketchup.com/intl/en/developer/docs/ourdoc/transformation
                These API notes are full of typos 😒 , BUT you should get the gist... 🤓

                Oooh, I feel rusty.
                And if I want to use this within a selection. Check to see if it's a group or component and get axis and if it's not, use world axis? or parents axis if that is a component.
                Am I making sense?

                1 Reply Last reply Reply Quote 0
                • AdamBA Offline
                  AdamB
                  last edited by

                  In general, to get the worldspace axes, you'll need to chase up the hierarchy to the top, applying each parent.
                  Its kind of a pain..

                  Developer of LightUp Click for website

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

                    To get the current hierarchy you can use:

                    path=Sketchup.active_model.active_path

                    http://www.sketchup.com/intl/en/developer/docs/ourdoc/model#active_path

                    Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

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

                      If you are in the root context then you can't. If the user has set a custom axis then there is no Ruby API method to obtain that. We have that logged as a feature request.

                      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