Duplication of elements with different orientation
Hello all,
I'm working on a script to duplicate elements from a reference component containing a solid to a new component with the same exact solid, but in another position and orientation.
The translation part was easy as the hm_getcentroid function provides the solid centroid position, so I can use the command *translatemark to translate the desired mesh to the correct position.
But to match the orientation, it has been a task more difficult that I was expecting.
My approach has been to extract the moment of inertia of the reference solid and the target solid using hm_getmoiofsolid. Once I get these values, I compute the principal moment of inertia for each solid, so I have a comparable reference to use. Then I calculate the Euler parameters (or Quaternions) to obtain the rotation angles that I can use to rotate the elements from the reference solid to match the target solid orientation.
The problem I'm facing is that it seems that the inertia calculation performed by hm_getmoiofsolid seems not to be consistent, in a sense that even extracting the principal moments of inertia from them, these principal directions do not coincide with the solid orientation.
What could be done in this case?
Thanks in advance,
Jefferson Vieira