I have polyline close in model space . I want create viewport from this polyline, but I do'nt know how do.
You can help me?
Thank you very much!!!
This my code:
private void button1_Click(object sender, EventArgs e)
{
acad.Document _doc = acad.Application.DocumentManager.MdiActiveDocument;
Database db = _doc.Database;
Editor _ed = _doc.Editor;
//var ext = new Extents2d();
using (acad.DocumentLock _lock = _doc.LockDocument())
{
using (Transaction _tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)_tr.GetObject(db.BlockTableId, OpenMode.ForRead);
DBObjectCollection objs = new DBObjectCollection();
for (int i = 0; i < _ListKhungView.Count; i++)
{
Polyline _pl = _ListKhungView[i];
//Tạo layout mới
ObjectId id = LayoutManager.Current.CreateLayout("A" + i.ToString());
Layout lay = (Layout)_tr.GetObject(id, OpenMode.ForWrite);
// tạo 1 polyline copy
Polyline _plClone = _pl.Clone() as Polyline;
// Mở Block table record in paperSpace
BlockTableRecord ps = (BlockTableRecord)_tr.GetObject(lay.BlockTableRecordId, OpenMode.ForWrite);
ps.AppendEntity(_plClone);
_tr.AddNewlyCreatedDBObject(_plClone, true);
Viewport vp = new Viewport();
vp.SetDatabaseDefaults();
ps.AppendEntity(vp);
_tr.AddNewlyCreatedDBObject(vp, true);
vp.NonRectClipEntityId = _plClone.ObjectId;
vp.NonRectClipOn = true;
//vp.On = true;
vp.CustomScale = 1;
}
_tr.Commit();
}
acad.Application.UpdateScreen();
}
}
Solved! Go to Solution.
Solved by mgarcesUX9HW. Go to Solution.
hi im not sure what you want but here is the options.
1. in the paperspace just type mview to create viewport and scale it as you want
2. or copy your polyline in the model space and paste in the paperspace, you can scale down the polyline or you can just leave it 1:1, then type mview, then type o to select the object you want to become viewport, then select he polyline and then the polyline will be converted to viewport
hi if this answers your question can you please click the accept button thanks!
Can't find what you're looking for? Ask the community or share your knowledge.