Notifications
Clear all

[Closed] pivot alignment

just done, also using some cool script with path-constrain or the path deform one. but the seams doesn’t match correctly with the holes.

the problem in this case is that the wrist has seams holes and i used flow along a curve to modify the wrist and the seams. my workflow is normally rhino-> max
but at time the only way to get the instance right is too use a max modifier, export the seams to rhino and to reconstruct the wrist there.

it would be a lot easier if the max “path deform” would work precisely like the “flow along a curve” from rhino but it doesn’t

but anyway, for those that work with other software it would be nice to have a script that can reorient the pivots in max!

but anyway, for those that work with other software it would be nice to have a script that can reorient the pivots in max!

in theory is possible, but kind of crazy, because in your case each object has a different structure/topology, but the surface/shape is similar.

that would need to ‘reverse engineer’ the object, for example detect possible curves, corners, symmetry, etc. depending on the type of object, this could be very complex.

I see more logical to fix this on rhino’s side.
Still thinking… there must be a way…
…can’t believe that Rhino has that kind of limitations.

I think there is another approach to the problem.

What you essentially need is to:
-Export 1 object from Rhino
-Export all the objects transform values.
-Import the object in 3dsMax
-Instance it as many times as needed.
-Apply Transformation values exported from Rhino to the instanced meshes.

Is there a way to export the transform values of objects from Rhino, to a text file for example?

1 Reply
(@jinj)
Joined: 11 months ago

Posts: 0

this was exactly the idea Anubis had about… to export the data with a vbs as txt from rhino, he created a maxscript to read the values in the txt and to reorient the pivots by names on each geometries… he also looked into rhino, but he couldn’t find a useful sets of data for the orientation.

this why now i’m asking for any other ideas inside max.
thank you for the imput

if i convert to poly or to mesh the body objects they show to be identical… same vertex count same shape… same in all, only the pivot is differently aligned.

1 Reply
(@norman3d)
Joined: 11 months ago

Posts: 0

Yes, that makes sense. It’s saving the world transformation values, not the local ones. It is the local ones that you need to output into a text file. And then parse that data with maxscript to reconstruct the scene. At least that’s how I would do it.

Yes, to ask Rhino for transform data is like to ask Max for a transform of a vertex. For guys who never touch Rhino (including me) this is confusing. So I tried to help Jinj (as the VBScript is easy) but hit a dead end on this one. Noone was able to help in Rhino forums as well.

Select all SIMILAR objects that you want to align their pivot
and run this script


fn alignPivotsByMesh arr  =
(
	for o in arr do 
	(
		disableSceneRedraw()
		local sn = snapshot o
		local x 	=	normalize (getVert  sn (getNumVerts  sn) -  sn.pivot)
		local temp  = 	normalize (getVert  sn (getNumVerts  sn - 1) -  sn.pivot)
		local y 	=	normalize (cross x temp)
		local z 	= 	normalize (cross x y)
		delete sn
		enableSceneRedraw()
		local TM = Matrix3 x y z o.pivot
				
		o.transform = TM
		
		XF = XForm()
		addModifier o XF
		XF.center = o.pivot
		XF.gizmo = inverse TM
		
	)
)

alignPivotsByMesh (selection as array)
1 Reply
(@jinj)
Joined: 11 months ago

Posts: 0

wow that works like charm, the script works if the “affects pivots” is enabled.
there are some problems.
-the object are all rescaled to 0.1 i think because i scaled them after importing. rescaling all to 1000 just fix the problem
-some pivots are aligned differently with flipped axis. adjusting them all before to run the script do not fix the final result.
but i think there is hope

EDITED: applying reset xform to all works more better, only of them have flipped axis. but i can delete half of them and create a mirror.

see example image below.
btw isn’t a big problem

I can’t open your max file for testing , I have max 2009 installed
but I think if before applying the script you will apply “Reset XForm” from utilities to all objects. (maybe you have to collapse modifier stack also)

it will fix the flipped axis issue.

1 Reply
(@jinj)
Joined: 11 months ago

Posts: 0

i can export the scene as fbx for max 2009 or as 3ds if it’s right for you!

Let’s try both of them

here the zip with fbx 2009 and 3ds
seams.zip

Ok. We come back to Ruramuq’s post:

because in your case each object has a different structure/topology, but the surface/shape is similar.

every object in your scene has different vertex number in this case my script can’t work precisely

you need to supply objects with exactly the same topology . In this case all pivots will be aligned in appropriate way.

anyway this is the fixed version without scale issue:

fn alignPivotsByMesh arr  =
(
	for o in arr do 
	(
		disableSceneRedraw()
		resetXForm o
		local sn = snapshot o
		local x 	=	normalize (getVert  sn (getNumVerts  sn) -  sn.pivot)
		local temp  = 	normalize (getVert  sn (getNumVerts  sn - 1) -  sn.pivot)
		local y 	=	normalize (cross x temp)
		local z 	= 	normalize (cross x y)
		delete sn
		enableSceneRedraw()
		local TM = Matrix3 x y z o.pivot
				
		o.transform = TM
		
		XF = XForm()
		addModifier o XF
		XF.center = o.pivot
		XF.gizmo = inverse TM
		
	)
)

alignPivotsByMesh (selection as array)
Page 2 / 7