Vla-get-controlpoints
- 構文
- (vla-get-controlpoints vla-object)
- 機能
- スプラインの制御点を指定する。
- 引数
-
- vla-object … Spline の VLAオブジェクト
- 戻り値
- スプラインに対する 3D WCS 制御点の配列
- 注意
NumberOfControlPoints プロパティを使用すると、スプラインの制御点の数が分かる。
- サンプル
(vl-load-com) (defun c:Example_ControlPoints() ;; モデル空間におけるスプラインオブジェクトを作成し、 ;; スプラインの制御点を読み取り制御点を修正するサンプル。 (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; スプラインの設定 (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 '(0 0 0 5 5 0 10 0 0)) ;; スプラインを作成 (setq modelSpace (vla-get-ModelSpace doc)) (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan)) (vla-ZoomAll acadObj) ;; 制御点を表示 (setq ControlPoints (vlax-variant-value (vla-get-ControlPoints splineObj))) ;; 3つのグループ (setq UserMessage "" iPoint 0 iCount 0) (while (>= (vlax-safearray-get-u-bound ControlPoints 1) iCount) (setq iPoint (1+ iPoint)) (setq UserMessage (strcat UserMessage (itoa iPoint) ") " (rtos (nth iCount (vlax-safearray->list ControlPoints)) 2) ", " (rtos (nth (+ iCount 1) (vlax-safearray->list ControlPoints)) 2) ", " (rtos (nth (+ iCount 2) (vlax-safearray->list ControlPoints)) 2) "\n" ) ) (setq iCount (+ iCount 3)) ) (alert (strcat "The " (itoa (vla-get-NumberOfControlPoints splineObj)) " スプラインの制御点は : " "\n\n" UserMessage)) ;; 制御点を変更 (setq newFitPoint (vlax-3d-point 8 2 0)) (vla-AddFitPoint splineObj 3 newFitPoint) (setq ControlPoints (vlax-variant-value (vla-get-ControlPoints splineObj))) (vla-ZoomAll acadObj) ;; 新しい制御点を表示 (setq UserMessage "" iPoint 0 iCount 0) (while (>= (vlax-safearray-get-u-bound ControlPoints 1) iCount) (setq iPoint (1+ iPoint)) (setq UserMessage (strcat UserMessage (itoa iPoint) ") " (rtos (nth iCount (vlax-safearray->list ControlPoints)) 2) ", " (rtos (nth (+ iCount 1) (vlax-safearray->list ControlPoints)) 2) ", " (rtos (nth (+ iCount 2) (vlax-safearray->list ControlPoints)) 2) "\n" ) ) (setq iCount (+ iCount 3)) ) (alert (strcat "The " (itoa (vla-get-NumberOfControlPoints splineObj)) " スプラインの制御点は : " "\n\n" UserMessage)) )
関連事項