Vla-reverse
- 構文
- (vla-reverse vla-object)
- 機能
- スプラインの方向を逆にする。
- 引数
-
- vla-object … Spline の VLAオブジェクト
- 戻り値
- nil
- サンプル
(vl-load-com)
(defun c:Example_Reverse()
;; スプライン作って反転するサンプル
(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 msg ""
count 0)
(while (>= 2 count)
(setq msg (strcat msg (rtos (vlax-safearray-get-element (vlax-variant-value (vla-GetControlPoint splineObj 0)) count) 2) ", ")
count (1+ count)
)
)
(setq msg (vl-string-right-trim ", " msg))
(alert (strcat "逆の前に最初のコントロール ポイントは、 " msg))
;; スプラインとコントロール ポイントを反転
(vla-Reverse splineObj)
(vla-Regen doc :vlax-true)
;; もう一度最初の制御点から座標を取得。
(setq msg ""
count 0)
(while (>= 2 count)
(setq msg (strcat msg (rtos (vlax-safearray-get-element (vlax-variant-value (vla-GetControlPoint splineObj 0)) count) 2) ", ")
count (1+ count)
)
)
(setq msg (vl-string-right-trim ", " msg))
(alert (strcat "反転後の最初のコントロール点は " msg))
)
関連事項