VB编程操作AutoCAD导线型尺寸标注
2011-06-19 22:05 精诚所至 金石为开 阅读(444) 评论(0) 编辑 收藏 举报导线型尺寸标注用来添加旁注、说明文字,创建导线型型标注对象用AddLeader方法,语法格式如下。
RelVal=object.AddLeader(PointsArray,Annotation,Type)
下面的程序创建并显示一个有箭头的导线型标注。
Private Sub Command1_Click()
Dim leaderobj As AcadLeader
Dim points(0 To 8) As Double
Dim leadertype As Integer
Dim annotationobject As AcadObject
Dim mtextobj As AcadMText
Dim corner(0 To 2) As Double
Dim width As Double
Dim text As String
corner(0) = 0#: corner(1) = 15#: corner(2) = 0#
width = 30
text = "R1.5(min)"
Set mtextobj = acadapp.ActiveDocument.ModelSpace.AddMText(corner, width, text)
Set annotationobject = mtextobj
points(0) = 0: points(1) = 0: points(2) = 0
points(3) = 4: points(4) = 4: points(5) = 0
points(6) = 4: points(7) = 5: points(8) = 0
leadertype = acLineWidthArrow
Set leaderobj = acadapp.ActiveDocument.ModelSpace.AddLeader(points, annotaionobject, leadertype)
ZoomExtents
End Sub