I am having an issue with correctly applying the position of a mesh according to the block instance it belongs to.
So, as the question says, how do I exactly apply the transform data of a
CRhinoInstanceObject into an mesh of type
currentONMesh. (I am using the C++ API, btw)
I have tried multiple approaches like :
a) Using the
Transform() method :
ON_Mesh* currentONMesh = currentRhinoMesh.m_mesh; const CRhinoInstanceObject* currentMeshInstaceObj = currentRhinoMesh.m_iref_object; ON_Xform instanceTransform = currentMeshInstaceObj->InstanceXform(); currentONMesh->TransformUserData(instanceTransform); currentONMesh->Transform(instanceTransform);
b) Individually changing the mesh’s vertices as:
const CRhinoInstanceObject* currentMeshInstaceObj = currentRhinoMesh.m_iref_object; ON_3dPoint instancePoint = ON_3dPoint::Origin; instancePoint.Transform(currentMeshInstaceObj->InstanceXform());
In this approach, after I get the
instancePoint, I use it’s x, y, z values as the values for the vertices of the mesh.
Both of these approaches are not working for me.
So, what would be the correct way to achieve this?