替代标注文字

AutoCAD ActiveX/VBA

 
替代标注文字
 
 
 

可以使用 TextOverride 特性来替换所显示的标注值。使用此特性可以完全替换所显示的标注值,也可以向该值附加文字。

修改标注文字

本例向标注值附加了文字,所以既显示字符串,又显示标注值。

Sub Ch5_OverrideDimensionText()
    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) = 3#: point1(2) = 0#
    point2(0) = 10#: point2(1) = 3#: point2(2) = 0#
    location(0) = 7.5: location(1) = 5#: location(2) = 0#
      
    ' 在模型空间中创建对齐标注对象
    Set dimObj = ThisDrawing.ModelSpace. _
                   AddDimAligned(point1, point2, location)
      
    ' 修改标注的字符串
    dimObj.TextOverride = "The value is <>"
    dimObj.Update
End Sub