- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to rotate a user coordinate system about it's Z axis. This seems like a simple task but apparently I'm missing some steps. I first create my transform and user coordinate system. These are in the correct location. Then later in the code I need to rotate the user coordinate system around it's z axis. I'm trying to use "SetToRotation" but this keeps using the default origin and coordinate system.
TransientGeometry transGeom = invApp.TransientGeometry;
Inventor.Matrix text_Transform = invApp.TransientGeometry.CreateMatrix();
text_Transform.SetCoordinateSystem(textOrigin3d, Xvec, Yvec, Zvec);
UserCoordinateSystemDefinition textUCSdef = oCompDef.UserCoordinateSystems.CreateDefinition();
textUCSdef.Transformation = text_Transform;
UserCoordinateSystem textUCS = oCompDef.UserCoordinateSystems.Add(textUCSdef);
Everything above works correctly. Then let's say I want to rotate the ucs 30 degrees about it's z axis:
text_Transform.SetToRotation(30 * Math.PI / 180, Zvec, transGeom.CreatePoint(0, 0, 0));
textUCS.Transformation = text_Transform;
This moves the ucs to the documents origin and uses the default coordinate system, rotated 30 degrees about the Zvec. So, it's using the right vector to rotate about, but it's using the wrong coordinate system. What am I missing?
Solved! Go to Solution.