ActivePViewport 示例

使用 VBA 以外的其它编程语言

Sub Example_ActivePViewport()
   
    Dim newPViewport As AcadPViewport
    Dim centerPoint(0 To 2) As Double
    Dim height As Double
    Dim width As Double
    height = 5#
    width = 5#
    centerPoint(0) = 5#: centerPoint(1) = 5#: centerPoint(2) = 0#
    
    ' 创建一个图纸空间 Viewport 对象
    ThisDrawing.ActiveSpace = acPaperSpace
    Set newPViewport = ThisDrawing.PaperSpace.AddPViewport(centerPoint, width, height)
    ZoomAll
    newPViewport.DISPLAY (True)
    
    ' 在将图纸空间 Viewport 设为活动前,mspace 属性必须为 True
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = newPViewport
End Sub