CustomScale Property (ActiveX)

Specifies the custom scale factor for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.CustomScale
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Double

The custom scale factor for the viewport.

Remarks

To set the viewport to a custom scale, first set the StandardScale property to acVpCustomScale, then use this property to define the custom scale value.

Examples

VBA:

Sub Example_CustomScale()
    ' This example adds a line in paper space, creates a new paper space viewport, and cycles through some common paper space custom scale sizes
    ' for the new paper space viewport
   
    Dim lineObj As AcadLine
    Dim PViewPort As AcadPViewport
    Dim startPoint(0 To 2) As Double, endPoint(0 To 2)  As Double
    Dim center(0 To 2) As Double
    Dim width As Double, height As Double
    
    ' Define the start and end points for the line
    startPoint(0) = 1: startPoint(1) = 1: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 5: endPoint(2) = 0
    
    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40: height = 40
    
    ' Create the line in paper space
    Set lineObj = ThisDrawing.PaperSpace.AddLine(startPoint, endPoint)
       
    ' Create the paper space viewport
    Set PViewPort = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
   
    ' Set the paper space viewport scale to custom 
    PViewPort.StandardScale = acVpCustomScale
    
    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace
    
    ' Read and display the existing paper space viewport scale setting
    MsgBox "The scale of the new PViewport is: " & PViewPort.CustomScale
    
    ' Change the custom scale setting to 1:10 scale
    PViewPort.CustomScale = 0.1
   
    ' Read and display the new paper space viewport scale setting
    MsgBox "The scale of the new PViewport has been changed to: " & PViewPort.CustomScale

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CustomScale()
    ;; This example adds a line in paper space, creates a new paper space viewport, and cycles through some common paper space custom scale sizes
    ;; for the new paper space viewport
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Define the start and end points for the line
    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0)) 
    
    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
          height 40)
    
    ;; Create the line in paper space
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq lineObj (vla-AddLine paperSpace startPoint endPoint))
       
    ;; Create the paper space viewport
    (setq PViewPort (vla-AddPViewport paperSpace center width height))
   
    ;; Set the paper space viewport scale to custom 
    (vla-put-StandardScale PViewPort acVpCustomScale)
    
    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)
    (vla-Regen doc acAllViewports)
    (vla-ZoomAll acadObj)
    
    ;; Read and display the existing paper space viewport scale setting
    (alert (strcat "The scale of the new PViewport is: " (rtos (vla-get-CustomScale PViewPort) 2)))
    
    ;; Change the custom scale setting to 1:10 scale
    (vla-put-CustomScale PViewPort 0.1)
   
    ;; Read and display the new paper space viewport scale setting
    (alert (strcat "The scale of the new PViewport has been changed to: " (rtos (vla-get-CustomScale PViewPort) 2)))
)