[Plugin] Originate component axes

[Plugin] Originate component axes

Postby TIG » Tue Feb 28, 2012 12:34 pm

Request originally posted by Gaieus.

Gaieus wrote:Is there something that would move the component origins of all components in the model/selection to the world origin?

Yes, I know this would not work with models where there are several instances of the same component so I guess either in this case or just to make it simple and safe, every case all affected components should be made unique.

Also, ideally only top level components should be affected.

Here's a quick script to put into Plugins folder and restart SUp...
TIG (c) 2012
All Rights Reserved.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES,INCLUDING,WITHOUT LIMITATION,THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
###
TIG-originatecomponentsaxes.rb
###
Usage:
Preselect some Component-Instances [other things are ignored].
###
Ruby Console: TIG::originatecomponentsaxes()
Tool Menu: TIG::originate components axes
###
The component definitions are made unique if needed, then adjusted so that
their axes [insertion-point] is at the model-origin and the transformations
of their instances are inverted so the instances do not move...
###
Donations:
By PayPal.com to info @ revitrev.org
###
Version:
1.0 20120228 First Issue.

TIG-originatecomponnetsaxes.rb
0
Last edited by TIG on Mon Oct 08, 2012 1:33 pm, edited 2 times in total.
Reason: TIG's post moved from below to be the first post
TIG
User avatar
TIG 
Global Moderator
 

Re: [REQ] or is there a tool to move all component origins?

Postby mitcorb » Tue Feb 28, 2012 1:36 pm

I guess you saw "Axis component" by sahi. (in Plugins Index) This only helps set axes within the components as far as I know, and probably only one by one.
0
I take the slow, deliberate approach in my aimless wandering.
User avatar
mitcorb 
Top SketchUcator
 

Re: [REQ] or is there a tool to move all component origins?

Postby TIG » Tue Feb 28, 2012 1:51 pm

This one liner copy/paste + <enter> into the Ruby Console will move the insertion points [axes] of all selected instances to the origin, also making multiple-copies unique...
Code: Select all
m=Sketchup.active_model;s=m.selection.to_a;is=s.find_all{|i|i.class==Sketchup::ComponentInstance};m.start_operation('t');is.each{|i|i.make_unique if i.definition.instances[1];d=i.definition;t=i.transformation;es=d.entities;es.transform_entities(t, es.to_a);i.transform!(t.inverse)};m.commit_operation
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [REQ] or is there a tool to move all component origins?

Postby Gaieus » Tue Feb 28, 2012 2:02 pm

Prefect, this is exactly what I meant (and nested components are not affected, exactly as I wished).

Thank you very much, TIG! :ecstatic:

(Note to myself and others: the plugin uses the original world axes so if one moves the axes elsewhere, do not be surprised)

I'd have a question though. Now I have a bunch of lines of code: what do I need to do to have a plugin from those?



And thanks Tim as well of course - but I did not go to try after this :)
0
User avatar
Gaieus 
 

Re: [REQ] or is there a tool to move all component origins?

Postby mitcorb » Tue Feb 28, 2012 2:24 pm

That's ok, Csaba. If I were TIG, I would have done the same thing as he. :lol:
EDIT: only, it would have taken me a week to get back to you.
0
I take the slow, deliberate approach in my aimless wandering.
User avatar
mitcorb 
Top SketchUcator
 

Re: [REQ] or is there a tool to move all component origins?

Postby Pixero » Tue Feb 28, 2012 4:09 pm

Funny, just today I was needing the same thing.
Thanks!
0
User avatar
Pixero 
 

Re: [REQ] or is there a tool to move all component origins?

Postby Gaieus » Tue Feb 28, 2012 4:16 pm

Thanks very much again, TIG!!!
0
User avatar
Gaieus 
 

Re: [Plugin] Originate component axes

Postby simon le bon » Tue Feb 28, 2012 11:36 pm

Hi Gaï, TIG, tim, Jan, :)

Can someone shows in what sort of case this new plugin is (very) useful? Excuse me but my mind is dry to imagine it :?

8-) simon

PS: However, thank you TIG for this one and how many others+++
0
User avatar
simon le bon 
 

Re: [Plugin] Originate component axes

Postby mitcorb » Wed Feb 29, 2012 2:05 am

Hi, simon:
What I understand is this plugin will place the axes/origin of numerous components at the global axes origin of the model space. Gaieus can explain his purpose better than me. I was just cruising the Plugins Index in response to his request.
0
I take the slow, deliberate approach in my aimless wandering.
User avatar
mitcorb 
Top SketchUcator
 

Re: [Plugin] Originate component axes

Postby chrisjk » Wed Feb 29, 2012 8:22 am

As long as components haven't been purged from model, it would make it very easy to replace stuff that has been deleted from the working model - sort of paste in place for things not on the clipboard.
0
Chris

chrisjk 
Premium Member
Premium Member
 

Re: [Plugin] Originate component axes

Postby dem » Thu Mar 29, 2012 8:30 pm

It's great plugin!

But unfortunately it do not work for proper crop orientation of "make unique texture" function(
0
User avatar
dem 
 

Re: [Plugin] Originate component axes

Postby jaceguay » Mon Dec 31, 2012 1:54 am

There is a way to make it work on any components and groups in the model not only the top level ones?
0

jaceguay 
Premium Member
Premium Member
 

Re: [Plugin] Originate component axes

Postby john2 » Sat Dec 06, 2014 5:28 am

I would like it to work for all nested components within a component. So if we use the co nand on one component, all the nested components should also get originated axes. Currently it works for a single component. We have to manually select the nested components every tome within a component to make this plugin work.
0
Sketchup Make 2017 (64-bit), Vray 4.0 , Windows 10 – 64 bit, corei7-8750H, 16GB RAM, Nvidia GeForce GTX 1050Ti 4GB
User avatar
john2 
 

Re: [Plugin] Originate component axes

Postby josephkim626 » Thu May 18, 2017 11:13 am

In addition to making this work on groups as well as the components, It should have option to work on all nested groups and components?

Also, perhaps way to choose which axis to change to. Not limited to the world only, but perhaps to the axis of the currently active component or group?

I hope this makes sense.
1
User avatar
josephkim626 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: jt23, Luinteriores, sasazz and 39 guests

Visit our sponsors: