CustomScale Example

Using Programming Languages other than 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

 

   Comments?