mccad 发表于 2002-5-28 21:01:00

[例程]使用尺寸--坐标标注

Public Sub UseDimOrdinate()
   
    Dim oldOSMODE As Integer
    oldOSMODE = ThisDrawing.GetVariable("OSMODE")
    ThisDrawing.SetVariable "OSMODE", 15349
   
    Dim dimObj As AcadDimOrdinate
    Dim definingPoint As Variant
    Dim leaderEndPoint As Variant
    Dim useXAxis As Boolean
   
    '选择被标注点和标注文字的插入点
    definingPoint = ThisDrawing.Utility.GetPoint(, "选择被标注点:")
    leaderEndPoint = ThisDrawing.Utility.GetPoint _
                     (definingPoint, "选择标注文字显示位置点:")
   
    Dim kwordList As String
    Dim returnString As String
   
    '定义关键词
    kwordList = "True False"
    '允许键入回车键
    ThisDrawing.Utility.InitializeUserInput 2, kwordList
    '返回选定的关键词
    returnString = ThisDrawing.Utility.GetKeyword _
                   ("显示X坐标True / 显示Y坐标 <True>: ")
    '根据关键词确定显示被标注点的X坐标或Y坐标
    If StrComp(returnString, "False", 1) = 0 Then
      useXAxis = False
    Else
      useXAxis = True
    End If
   
    '在模型空间创建坐标标注对象
    Set dimObj = ThisDrawing.ModelSpace.AddDimOrdinate _
               (definingPoint, leaderEndPoint, useXAxis)

    ThisDrawing.SetVariable "OSMODE", oldOSMODE
   
    dimObj.ArrowheadSize = 5.5
    dimObj.TextHeight = 7
    dimObj.TextGap = 2.5
    dimObj.DecimalSeparator = "."
   
    Dim txtLocation As Variant
    Dim rotAngular As Double
   
    'txtLocation = ThisDrawing.Utility.GetPoint _
                  (leaderEndPoint, "确定标注值位置:")
    'dimObj.TextPosition = txtLocation
    rotAngular = ThisDrawing.Utility.GetReal("输入旋转角度:")
    dimObj.Rotation = rotAngular * 3.1415926 / 180
   
End Sub
页: [1]
查看完整版本: [例程]使用尺寸--坐标标注