浮动视口 (.NET)
您无法从图纸空间编辑模型。若要访问 Viewport 对象中的模型,请使用 Editor 对象的 和 member 方法从 Paper 空间切换到 Model 空间。因此,您可以在使用模型的同时保持整体布局可见。在视口对象中,编辑和视图更改功能与对象中几乎相同。SwitchToModelSpaceSwitchToPaperSpaceViewportTableRecord 但是,您可以更好地控制各个视图。例如,您可以冻结或解冻某些视口中的图层,而不会影响其他视口。您可以打开或关闭视口中几何图形的显示。您还可以在视口之间对齐视图,并相对于整体布局缩放视图。 下图显示了如何在图纸空间中显示模型的不同视图。每个 Paper 空间图像都表示一个具有不同视图的 Viewport 对象。在一个视图中,维度的图层被冻结。请注意,在“图纸”空间中绘制的标题栏、边框和注释不会显示在“模型”空间视图中。此外,包含视口边框的图层已被冻结。 ![]() 在 Viewport 对象中工作时,可以在 Model 或 Paper 空间中。您可以通过检查 TILEMODE 和 CVPORT 系统变量的当前值来确定您是否在模型空间中工作。下表根据 TILEMODE 和 CVPORT 的当前值细分了您正在使用的空间和布局。为 0,CVPORT 不是 2,则您在图纸空间中工作,如果 TILEMODE 为 0,CVPORT 为 2,则您在模型空间中工作。如果 TILEMODE 为 1,则表示您正在模型布局的模型空间中工作。
注意:在布局上切换到“模型空间打开”之前,布局上至少一个 Viewport 对象的属性应设置为 。OnTRUE
当您位于图纸空间中时,AutoCAD 会在图形区域的左下角显示图纸空间用户坐标系 (UCS) 图标。十字准线表示可以编辑图纸空间布局区域(而不是视口中的视图)。 在模型和图纸空间之间切换此示例说明如何在模型和图纸空间之间切换。 VB.NETImports 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 代码参考Public Sub ToggleSpace()
' Check to see if the Model layout is active
If ThisDrawing.ActiveLayout.Name <> "Model" Then
' Check to see if Model space is active
If ThisDrawing.MSpace = True Then
ThisDrawing.MSpace = False
Else
ThisDrawing.MSpace = True
End If
Else
' Switch to the previous Paper space layout
ThisDrawing.ActiveSpace = acPaperSpace
End If
End Sub
相关概念父主题: | |||||||||||||||
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-11-1 10:08
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.