本文中的视图操作指,图档视角的操作。
实现操作视图的流程为:
1、获得当前视图
ViewTableRecord vtr = ed.GetCurrentView();
2、设置观察点
vtr.SetViewDirection(ov);
3、设置视图
ed.SetCurrentView(vtr);
方法如下:
public bool ViewChanged(OrthographicView ov)
{
bool resultView = false;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
ViewTableRecord vtr = ed.GetCurrentView();
try
{
vtr.SetViewDirection(ov);
ed.SetCurrentView(vtr);
resultView = true;
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("zoom e ", false, false, false);
}
catch
{
resultView = false;
}
finally
{
vtr.Dispose();
}
return resultView;
}
上述方法的参数为:
public enum OrthographicView
{
NonOrthoView = 0,
TopView = 1,
BottomView = 2,
FrontView = 3,
BackView = 4,
LeftView = 5,
RightView = 6,
}
传入适当参数即可