I'm using AutoCAD 2007 and VB.net 2005. The VB.net code below works fine except that the Dimension line and Text are not off-set from the object I'm dimensioning. The dimension line is directly inline with the points that I want to dimension. I would like the Dimension line and Text to be 1/2" offset from the object I am dimensioning.
Does anybody know how to modify this code so the dimension line will be 1/2" away from the object?
Thanks for your help,
Private Function CreatedDim(ByVal x1, ByVal y1, ByVal x2, ByVal y2) As ObjectId
Dim pt1 As New Geometry.Point3d(x1, y1, 0)
Dim pt2 As New Geometry.Point3d(x2, y2, 0)
Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
Dim myTransMan As DatabaseServices.TransactionManager = db.TransactionManager
Dim myTrans As Transaction = myTransMan.StartTransaction()
Dim newActLayerName, strLayerColor, intLineWt As String
strLayerColor = "Red"
intLineWt = "015"
newActLayerName = "TEXT"
ChangeLayer(newActLayerName, strLayerColor, intLineWt)
Using myTrans
Dim bt As BlockTable = myTrans.GetObject(db.BlockTableId, OpenMode.ForRead, False)
Dim btr As BlockTableRecord = myTrans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)
Dim rd As New RotatedDimension
rd.XLine1Point = pt1
rd.XLine2Point = pt2
rd.TextAttachment = AttachmentPoint.TopMid
btr.AppendEntity(rd)
myTrans.AddNewlyCreatedDBObject(rd, True)
myTrans.Commit()
End Using
myTrans.Dispose()
myTransMan.Dispose()
End Function