属性または属性参照が定数かどうかを指定します。
サポートされているプラットフォーム: Windows のみ
読み込み専用: Attribute オブジェクトの場合は「いいえ」、AttributeReference オブジェクトの場合は「はい」
タイプ: ブール型
一定属性とは、どこにある場合でも同じ値を保持するという属性です。AutoCAD は一定属性の値を求めるプロンプトを表示しません。属性は、4 つのオプション モード(一定、プリセット、非表示、確認)の 1 つとしてのみ存在できます。
VBA:
Sub Example_Constant() ' This example creates an attribute definition in model space. ' It then queries the attribute to see if it is a constant attribute. Dim attributeObj As AcadAttribute Dim height As Double Dim mode As Long Dim prompt As String Dim insertionPoint(0 To 2) As Double Dim tag As String Dim value As String ' Define the attribute definition height = 1# mode = acAttributeModeVerify prompt = "New Prompt" insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0 tag = "New_Tag" value = "New Value" ' Create the attribute definition object in model space Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value) ZoomAll ' Query the attribute GoSub QUERYSTATUS ' Change the attribute attributeObj.constant = Not attributeObj.constant GoSub QUERYSTATUS Exit Sub QUERYSTATUS: If attributeObj.constant Then MsgBox "The attribute is a constant attribute." Else MsgBox "The attribute is not a constant attribute." End If Return End Sub
Visual LISP:
(vl-load-com) (defun c:Example_Constant() ;; This example creates an attribute definition in model space. ;; It then queries the attribute to see if it is a constant attribute. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Define the attribute definition (setq insertionPoint (vlax-3d-point 5 5 0) attHeight 1 attMode acAttributeModeVerify attPrompt "New Prompt" attTag "New_Tag" attValue "New Value") ;; Create the attribute definition object in model space (setq modelSpace (vla-get-ModelSpace doc)) (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue)) (vla-ZoomAll acadObj) ;; Query the attribute (if (= (vla-get-Constant attributeObj) :vlax-true) (alert "The attribute is a constant attribute.") (alert "The attribute is not a constant attribute.") ) ;; Change the attribute (vla-put-Constant attributeObj (if (= (vla-get-Constant attributeObj) :vlax-true) :vlax-false :vlax-true)) (if (= (vla-get-Constant attributeObj) :vlax-true) (alert "The attribute is a constant attribute.") (alert "The attribute is not a constant attribute.") ) )