Vla-get-momentofinertia
- 構文
- (vla-get-momentofinertia vla-object )
- 機能
- ソリッドの慣性モーメントを取得する。
- 引数
- 
- vla-object … VLAオブジェクト(3DSolid、Region)
 
- 戻り値
- 現在の座標系に基づいた 3D 座標
- MEMO:慣性モーメントは、バリアント型で定義された X、Y、Z 座標で返される。
- サンプル
(vl-load-com)
(defun c:Example_MomentOfInertia()
    ;; ボックスを作成してソリッドの慣性モーメントを取得するサンプル
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; box の定義
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
	  boxWidth 7
	  boxHeight 10)
    
    ;; box (3DSolid) を作成する
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))
    
    ;; 変更する
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
    
    ;; 戻す
    (setq momentOfInertia (vlax-variant-value (vla-get-MomentOfInertia boxObj)))
    (alert (strcat "ボックスの慣性モーメントは " 
                   (rtos (vlax-safearray-get-element momentOfInertia 0) 2) ", "
                   (rtos (vlax-safearray-get-element momentOfInertia 1) 2) ", "
                   (rtos (vlax-safearray-get-element momentOfInertia 2) 2)))
)
関連事項
