UCSPerViewport Example

Using Programming Languages other than VBA

Sub Example_UCSPerViewport()
	' This example creates a new paperspace viewport.
	' It then finds the UCSPerViewport setting
	' for that viewport.

	Dim pviewportObj As AcadPViewport
	Dim center(0 To 2) As Double
	Dim width As Double
	Dim height As Double

	' Define the pviewport
	center(0) = 3: center(1) = 3: center(2) = 0
	width = 40
	height = 40

	' Change from model space to paperspace
	ThisDrawing.ActiveSpace = acPaperSpace

	' Create the pviewport
	Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
	ThisDrawing.Regen acAllViewports

	' Find the current setting of the UCSPerViewport property
	MsgBox "UCSPerViewport: " & pviewportObj.UCSPerViewport
End Sub

 

   Comments?