Limits Property (ActiveX)

Specifies the drawing limits.

Supported platforms: Windows only

Signature

VBA:

object.Limits
object

Type: Database, Document

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (array of doubles)

An array of four values. The first pair of values define the X and Y coordinates of the lower-left limit, the second pair of values define the X and Y coordinates of the upper-right limit.

Remarks

The drawing limits are two-dimensional points in the World Coordinate System (WCS) that represent a lower-left and an upper-right limit. You cannot impose limits on the Z direction.

The drawing limits also govern the portion of the drawing covered by the visible grid and determine the minimum area that the ZoomAll method displays.

Note: The lower-left limit controls the LIMMIN system variable. The upper-right limit controls the LIMMAX system variable. The LIMCHECK system variable turns limits checking on and off for the current space.

Examples

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)))
)