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

How to get current active axis?

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 6 Posters 494 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.
  • P Offline
    Pixero
    last edited by 18 Jun 2014, 06:21

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

    1 Reply Last reply Reply Quote 0
    • J Offline
      jolran
      last edited by 18 Jun 2014, 08:15

      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
      • P Offline
        Pixero
        last edited by 18 Jun 2014, 08:51

        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
        • T Offline
          TIG Moderator
          last edited by 18 Jun 2014, 09:38

          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
          • J Offline
            jolran
            last edited by 18 Jun 2014, 09:41

            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
            • P Offline
              Pixero
              last edited by 19 Jun 2014, 07:29

              @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
              • A Offline
                AdamB
                last edited by 19 Jun 2014, 11:34

                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 19 Jun 2014, 19:08

                  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
                  • T Offline
                    tt_su
                    last edited by 23 Jun 2014, 12:27

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

                    Advertisement