长度型尺寸标注包括平行标注与指定角度标注,平行标注的尺寸线平行于尺寸界线起点所在的直线,指定角度标注的尺寸线与尺寸界线起点所在的直线成一定角度。
用AddDimAligned方法创建平行尺寸标注对象,语法格式如下。
RetVal=object.AddDimAligned(ExtLine1Point,ExtLine2Point,TextPosition)
创建指定角度标注对象用AddDimRotated方法,语法格式如下。
RetVal=objcet.AddDimRotated(XLine1Point,XLine2Point,DimLineLocation,RotationAngle)
下面的代码创建并显示一个平行尺寸标注对象。
Private Sub Command1_Click()
Dim dimobj As AcadDimAligned
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
Dim location(0 To 2) As Double
point1(0) = 5#: point1(1) = 5#: point1(2) = 0#
point2(0) = 28#: point2(1) = 5#: point2(2) = 0#
location(0) = 10#: location(1) = 15#: location(2) = 10#
Set lineobj = acadapp.ActiveDocument.ModelSpace.AddLine(point1, point2)
Set dimobj = acadapp.ActiveDocument.ModelSpace.AddDimAligned(point1, point2, location)
ZoomExtents
End Sub