Vla-get-principaldirections
- 構文
- (vla-get-principaldirections vla-object )
- 機能
- ソリッドまたはリージョンの主方向を取得する。
- 引数
-
- vla-object … VLAオブジェクト(3DSolid、Region)
- 戻り値
- 現在の座標系に基づいて計算された X、Y、Z 座標
- MEMO:主方向はバリアント型で定義された X、Y、Z 座標で返される。これらは現在の座標系に基づいて計算される。
- サンプル
(vl-load-com)
(defun c:Example_PrincipalDirections()
;; ボックスを作成して主方向を取得するサンプル
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; ボックスの定義
(setq center (vlax-3d-point 5 5 0)
boxLength 5
boxWidth 7
boxHeight 10)
;; ボックスを作成
(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 PrincipalDirections (vlax-variant-value (vla-get-PrincipalDirections boxObj)))
(alert (strcat "ボックスの主方向は "
(rtos (vlax-safearray-get-element PrincipalDirections 0) 2) ", "
(rtos (vlax-safearray-get-element PrincipalDirections 1) 2) ", "
(rtos (vlax-safearray-get-element PrincipalDirections 2) 2)))
)
関連事項