在当前视口中输入点并选择对象。若要使视口成为当前视口,请使用该属性。ActiveViewport 您可以循环访问现有视口以查找特定视口。为此,请首先使用该属性确定所需视口所在的视口配置的名称。此外,如果视口配置已拆分,则可以通过 和 属性来标识配置上的每个单独视口。NameLowerLeftCornerUpperRightCorner and 属性表示视口在显示器上的图形位置。这些属性定义如下(以四向拆分为例):LowerLeftCornerUpperRightCorner 在此示例中:
拆分视口,然后遍历窗口此示例将视口拆分为四个窗口。然后,它会循环访问图形中的所有视口,并显示视口名称以及每个视口的左下角和右上角。 Sub Ch3_IteratingViewportWindows() ' Create a new viewport and make it active Dim vportObj As AcadViewport Set vportObj = ThisDrawing.Viewports.Add("TEST_VIEWPORT") ThisDrawing.ActiveViewport = vportObj ' Split vport into 4 windows vportObj.Split acViewport4 ' Iterate through the viewports, ' highlighting each viewport and displaying ' the upper right and lower left corners ' for each. Dim vport As AcadViewport Dim LLCorner As Variant Dim URCorner As Variant For Each vport In ThisDrawing.Viewports ThisDrawing.ActiveViewport = vport LLCorner = vport.LowerLeftCorner URCorner = vport.UpperRightCorner MsgBox "Viewport: " & vport.Name & " is now active." & _ vbCrLf & "Lower left corner: " & _ LLCorner(0) & ", " & LLCorner(1) & vbCrLf & _ "Upper right corner: " & _ URCorner(0) & ", " & URCorner(1) Next vport End Sub |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:07
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.