Vla-addattribute
- 構文
- (vla-addattribute vla-object Height Mode Prompt InsertionPoint Tag Value)
- 機能
- 指定された挿入点に指定されたプロパティの属性定義を作成する。
- 引数
-
- vla-object … VLA オブジェクト
- Height … 倍精度浮動小数点数型。現在の作図単位での文字の高さ
- Mode … AcAttributeMode 列挙型。(どの定数の組み合わせも、同時に定数を追加に使用できる):
- acAttributeModeInvisible
- acAttributeModeConstant
- acAttributeModeVerify
- acAttributeModeLockPosition
- acAttributeModeMultipleLine
- acAttributeModePreset
- Prompt … 文字列。この属性を保持するブロックが挿入されると、この文字列が表示される。 この文字列の既定値は、Tag で指定した文字列となる。Mode パラメータに acAttributeModeConstant を入力すると、プロンプト文字列は無効になる。
- InsertionPoint … バリアント型(3 要素の倍精度浮動小数点数型配列) 属性の位置を示す 3D WCS 座標。
- Tag … 文字列。この非 null 文字列は、属性が出現するたびにそれを識別する。 スペースと感嘆符以外のどんな文字でも使用できる。 CAD は、小文字を大文字に変更する。
- Value … 文字列; 入力のみ 非 null 文字列は、既定の属性値
- 戻り値
- 新しく作成される属性のVLAオブジェクト
- サンプル
(defun c:ax-addatt ()
(vl-load-com)
(setq *actdoc* (vla-get-activedocument (vlax-get-acad-object)))
(setq mspace (vla-get-modelspace *actdoc*))
(setq pt1 (vlax-3d-point (setq pt (getpoint "\n挿入点: "))))
(setq height (getdist "\n文字高さ: " pt))
(setq mode (getvar "AFLAGS")
pr (getstring "\nプロンプト: ")
tag (getstring "\n名称: ")
val (getstring "\n規定値: ")
)
(setq ret (vla-addattribute mspace height mode pr pt1 tag val))
)
;ダンプ
(vlax-dump-object ret)
; IAcadAttribute2: AutoCAD Attribute インタフェース
; プロパティの値:
; Alignment = 0
; Application (RO) = #<VLA-OBJECT IAcadApplication 0000000140d391d8>
; Backward = 0
; Constant = 0
; Document (RO) = #<VLA-OBJECT IAcadDocument 000000002c679530>
; EntityTransparency = "ByLayer"
; FieldLength = 0
; Handle (RO) = "5B8"
; HasExtensionDictionary (RO) = 0
; Height = 6787.32
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000030ee1328>
; InsertionPoint = (52954.6 23859.9 0.0)
; Invisible = 0
; Layer = "0"
; Linetype = "BYLAYER"
; LinetypeScale = 1.0
; Lineweight = -1
; LockPosition = -1
; Material = "ByLayer"
; Mode = 16
; MTextAttribute = 0
; MTextAttributeContent = ""
; MTextBoundaryWidth = 0.0
; MTextDrawingDirection = 5
; Normal = (0.0 0.0 1.0)
; ObjectID (RO) = 42
; ObjectID32 (RO) = 42
; ObjectName (RO) = "AcDbAttributeDefinition"
; ObliqueAngle = 0.0
; OwnerID (RO) = 43
; OwnerID32 (RO) = 43
; PlotStyleName = "ByLayer"
; Preset = 0
; PromptString = "プロンプト"
; Rotation = 0.0
; ScaleFactor = 1.0
; StyleName = "STANDARD"
; TagString = "名称"
; TextAlignmentPoint = (0.0 0.0 0.0)
; TextGenerationFlag = 0
; TextString = "属性値"
; Thickness = 0.0
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000000030ee3a80>
; UpsideDown = 0
; Verify = 0
; Visible = -1
関連事項