Group Axis moving... Want Constant Axis.
-
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?
-
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.
-
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'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 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).
-
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'...
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...
-
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.
-
@wo3dan said:
Change individual group's axes by redrawing them within the group's context.
Seems so obvious with hindsight! Thanks for the tip.
-
@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?
Advertisement