Vla-get-handle
- 構文
- (vla-get-handle vla-object)
- 機能
- オブジェクトのハンドルを取得する
- 注意
- オブジェクト ID と固有のハンドルは、オブジェクトを参照する手段で、ハンドルは、オブジェクトが図面中に存在する間は、不変(同一状態を保つ)である。 一般に、オブジェクト ID を必要とする ObjectARX 関数を使用した作業でない場合はハンドルを使用する。
- 引数
-
- vla-object … VLAオブジェクト(すべての図形オブジェクト、AttributeReference、Block、Blocks、Dictionaries、Dictionary、DimStyle、DimStyles、Group、Groups、Layer、Layers、Layout、Layouts、Linetype、Linetypes、ModelSpace、PaperSpace、PlotConfiguration、PlotConfigurations、RegisteredApplication、RegisteredApplications、SectionManager、SectionSettings、SortentsTable、TableStyle、TextStyle、TextStyles、UCS、UCSs、View、Views、Viewport、Viewports、XRecord)
- 戻り値
- ハンドル
- サンプル
(vl-load-com)
(defun c:Example_HandleToObject()
;; スプラインをモデル空間に作成してハンドルを取得、
;; その後、ハンドルから返さ着色されている。するサンプル
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
;; スプラインを生成
(setq startTan (vlax-3d-point 0.5 0.5 0)
endTan (vlax-3d-point 0.5 0.5 0)
fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
(vlax-safearray-fill fitPoints '(1 1 0
5 5 0
10 0 0
)
)
(setq modelSpace (vla-get-ModelSpace doc))
(setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
(vla-ZoomAll (vlax-get-acad-object))
;; スプラインのハンドルを取得
(setq handle (vla-get-Handle splineObj))
(alert (strcat "スプラインのハンドルは: " handle))
;; ハンドルからオブジェクトを見つける
(setq tempObj (vla-HandleToObject doc handle))
;; オブジェクトを着色するために、新しい初期化されたオブジェクト変数を使用する
(setq color (vlax-create-object "AutoCAD.AcCmColor.21"))
(vla-SetRGB color 80 100 244)
(vla-put-TrueColor tempObj color)
(vla-Regen doc :vlax-true)
(alert "スプラインを青にしたった.")
(vlax-release-object color)
)
関連事項