TextOverride プロパティ(ActiveX)

寸法値の文字列を指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.TextOverride
object

タイプ: Dim3PointAngularDimAlignedDimAngularDimArcLengthDimDiametricDimensionDimOrdinateDimRadialDimRadialLargeDimRotated

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: 文字列

長さは、最大で 256 文字です。

注意

ユーザ文字列は、計算された寸法値を置き換えます。文字を NULL 値("")に設定することで計算された寸法値に戻すことができます。値を表示するために括弧(<>)を使用することで、初期の寸法値に文字を付加することができます。文字列が表示されたときに初期値は括弧()に置き換わります。たとえば、TextString="<> mm" は、文字列 "3.5mm" が表示されます。この場合の寸法値は 3.5 です。角括弧([])を使用して変換単位の寸法値を含めることもできます。

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.")
)