Create CONM2 from NX Metadata
Hi,
Im working on a script to create CONM2 elements from NX Metadata attributes of an assembly. Workflow is the following:
1. Update mass properties in NX and write them as attributes.
2. Import BOM into Hyperworks
3. Query all metadata from each part/part assembly (NX_Mass, NX_MassPropCenterOfMassX, MomentofInertias, etc, etc...)
4. Create CONM2 with an associated system.
Here is the trouble:
NX writes the CoG and MoI in the local system of each part, not in the global coordinate of the assembly.
So I try to get the transformation matrix of each part via [hm_getvalue modules id=$myPart dataname=transformation_matrix] and then apply *transformmark using the obtained matrix. However, I dont manage to get it to work. The system and node Im trying to transform, never gets positioned as expected. Could someone share any experience here? How to use *transform command? can this be done with *translatemark and *rotatemark?
Concretely, how to interpret these values?
x0y0z0 is straightforward, but what are the other "triples" and how I can use them to position my CONM2 element?
thanks and best regards,
Alejandro
Answers
-
Hi Alejandro,
The transformation matrix from the part browser is a "regular" spatial transformation matrix.
Additional information on these websites:
- https://www.brainvoyager.com/bv/doc/UsersGuide/CoordsAndTransforms/SpatialTransformationMatrices.html
- https://en.wikipedia.org/wiki/Transformation_matrix
Here is an example of a transformation matrix to translate about 5 on X axis:
1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 -5.000000 0.000000 0.000000 1.000000Another example of a transformation matrix to scale a part by 2:
-2.000000 0.000000 0.000000 0.000000 0.000000 -2.000000 0.000000 0.000000 0.000000 0.000000 -2.000000 0.000000 0.000000 0.000000 0.000000 -2.000000
If you want to work with parts and transformation matrices, you can use these tcl commands:
https://help.altair.com/hwdesktop/hwd/topics/reference/hm/_me_transformationmatrixset.htm
*ME_TransformationMatrixSet => to set the transformation matrix for a part.https://help.altair.com/hwdesktop/hwd/topics/reference/hm/_me_moduleposition.htm
*ME_ModulePosition => to position a part using its hierarchical transformation matrices (from parent entities: parts and part assemblies)Otherwise, you can also use the more direct *positionentity tcl command (since v2023).
https://help.altair.com/hwdesktop/hwd/topics/reference/hm/_positionentity.htm?zoom_highlight=*positionentityRegards,
Fred.0