Vla-get-colormethod
- 構文
- (vla-get-colormethod vla-object)
- 機能
- vlaオブジェクトのカラーメソッドを取得する。
- 引数
-
- vla-object … VLAオブジェクト
- 戻り値
- acColorMethod の種類。次のいずれかの定数。
- acColorMethodByACI
- acColorMethodByBlock
- acColorMethodByLayer (既定)
- acColorMethodByRGB
- acColorMethodForeground
- サンプル
(defun c:layer2trucolor(/ lay tc idx) ; レイヤーのACIカラーをRGBカラーに変換 (vl-load-com) (setq *acaddoc* (vla-get-ActiveDocument (vlax-get-Acad-Object))) (vlax-for lay (vla-get-layers *acaddoc*) (setq tc (vla-get-truecolor lay)) (if (= (vla-get-colormethod tc) acColorMethodByACI) (progn (setq idx (vla-get-colorindex tc)) (vla-put-colormethod tc acColorMethodByRGB) (vla-put-colorindex tc idx) (setq r (vla-get-red tc) g (vla-get-green tc) b (vla-get-blue tc)) (vla-setrgb tc r g b) (vla-put-truecolor lay tc) )))) (vl-load-com) (defun c:Example_ColorMethod() ; この例では、ColorMethodプロパティを変更する方法を示す。 (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq modelSpace (vla-get-ModelSpace doc)) (setq col (vlax-create-object (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2)))) (vla-put-ColorMethod col acColorMethodForeground) ;; サークルナンバー1 (setq pt (vlax-3d-point 0 0 0)) (setq cir1 (vla-AddCircle modelSpace pt 2)) (vla-put-TrueColor cir1 col) (vla-ZoomAll acadObj) (vla-Regen doc :vlax-true) (setq retCol (vla-get-TrueColor cir1)) ;; メソッドとインデックスを備えたメッセージボックス (setq MethodText (vla-get-ColorMethod col)) (alert (strcat "ColorMethod=" (itoa MethodText) "\nIndex=" (itoa (vla-get-ColorIndex col)))) ;; サークルナンバー2 (setq cir2 (vla-AddCircle modelSpace pt 6)) (vla-ZoomAll acadObj) (vla-Regen doc :vlax-true) (vla-put-ColorMethod col acColorMethodByBlock) ;; メソッドとインデックスを備えたメッセージボックス (setq MethodText (vla-get-ColorMethod col)) (alert (strcat "ColorMethod=" (itoa MethodText) "\nIndex=" (itoa (vla-get-ColorIndex col)))) ;; サークルナンバー3 (setq cir3 (vla-AddCircle modelSpace pt 10)) (vla-ZoomAll acadObj) (vla-Regen doc :vlax-true) (setq layColor (vlax-create-object (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2)))) (vla-SetRGB layColor 122 199 25) (vla-put-TrueColor (vla-get-ActiveLayer doc) layColor) (vla-put-ColorMethod col acColorMethodByLayer) (setq retCol (vla-get-TrueColor cir3)) (vla-Regen doc :vlax-true) ;; メソッドとインデックスを備えたメッセージボックス (setq MethodText (vla-get-ColorMethod col)) (alert (strcat "ColorMethod=" (itoa MethodText) "\nIndex=" (itoa (vla-get-ColorIndex col)))) (vlax-release-object col) )
関連事項