代码改变世界

VB编程操作AutoCAD坐标型尺寸标注

2011-06-19 21:38  精诚所至 金石为开  阅读(548)  评论(0编辑  收藏  举报

坐标型尺寸标注用来标注零部件上某点相对于原点的垂直距离,创建坐标型尺寸标注对象用AddDimOrdinate方法,语法格式如下。

RetVal=object.AddDimOrdinate(DefinitionPoint,LeaderEndPoint,UseXAxis)

下面的代码创建一个坐标型尺寸标注。

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) = 8#: definingpoint(2) = 0#
    leaderendpoint(0) = 20#: leaderendpoint(1) = 13#: leaderendpoint(2) = 0#
    usexaxis = False
    Set dimobj = acadapp.ActiveDocument.ModelSpace.AddDimOrdinate(definingpoint, leaderendpoint, usexaxis)
    ZoomExtents
End Sub