Vla-put-gradientcolor2

提供: GizmoLabs - だいたい CAD LISP なサイト
移動先: 案内検索
構文
(vla-put-gradientcolor2 vla-object color)


機能
ハッチングのグラデーション終了色を指定する。


引数
  • vla-object … Hatch の VLA オブジェクト
  • color … AcCmColor の VLA オブジェクト。


戻り値
nil


サンプル
(vl-load-com)
(defun c:Example_GradientColor1()
    ;; グラデーションの色を変更するサンプル
    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
    
    ;; 初期化
    (setq patternName "CYLINDER")
    (setq patternType acPreDefinedGradient)
    (setq bAssociativity :vlax-true)
    
    ;; モデル空間にハッチ生成
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acGradientObject))

    (setq col1 (vlax-create-object "AutoCAD.AcCmColor.21"))
    (setq col2 (vlax-create-object "AutoCAD.AcCmColor.21"))
    (setq newColor (vlax-create-object "AutoCAD.AcCmColor.21"))

    (vla-SetRGB col1 255 0 0)
    (vla-SetRGB col2 0 255 0)
    (vla-SetRGB newColor 0 100 0)

    (vla-put-GradientColor1 hatchObj col1)
    (vla-put-GradientColor2 hatchObj col2)
    
    ;; ハッチの境界生成
    (setq center (vlax-3d-point 3 3 0)
          radius 1)
    (setq circle (vla-AddCircle modelSpace center radius))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element outerLoop 0 circle)
    
    ;; ハッチの表示
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "現在の GradientColor1 の値は :"
                   "\nred = " (itoa (vla-get-Red (vla-get-GradientColor1 hatchObj)))
                   "\ngreen = " (itoa (vla-get-Green (vla-get-GradientColor1 hatchObj)))
                   "\nblue = " (itoa (vla-get-Blue (vla-get-GradientColor1 hatchObj)))))

    (vla-put-GradientColor1 hatchObj newColor)
    (alert (strcat "新しい GradientColor1 の値は :"
                   "\nred = " (itoa (vla-get-Red (vla-get-GradientColor1 hatchObj)))
                   "\ngreen = " (itoa (vla-get-Green (vla-get-GradientColor1 hatchObj)))
                   "\nblue = " (itoa (vla-get-Blue (vla-get-GradientColor1 hatchObj)))))

    (vlax-release-object col1)
    (vlax-release-object col2)
    (vlax-release-object newColor)
)

関連事項