Vla-put-limits
- 構文
- (vla-put-limits vla-object limits)
- 機能
- 図面範囲を指定する。
- 引数
-
- vla-object … VLAオブジェクト(Database、Document)
- limits … バリアント型(倍精度実数の配列)
- 4 つの値の配列。前半の 2 つの要素は左下の点の X、Y 座標を定義し、後半の 2 つの要素は右上の点の X、Y 座標を定義する。
- 戻り値
- nil
- 注意 : 図面範囲は、ワールド座標系(WCS)内の 2 次元の点であり、左下と右上で表現する。Z 方向には範囲指定できない。図面範囲は、可視のグリッドが描かれる図面の部分も管理し、ZoomAll メソッドが表示する最小領域も決定する。
- MEMO: 左下の範囲はシステム変数 LIMMIN をコントロールする。右上の範囲は、システム変数 LIMMAX をコントロールする。システム変数 LIMCHECK は、現在の空間の図面範囲チェックをオンまたはオフにする。
- サンプル
(vl-load-com)
(defun c:Example_Limits()
;; 現在の図面の limits を取得して変更するサンプル
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; アクティブビューポートのグリッドを表示
(vla-put-GridOn (vla-get-ActiveViewport doc) :vlax-true)
(vla-put-ActiveViewport doc (vla-get-ActiveViewport doc))
;; 現在の limits を取得
(setq currLimits (vlax-variant-value (vla-get-Limits doc)))
(setq tempLimits (vlax-safearray->list currLimits))
(alert (strcat "この図面の図面範囲は"
"\n左下点 " (rtos (nth 0 tempLimits) 2) ", " (rtos (nth 1 tempLimits) 2)
"\n右上点 " (rtos (nth 2 tempLimits) 2) ", " (rtos (nth 3 tempLimits) 2)))
;; 図面範囲変更
(setq newLimits (vlax-make-safearray vlax-vbDouble '(0 . 3)))
(vlax-safearray-fill newLimits '(2 2 4 4))
(vla-put-Limits doc newLimits)
(vla-Regen doc acActiveViewport)
(setq tempLimits (vlax-safearray->list newLimits))
(alert (strcat "新しいの図面範囲は"
"\n左下点 " (rtos (nth 0 tempLimits) 2) ", " (rtos (nth 1 tempLimits) 2)
"\n右上点 " (rtos (nth 2 tempLimits) 2) ", " (rtos (nth 3 tempLimits) 2)))
;; 戻す
(vla-put-Limits doc currLimits)
(vla-Regen doc acActiveViewport)
(setq tempLimits (vlax-safearray->list currLimits))
(alert (strcat "図面範囲を次に戻します"
"\n左下点 " (rtos (nth 0 tempLimits) 2) ", " (rtos (nth 1 tempLimits) 2)
"\n右上点 " (rtos (nth 2 tempLimits) 2) ", " (rtos (nth 3 tempLimits) 2)))
)
関連事項