Align pivot to vetex numbers

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 10 October 2012   #1
Align pivot to vertex numbers

Hi!
I need a script to align pivot to a fixed vertex number of multiple objects.
Here is the situation: we have 100 planes, they are rotated and skewed as a result of a path deform so I can't use Soulburn PivotUI placer script because their bounding boxes are not aligned to the planes. I know that every plane has the vertex number 6 where I want the pivot to be. So I think it could be possible to write a script to align the pivot to every object's 6th vertex.

Can you help me?

Thank you!

Last edited by stecca : 10 October 2012 at 10:02 AM. Reason: error
 
Old 10 October 2012   #2
Select the planes and use:

- for editable_poly objects

for o in selection do o.pivot = polyop.getVert o 6


- for editable_mesh objects

for o in selection do o.pivot = meshop.getVert o 6


- for primitives

for o in selection do
 	(
 		addModifier o (Edit_Mesh())
 		o.pivot = meshop.getVert o 6
 		deleteModifier o 1
 	)

Last edited by miauu : 10 October 2012 at 04:43 PM.
 
Old 10 October 2012   #3
Originally Posted by miauu: Select the planes and use:

- for editable_poly objects

for o in selection do o.pivot = polyop.getVert o 6


- for editable_mesh objects

for o in selection do o.pivot = meshop.getVert o 6


- for primitives

for o in selection do
     	(
     		addModifier o (Edit_Mesh())
     		o.pivot = meshop.getVert o 6
     		deleteModifier o 1
     	)

Hi Kostadin this is a coincidence, we have same number of post
@stecca You can translate this in one line
for o in selection where isKindOf o geometryClass and not isKindOf o TargetObject do o.pivot = (getVert o.mesh 6)*o.transform
__________________
Looking in the right side. [bgaTools]

Last edited by gazybara : 10 October 2012 at 07:42 PM.
 
Old 10 October 2012   #4
Branko, your code produce strange result.
See this gif image.

Last edited by miauu : 10 October 2012 at 03:49 AM.
 
Old 10 October 2012   #5
Originally Posted by miauu: Branco, your code produce strange result.
See this gif image.

My bad. Shorter version works
for o in selection do o.pivot = o.center+(getVert o.mesh 6)

BTW we talk about "c" in my name
Cheers friend.
__________________
Looking in the right side. [bgaTools]

Last edited by gazybara : 10 October 2012 at 11:37 PM.
 
Old 10 October 2012   #6
Originally Posted by gazybara: My bad. Shorter version works
for o in selection do o.pivot = o.center+(getVert o.mesh 6)


it should not work in case of any rotation. the previous version was better. just needed a little correction.
 
Old 10 October 2012   #7
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 06:55 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.