Vla-put-textstring
- 構文
- (vla-put-textstring vla-object string )
- 機能
- 図形のテキスト文字列を指定する。
- 引数
-
- vla-object … VLAオブジェクト(Attribute、AttributeReference、GeoPositionMarker、MLeader、MLeaderStyle、MText、Text、Tolerance)
- string … 文字列。長さは、最大で 256 文字。
- 戻り値
- nil
- MEMO : AttributeReference: AutoCAD での属性の値と同じ。
- GeoPositionMarker、MText : テキスト文字列には、書式コードが含まれる。下線を引いたり、文字の上に線を引いたり、重ね文字を作成したりすることができる。色、フォント、文字の高さも変更できる。文字間を変更したり、文字幅を広げることができる。書式を適用したり、既存の文字列の書式を解析する。
- サンプル
(vl-load-com)
(defun c:Example_TextString()
;; 文字列を作成して、返すサンプル
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; 文字列の定義
(setq insertionPoint (vlax-3d-point 2 2 0)
textString "Hello, World."
height 0.5)
;; 文字を作成
(setq modelSpace (vla-get-ModelSpace doc))
(setq textObj (vla-AddText modelSpace textString insertionPoint height))
(vla-ZoomAll acadObj)
;; 文字列を取得
(setq text (vla-get-TextString textObj))
(alert (strcat "作成した文字列は : " text))
)
関連事項