浮动视口
 
 

You cannot edit the model from Paper space. To access the model in a Viewport object, toggle from Paper space to Model space using the SwitchToModelSpace and SwitchToPaperSpace member methods of the Editor object. As a result, you can work with the model while keeping the overall layout visible. In Viewport objects, the editing and view-changing capabilities are almost the same as in ViewportTableRecord objects.

用户不能在图纸空间中编辑模型。要访问 Viewport 对象中的模型,请使用 Editor 对象的 SwitchToModelSpaceSwitchToPaperSpace 成员方法在图纸空间切换与模型空间之间切换。这样既可以操作模型又可以保持显示整个布局。 Viewport 对象的编辑和视图更改功能与 ViewportTableRecord 对象基本相同。

However, you have more control over the individual views. For example, you can freeze or thaw layers in some viewports without affecting others. You can toggle the display of the geometry in a viewport on or off. You can also align views between viewports and scale the views relative to the overall layout.

可是,可以更好地控制单个视图。例如,可以冻结或解冻某些视口中的图层,而不会影响其他视口;可以打开或关闭整个视口显示;还可以对齐视口之间的视图,以及相对于整个布局来缩放视图。

The following illustration shows how different views of a model can be displayed in Paper space. Each Paper space image represents a Viewport object with a different view. In one view, the layer for dimensions is frozen. Notice that the title block, border, and annotation, which are drawn in Paper space, do not appear in the Model space view. Also, the layer containing the viewport borders has been frozen.

下图显示了模型的不同视图如何在图纸空间中显示。每个图纸空间图像代表一个不同视图的 Viewport 对象。在一个视图中,标注图层是冻结的。注意,在图纸空间中绘制的标题栏、边框和注释不会出现在“模型空间”视图中。此外,包含视口边框的图层已被关闭。  

When you are working in a Viewport object, you can be in either Model or Paper space. You can determine if you are working in Model space by checking the current values of the TILEMODE and CVPORT system variables. The following table breaks down the space and layout you are working in based on the current values of TILEMODE and CVPORT. is 0 and CVPORT is a value other than 2, you are working in Paper space, and if TILEMODE is 0 and CVPORT is 2 then you are working in Model space. If TILEMODE is 1, you are working in Model space on the Model layout.

在 Viewport 对象中操作时,可以是在模型空间或图纸空间中的任意一个。通过检查 TILEMODE 和 CVPORT 系统变量的当前值可以确定是否在模型空间中操作。下面的表格基于 TILEMODE 和 CVPORT 的当前值分解用户工作的空间和布局。TILEMODE 是 0 并且 CVPORT 是除了 2 以外的值,用户在图纸空间中操作。如果 TILEMODE 是 0 而 CVPORT 是 2,那么你将在模型空间中操作。如果 TILEMODE 是 1,那么你是在模型布局的模型空间中操作。

Current space

当前空间 

TILEMODE

CVPORT

Status

状态

0

Not equal to 2

不等于2

Layout other than Model is active and you are working in Paper space.

布局除了模型是活动的并且用户是在图纸空间中操作。

0

2

Layout other than Model is active and you are working in a floating viewport.

布局除了模型是活动的并且用户是在模型空间中操作。

1

Any value

任意值

Model layout is active.

模型布局是活动的 

NoteBefore switching to Model space on when on a layout, the On property for at least one Viewport object on the layout should be set to TRUE.

注意当从一个布局切换到模型空间之前, 在布局中至少应该有一个 Viewport 对象的 On 属性要设置成为 TRUE。

When you are in paper space, AutoCAD displays the paper space user coordinate system (UCS) icon in the lower-left corner of the graphics area. The crosshairs indicate that the paper space layout area (not the views in the viewports) can be edited.

当用户在图纸空间时,AutoCAD 显示图纸空间用户坐标系图标在图形区域的左下角。十字光标指出图纸空间布局区域(不是视口中的视图)可以被编辑。

在模型空间和图纸空间之间切换

This example shows how to toggle between Model and Paper space.

本例显示如何在模型空间与图纸空间之间切换。

VB.NET

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
 
<CommandMethod("ToggleSpace")> _
Public Sub ToggleSpace()
  '' 获得当前文档   Get the current document
  Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
 
  '' Get the current values of CVPORT and TILEMODE
  Dim nCvports As Integer = Application.GetSystemVariable("CVPORT")
  Dim nTilemode As Integer = Application.GetSystemVariable("TILEMODE")
 
  '' Check to see if the Model layout is active, TILEMODE is 1 when
  '' the Model layout is active
  If nTilemode = 0 Then
      '' Check to see if Model space is active in a viewport,
      '' CVPORT is 2 if Model space is active 
      If nCvports = 2 Then
          acDoc.Editor.SwitchToPaperSpace()
      Else
          acDoc.Editor.SwitchToModelSpace()
      End If
  Else
      '' Switch to the previous Paper space layout
      Application.SetSystemVariable("TILEMODE", 0)
  End If
End Sub

C#

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
 
[CommandMethod("ToggleSpace")]
public static void ToggleSpace()
{
  // 获得当前文档   Get the current document
  Document acDoc = Application.DocumentManager.MdiActiveDocument;
 
  // Get the current values of CVPORT and TILEMODE
  object oCvports = Application.GetSystemVariable("CVPORT");
  object oTilemode = Application.GetSystemVariable("TILEMODE");
 
  // Check to see if the Model layout is active, TILEMODE is 1 when
  // the Model layout is active
  if (System.Convert.ToInt16(oTilemode) == 0)
  {
      // Check to see if Model space is active in a viewport,
      // CVPORT is 2 if Model space is active 
      if (System.Convert.ToInt16(oCvports) == 2)
      {
          acDoc.Editor.SwitchToPaperSpace();
      }
      else
      {
          acDoc.Editor.SwitchToModelSpace();
      }
  }
  else
  {
      // Switch to the previous Paper space layout
      Application.SetSystemVariable("TILEMODE", 0);
  }
}
VBA/ActiveX 代码参考