VB编程修改AutoCAD坐标型尺寸标注
2011-06-19 22:55 精诚所至 金石为开 阅读(592) 评论(0) 编辑 收藏 举报坐标型尺寸标注的编辑与长度性尺寸标注的编辑相似,属性相同,为了使标注更加清楚,可以利用TextPrefix属性给坐标型尺寸标注添加汉字前缀,下面的代码标注一个圆的中心坐标,分别设置引导线终点坐标和被标注点坐标的X或Y值相等,并给坐标添加汉字前缀。
Private Sub Command1_Click()
Dim dimobj As AcadDimOrdinate
Dim definingpoint(0 To 2) As Double
Dim leaderendpoint(0 To 2) As Double
Dim usexaxis As Boolean
definingpoint(0) = 12#: definingpoint(1) = 25#: definingpoint(2) = 0#
leaderendpoint(0) = 12#: leaderendpoint(1) = 45#: leaderendpoint(2) = 0#
usexaxis = True
Set dimobj = acadapp.ActiveDocument.ModelSpace.AddDimOrdinate(definingpoint, leaderendpoint, usexaxis)
acadapp.ActiveDocument.ActiveTextStyle.fontFile = "C:\windows\fonts\vani.ttf"
dimobj.TextPrefix = "圆心X坐标="
Dim cricleobj As AcadCircle
Set circleobj = acadapp.ActiveDocument.ModelSpace.AddCircle(definingpoint, 10)
leaderendpoint(0) = 0#: leaderendpoint(1) = 25#: leaderendpoint(2) = 0#
usexaxis = False
Set dimobj = acadapp.ActiveDocument.ModelSpace.AddDimOrdinate(definingpoint, leaderendpoint, usexaxis)
dimobj.TextPrefix = "圆心Y坐标="
ZoomExtents
End Sub