Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi folks
I'm having a little trouble creating an ordinate dimension.
I want the ordinate dimension to be on the UCS not the WCS.
Here is my code:
[CommandMethod("CreateOrdinateDimension")] public static void CreateOrdinateDimension() { // Get the current database Document acDoc = Application.DocumentManager.MdiActiveDocument; Editor ed = acDoc.Editor; Database acCurDb = acDoc.Database; // Start a transaction using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) { // Open the Block table for read BlockTable acBlkTbl; acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable; // Open the Block table record Model space for write BlockTableRecord acBlkTblRec; acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; // Create an ordinate dimension using (OrdinateDimension acOrdDim = new OrdinateDimension()) { acOrdDim.UsingXAxis = true; //// this seems to print the dimension at the WCS origin? //acOrdDim.DefiningPoint = new Point3d(0,0,0); //acOrdDim.LeaderEndPoint = new Point3d(0, 0, 0); ////this seems to print at the UCS origin, but the numbers used are in fact WCS? acOrdDim.DefiningPoint = new Point3d(0, 0, 0).TransformBy(ed.CurrentUserCoordinateSystem); acOrdDim.LeaderEndPoint = new Point3d(0, 0, 0).TransformBy(ed.CurrentUserCoordinateSystem); acOrdDim.DimensionStyle = acCurDb.Dimstyle; // Add the new object to Model space and the transaction acBlkTblRec.AppendEntity(acOrdDim); acTrans.AddNewlyCreatedDBObject(acOrdDim, true); } // Commit the changes and dispose of the transaction acTrans.Commit(); } }
Attached is my drawing file.
- The circle centre marks the WCS origin.
The problem
- when i transform the defining and leader points by UCS, it does print to the UCS origin, but it is not saying 0. It is giving me the WCS numbers.
- When I do not transform by UCS, the correct numbers are shown, but it displays it at the WCS origin, not the UCS origin.
I want it to print at the UCS origin, and have it also display 0 at the same time.
assistance much appreciated.
chrs
Solved! Go to Solution.