Notifications
Clear all

[Closed] Align pivot to vetex 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!

5 Replies

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

Branko, 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.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

it should not work in case of any rotation. the previous version was better. just needed a little correction.