TextOverride Property (ActiveX)

Specifies the text string for the dimension.

Supported platforms: Windows only

Signature

VBA:

object.TextOverride
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

The maximum length is 256 characters.

Remarks

The user string replaces the calculated dimension value. You can revert to the calculated dimension value by setting the text to a NULL string (""). You can append or prefix text to the primary dimension value by using a closed set of brackets (<>) to represent the value. The primary dimension value will replace the brackets when the string is displayed. For example, TextString = "<> mm" will result in a displayed string of "3.5 mm" where the value of the dimension is 3.5. You can also include the secondary dimension value using square brackets ( [] ).

Examples

VBA:

Sub Example_TextOverride()
    ' This example creates an aligned dimension and then changes the
    ' TextOverride property for that dimension.

    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
    
    ' Define the dimension
    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#
    
    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ZoomAll
    MsgBox "The initial text string for the dimension contains only the dimension value.", vbInformation, "TextOverride Example"
    
    ' Change the text string for the dimension
    dimObj.TextOverride = "The value is <>"
    dimObj.Update
    MsgBox "The text string for the dimension has been replaced. However, the dimension value is still represented.", vbInformation, "TextOverride Example"
    
    ' Reset the text string for the dimension
    dimObj.TextOverride = ""
    dimObj.Update
        
    MsgBox "The text string for the dimension is reset.", vbInformation, "TextOverride Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextOverride()
    ;; This example creates an aligned dimension and then changes the
    ;; TextOverride property for that dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 3 0)
          point2 (vlax-3d-point 10 3 0)
          location (vlax-3d-point 7.5 5 0))
    
    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    (vla-ZoomAll acadObj)
    (alert "The initial text string for the dimension contains only the dimension value.")
    
    ;; Change the text string for the dimension
    (vla-put-TextOverride dimObj "The value is <>")
    (vla-Update dimObj)
    (alert "The text string for the dimension has been replaced. However, the dimension value is still represented.")
    
    ;; Reset the text string for the dimension
    (vla-put-TextOverride dimObj "")
    (vla-Update dimObj)
        
    (alert "The text string for the dimension is reset.")
)