Not applicable
09-24-2019
03:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have copied in objects from another drawing into my drawing and then used the following code to look at line angles based on user selection.
[CommandMethod("AddPlObjEvent", CommandFlags.Session)] public void AddPlObjEvent() { var doc = app.DocumentManager.MdiActiveDocument; var ed = doc.Editor; Database db = doc.Database; Vector3d mat = ed.CurrentUserCoordinateSystem.Translation; using (var ads = doc.LockDocument()) { var pPtRes = doc.Editor.GetEntity("Select an object"); using (Transaction acTrans = db.TransactionManager.StartTransaction()) { // Open the Block table record for read BlockTable acBlkTbl; acBlkTbl = acTrans.GetObject(db.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; // Open the active viewport ViewportTableRecord acVportTblRec; acVportTblRec = acTrans.GetObject(doc.Editor.ActiveViewportId, OpenMode.ForWrite) as ViewportTableRecord; Line exampeLine = acTrans.GetObject(pPtRes.ObjectId, OpenMode.ForWrite) as Line; ed.WriteMessage("\nLine Angle is:" + Place_Cables.Nearby_Cables.radToDeg(exampeLine.Angle)); } } }
It returns the wrong angles; the image below shows the angles I expect and see in properties and then in the red box the angles my code returns. I think it has something to do with UCS to WCS but I am unsure on how to get the copied objects ordinate system. If I draw a new line then I get the angles not in the red box. I would like to either:
-use the copied ordinate system to convert my new line angles to the copied objects ordinates
-convert all copied objects to my ordinate system.
Solved! Go to Solution.
Link copied