Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to move a UCS to a particular point and then get the coordinates of an Entity ,in this case a circle, based upon the UCS I just moved as its base point. The results of the coordinates obtained from code are incorrect (X3.0,Y5.5,Z0) which makes no sense. They should be (X2.5,Y0.0,Z0.0). after my code runs I can check the coordinates manually in AutoCad and the are correct. Not sure what the problem is.Any help would be appreciated.
private static void UcsBaseCoords(Circle circle, Point3d newBasePoint) { var acDoc = Active.Document; CoordinateSystem3d coordSystem = new CoordinateSystem3d(newBasePoint, new Vector3d(0, -1, 0),new Vector3d(1, 0, 0)); CoordinateSystem3d cosy = acDoc.Editor.CurrentUserCoordinateSystem.CoordinateSystem3d; var ecs = Matrix3d.AlignCoordinateSystem(cosy.Origin, cosy.Xaxis, cosy.Yaxis, cosy.Zaxis, coordSystem.Origin, coordSystem.Xaxis, coordSystem.Yaxis, coordSystem.Zaxis); acDoc.Editor.CurrentUserCoordinateSystem = ecs; acDoc.Editor.UpdateTiledViewportsInDatabase(); var coodrsBasedOnUcs = circle.Center.TransformBy(ecs); acDoc.Editor.WriteMessage(String.Format("X{0}, Y{1}, Z{2}", coodrsBasedOnUcs.X, coodrsBasedOnUcs.Y, coodrsBasedOnUcs.Z)); }
This is after my program runs and it is correct. My UCS has been moved and If I check the circle's coordinates they are correct.(X2.5,Y0.0,Z0.0)
This is my dwg before I run my program.
Solved! Go to Solution.