Vla-get-directionvector

提供:GizmoLabs - だいたい CAD LISP なサイト
構文
(vla-get-directionvector vla-object )


機能
放射線、幾何公差、構築線のベクトル方向を取得する。


引数
  • vla-object … VLAオブジェクト(Ray、Tolerance、XLine)


戻り値
放射線、幾何公差、構築線の方向。


サンプル
(vl-load-com)
(defun c:Example_DirectionVector()
    ;; 放射線を割くエイして方向を変更するサンプル
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq basePoint (vlax-3d-point 3 3 0)
          SecondPoint (vlax-3d-point 1 3 0))
    
    ;; 放射線を作成
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))
    (vla-ZoomAll acadObj)
  
    (setq vDirection (vlax-safearray->list (vlax-variant-value (vla-get-DirectionVector rayObj))))
    (alert (strcat "放射線の方向は "
	           "\n" (rtos (nth 0 vDirection) 2) "," (rtos (nth 1 vDirection) 2) "," (rtos (nth 2 vDirection) 2)))
    
    ;; 変更
    (setq newDirectionVec (vlax-3d-point 3 1 0))
    (vla-put-DirectionVector rayObj newDirectionVec)
            
    ;; 方向を取得
    (setq retDir (vlax-safearray->list (vlax-variant-value (vla-get-DirectionVector rayObj))))
    
    (vla-Regen doc :vlax-true)
    (alert (strcat "新しい放射線の方向は "
	           "\n" (rtos (nth 0 retDir) 2) "," (rtos (nth 1 retDir) 2) "," (rtos (nth 2 retDir) 2)))
)

関連事項