|
//下面的代码在图形空间创建了一个浮动视口,但要如何实现下面几项功能还要请高手指教。
//1. 如何将视口设置为等轴测视图,如西南视图
//2. 如何在视口内最大化显示指定的实体
//3. 如何在视口内冻结指定的图层
public void vp()
{
Database db = HostApplicationServices.WorkingDatabase;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
Viewport vp = new Viewport();
vp.CenterPoint = new Point3d(0,0,0);
vp.Width = 30;
vp.Height = 40;
BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.PaperSpace], OpenMode.ForWrite);
btr.AppendEntity(vp);
trans.AddNewlyCreatedDBObject(vp,true);
//激活视口
vp.On = true;
//设置视口的视图
vp.SetViewDirection(OrthographicView.LeftView);//OrthographicView只有正交视图的参数,要如何设置为等轴测视图呢?如西南视图...
vp.SetShadePlot(ShadePlotType.Hidden, vp.Id);//第二个参数我用vp.Id是我瞎猜的,虽然编译通过,但具体什么意思我还不明白
//设置要冻结的图层我猜过去一定是用FreezeLayersInViewport方法,但这个方法所需要的参数却不知道要怎样写.
//vp.FreezeLayersInViewport(???)
trans.Commit();
}
}
|
|