Vla-put-elevation
- 構文
- (vla-put-elevation vla-object elevation )
- 機能
- ハッチング、ポリライン、断面の現在の高度を指定する。
- 引数
-
- vla-object … VLAオブジェクト(Hatch、LWPolyline、Polyline、Section)
- elevation … オブジェクトの現在の高度。
- 戻り値
- nil
- サンプル
(vl-load-com) (defun c:Example_Elevation() ;; 異尺度ハッチを作成して高度を変更するサンプル (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq modelSpace (vla-get-ModelSpace doc)) ;; ハッチの定義 (setq patternName "ANSI31" patternType acHatchPatternTypePreDefined bAssociativity :vlax-true) ;; 異尺度ハッチを作成 (setq modelSpace (vla-get-ModelSpace doc)) (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject)) ;; ハッチ境界を作成 ;; An arc and a line are used to create a closed loop. (setq center (vlax-3d-point 5 3 0) radius 3 startAngle 0 endAngle 3.141592) ;; 円弧と線を作成 (setq arcObj (vla-AddArc modelSpace center radius startAngle endAngle)) (setq lineObj (vla-AddLine modelSpace (vla-get-StartPoint arcObj) (vla-get-EndPoint arcObj))) (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1))) (vlax-safearray-put-element outerLoop 0 arcObj) (vlax-safearray-put-element outerLoop 1 lineObj) ;; 境界を適用 (vla-AppendOuterLoop hatchObj outerLoop) ;; その側の円を境界に指定 (setq center (vlax-3d-point 5 4.5 0) radius 1) (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0))) (vlax-safearray-put-element innerLoop1 0 (vla-AddCircle modelSpace center radius)) (vla-AppendInnerLoop hatchObj innerLoop1) ;; 内側の円を境界に指定 (setq radius 0.5) (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0))) (vlax-safearray-put-element innerLoop2 0 (vla-AddCircle modelSpace center radius)) (vla-AppendInnerLoop hatchObj innerLoop2) ;; 高度を変更 (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 currElevation (vla-get-Elevation hatchObj)) (alert (strcat "現在の高度は " (rtos currElevation 2))) ;; 高度を3に変更 (vla-put-Elevation hatchObj 3) (vla-Evaluate hatchObj) (vla-ZoomAll acadObj) (alert (strcat "新しい高度は " (rtos (vla-get-Elevation hatchObj) 2))) )
関連事項