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

Group Axis moving... Want Constant Axis.

Scheduled Pinned Locked Moved Newbie Forum
sketchup
9 Posts 7 Posters 2.0k Views
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.
  • K Offline
    Krisidious
    last edited by 17 Apr 2012, 23:59

    Group Axis moving... Want Constant Axis.

    I'm working on an axis dependent model, and I'm exporting groups one at a time, and I'm noticing that as I make a group it's axis is being changed to match the geometry of the group. I want it to be constant through out all my groups unless otherwise changed.

    what am I doing wrong?

    By: Kristoff Rand
    Home DesignerUnique House Plans

    1 Reply Last reply Reply Quote 0
    • R Offline
      Rider
      last edited by 18 Apr 2012, 06:49

      i also had the same problems at times.I would advice you to change their axis from Edit Group option and see what happens.Well i never found a solution to my problem.

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gaieus
        last edited by 18 Apr 2012, 10:01

        Kris, how exactly do you need those group axes? Or even better; could those be components instead? Component axes can be easier manipulated.

        TIG has a plugin that will place all top level component axes to the world origin. Multipleinstances are made unique first. It is a great tool to export individual components and then reimport them somewhere where their insertion point will be their origins - and this point of those components then can be aligned perfectly.

        I am not sure if you need this though...
        http://forums.sketchucation.com/viewtopic.php?t=43582

        Gai...

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 18 Apr 2012, 10:37

          Gai's link is to fix components.
          The default axes [aka origin or insertion-point] of a group [or component] always go at its geometry's bounds.min corner [bottom-left-front].
          If you want them to be at the model's ORIGIN for a group you must include something at the origin as you can't change a group's axes through the context-menu [unlike with a component].
          It is possible to code something to reset groups' axes to the model's ORIGIN...

          <span class="syntaxdefault">module TIG<br />  def TIG</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">originateselectedgroups</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault">    model</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />    ss</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection<br />    return nil unless ss</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault">    model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_operation</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"TIG.originateselectedgroups"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    ss</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each</span><span class="syntaxkeyword">{|</span><span class="syntaxdefault">gp</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">      next unless gp</span><span class="syntaxkeyword">.class==</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Group<br />      gp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">make_unique </span><span class="syntaxcomment">### forced - deprecated messages are API error!<br /></span><span class="syntaxdefault">      gents</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">gp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities<br />      tr</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Transformation</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">translation</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">gp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transformation</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">origin</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">vector_to</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">ORIGIN</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault">      gp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transform</span><span class="syntaxkeyword">!(</span><span class="syntaxdefault">tr</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">      gents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transform_entities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">tr</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">inverse</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> gents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_a</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault">    model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">commit_operation<br />  end<br />end</span>
          

          Put all of this into a plain text file file in the Plugins folder named say ' TIG-originateselectedgroups.rb'. Restart Sketchup so it auto-loads.
          Select some stuff including some groups and type in the Ruby Console:
          TIG.originateselectedgroups
          All groups will have their axes relocated at the ORIGIN.
          Nested groups locate at the container's origin - which will be the ORIGIN, IF the container was processed earlier...
          Ignore the make_unique error messages, you can't have duplicate groups and hope for them to both be right [Bugsplat!], so it forces all groups to become 'unique'.
          🤓

          TIG

          1 Reply Last reply Reply Quote 0
          • W Offline
            Wo3Dan
            last edited by 18 Apr 2012, 16:14

            @tig said:

            ...If you want them to be at the model's ORIGIN for a group you must include something at the origin as you can't change a group's axes through the context-menu [unlike with a component].....

            Change individual group's axes by redrawing them within the group's context. No context axes option is available but get it through Tools > Axes (or just by the axes icon, also within group's context).

            1 Reply Last reply Reply Quote 0
            • K Offline
              Krisidious
              last edited by 19 Apr 2012, 05:04

              here's what I'm working on. I export groups or components one at a time as 3ds and then import into 3D Max. if I export groups all together, then they stay where they need to be. if I export individual groups like I need to they are imported into max with the axis of each group centered in the world origin... which is wrong.

              here you can see the origin and the individual axis'...
              car axis.jpg

              the thing is it didn't seem like I was having this issue last time... maybe it is using components.

              I'm going to try to soak in the advice here...

              By: Kristoff Rand
              Home DesignerUnique House Plans

              1 Reply Last reply Reply Quote 0
              • K Offline
                Krisidious
                last edited by 19 Apr 2012, 06:24

                I think that fixed almost all of them... thanks Tig. you rock.

                Tig's "Reset Groups' Axes to the Model's ORIGIN" Plugin

                let me know if you don't want this posted or posted as it is. I'll delete it. or if you have the power you can.

                By: Kristoff Rand
                Home DesignerUnique House Plans

                1 Reply Last reply Reply Quote 0
                • T Offline
                  Trogluddite
                  last edited by 19 Apr 2012, 07:16

                  @wo3dan said:

                  Change individual group's axes by redrawing them within the group's context.

                  Seems so obvious with hindsight! Thanks for the tip. 😄

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    josephkim626
                    last edited by 15 Feb 2018, 09:07

                    @tig said:

                    Gai's link is to fix components.
                    The default axes [aka origin or insertion-point] of a group [or component] always go at its geometry's bounds.min corner [bottom-left-front].
                    If you want them to be at the model's ORIGIN for a group you must include something at the origin as you can't change a group's axes through the context-menu [unlike with a component].
                    It is possible to code something to reset groups' axes to the model's ORIGIN...

                    <span class="syntaxdefault">module TIG<br />  def TIG</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">originateselectedgroups</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault">    model</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />    ss</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection<br />    return nil unless ss</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault">    model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_operation</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"TIG.originateselectedgroups"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    ss</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each</span><span class="syntaxkeyword">{|</span><span class="syntaxdefault">gp</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">      next unless gp</span><span class="syntaxkeyword">.class==</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Group<br />      gp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">make_unique </span><span class="syntaxcomment">### forced - deprecated messages are API error!<br /></span><span class="syntaxdefault">      gents</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">gp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities<br />      tr</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Transformation</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">translation</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">gp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transformation</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">origin</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">vector_to</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">ORIGIN</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault">      gp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transform</span><span class="syntaxkeyword">!(</span><span class="syntaxdefault">tr</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">      gents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transform_entities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">tr</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">inverse</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> gents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_a</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault">    model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">commit_operation<br />  end<br />end</span>
                    

                    Put all of this into a plain text file file in the Plugins folder named say ' TIG-originateselectedgroups.rb'. Restart Sketchup so it auto-loads.

                    Select some stuff including some groups and type in the Ruby Console:
                    TIG.originateselectedgroups
                    All groups will have their axes relocated at the ORIGIN.
                    Nested groups locate at the container's origin - which will be the ORIGIN, IF the container was processed earlier...
                    Ignore the make_unique error messages, you can't have duplicate groups and hope for them to both be right [Bugsplat!], so it forces all groups to become 'unique'.
                    🤓

                    TIG! Thank you so much for this.

                    Would it be possible to have the same function done for both components and groups?
                    I tried mixing the code, but my thin knowledge in programming doesn't cut it!
                    Also, would it be possible to target all nested components and groups?

                    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