I'm writing a .Net extension for AutoCAD and I've been unsucessful in trying to make dimensions in 3d (i.e. on the z axis). Here is the code that I'm have to try to accomplish this:
Dim doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim db = doc.Database Dim ed = doc.Editor Using trx As Transaction = db.TransactionManager.StartTransaction() ' Open the Block table for read Dim bt As BlockTable = TryCast(db.BlockTableId.GetObject(OpenMode.ForRead), BlockTable) ' Open the Block table record Model space for write Dim acBlkTblRec As BlockTableRecord = trx.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite) ' Create the dimension Dim acRotDim As RotatedDimension = New RotatedDimension() acRotDim.SetDatabaseDefaults() acRotDim.XLine1Point = New Point3d(120, 120, 0) acRotDim.XLine2Point = New Point3d(120, 120, 120) acRotDim.DimLinePoint = New Point3d(140, 120, 0) ' Add the new object to Model space and the transaction acBlkTblRec.AppendEntity(acRotDim) trx.AddNewlyCreatedDBObject(acRotDim, True)
trx.Commit() End Using
When this code is run the dimension is created and the extension line snaps are in the correct places. However, the lines and text are stuck on the "ground" and it's shows a distance of 0. How can I create the dimension so that it's on the right plane?
Hi,
I guess the dimenstion shows 0 as it's object coordinate system is not parallel to Z-axis, if the OCS is the same as the XY-plane then the distance between that 2 points (in XY-plane) is 0 and that is correct.
Just as info: there is a special .NET forum >>>here<<<. It might help to search there (and to ask questions).
HTH, - alfred -