Limits プロパティ(ActiveX)

図面範囲を指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.Limits
object

タイプ: DatabaseDocument

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: バリアント型(倍精度実数の配列)

4 つの値の配列。前半の 2 つの要素は左下の点の X、Y 座標を定義し、後半の 2 つの要素は右上の点の X、Y 座標を定義します。

注意

図面範囲は、ワールド座標系(WCS)内の 2 次元の点であり、左下と右上で表現します。Z 方向には範囲指定できません。

図面範囲は、可視のグリッドが描かれる図面の部分も管理し、ZoomAll メソッドが表示する最小領域も決定します。

注: 左下の範囲はシステム変数 LIMMIN をコントロールします。右上の範囲は、システム変数 LIMMAX をコントロールします。システム変数 LIMCHECK は、現在の空間の図面範囲チェックをオンまたはオフにします。

VBA:

Sub Example_Limits()
    ' This example finds the current limits for the drawing.
    ' It then changes the limits for the drawing. The grid
    ' is turned on to show the limits.
    
    ' Turn on the grid for the active viewport
    ThisDrawing.ActiveViewport.GridOn = True
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    
    ' Find the current limits
    Dim currLimits As Variant
    currLimits = ThisDrawing.Limits
    MsgBox "The current drawing limits are " & vbCrLf _
           & "Lower-left corner " & ThisDrawing.Limits(0) & ", " & ThisDrawing.Limits(1) & vbCrLf _
           & "Upper-right corner " & ThisDrawing.Limits(2) & ", " & ThisDrawing.Limits(3), , "Limits Example"
           
    ' Change the limits
    Dim newLimits(0 To 3) As Double
    newLimits(0) = 2#: newLimits(1) = 2#: newLimits(2) = 4#: newLimits(3) = 4#
    ThisDrawing.Limits = newLimits
    ThisDrawing.Regen acActiveViewport
    MsgBox "The new drawing limits are " & vbCrLf _
           & "Lower-left corner " & ThisDrawing.Limits(0) & ", " & ThisDrawing.Limits(1) & vbCrLf _
           & "Upper-right corner " & ThisDrawing.Limits(2) & ", " & ThisDrawing.Limits(3), , "Limits Example"
    
    ' Reset the drawing limits
    ThisDrawing.Limits = currLimits
    ThisDrawing.Regen acActiveViewport
    MsgBox "The drawing limits have been reset to " & vbCrLf _
           & "Lower-left corner " & ThisDrawing.Limits(0) & ", " & ThisDrawing.Limits(1) & vbCrLf _
           & "Upper-right corner " & ThisDrawing.Limits(2) & ", " & ThisDrawing.Limits(3), , "Limits Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Limits()
    ;; This example finds the current limits for the drawing.
    ;; It then changes the limits for the drawing. The grid
    ;; is turned on to show the limits.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Turn on the grid for the active viewport
    (vla-put-GridOn (vla-get-ActiveViewport doc) :vlax-true)
    (vla-put-ActiveViewport doc (vla-get-ActiveViewport doc))
    
    ;; Find the current limits
    (setq currLimits (vlax-variant-value (vla-get-Limits doc)))
    (setq tempLimits (vlax-safearray->list currLimits))
    (alert (strcat "The current drawing limits are"
                   "\nLower-left corner " (rtos (nth 0 tempLimits) 2) ", " (rtos (nth 1 tempLimits) 2)
                   "\nUpper-right corner " (rtos (nth 2 tempLimits) 2) ", " (rtos (nth 3 tempLimits) 2)))

    ;; Change the limits
    (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 "The new drawing limits are"
                   "\nLower-left corner " (rtos (nth 0 tempLimits) 2) ", " (rtos (nth 1 tempLimits) 2)
                   "\nUpper-right corner " (rtos (nth 2 tempLimits) 2) ", " (rtos (nth 3 tempLimits) 2)))
  
    ;; Reset the drawing limits
    (vla-put-Limits doc currLimits)
    (vla-Regen doc acActiveViewport)
    (setq tempLimits (vlax-safearray->list currLimits))  
    (alert (strcat "The drawing limits have been reset to"
                   "\nLower-left corner " (rtos (nth 0 tempLimits) 2) ", " (rtos (nth 1 tempLimits) 2)
                   "\nUpper-right corner " (rtos (nth 2 tempLimits) 2) ", " (rtos (nth 3 tempLimits) 2)))
)