- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using below code for wipeout using ployline/rectangle but facing issue not able to perform operation
geeting error at wipeout.SetBoundary(polyId);
setboundary no accessible extension..
anyone any idea ?
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
PromptPointOptions ppo = new PromptPointOptions("\nSelect first corner of the rectangle: ");
PromptPointResult ppr1 = ed.GetPoint(ppo);
if (ppr1.Status == PromptStatus.OK)
{
Point3d firstCorner = ppr1.Value;
ppo.Message = "\nSelect opposite corner of the rectangle: ";
ppo.UseBasePoint = true;
ppo.BasePoint = firstCorner;
PromptPointResult ppr2 = ed.GetPoint(ppo);
if (ppr2.Status == PromptStatus.OK)
{
Point3d secondCorner = ppr2.Value;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
// Define wipeout vertices
Point3d[] vertices =
{
firstCorner,
new Point3d(secondCorner.X, firstCorner.Y, 0),
secondCorner,
new Point3d(firstCorner.X, secondCorner.Y, 0)
};
// Create polyline for wipeout
Polyline poly = new Polyline();
for (int i = 0; i < vertices.Length; i++)
{
poly.AddVertexAt(i, new Point2d(vertices[i].X, vertices[i].Y), 0, 0, 0);
}
poly.Closed = true;
// Add polyline to the drawing
ObjectId polyId = btr.AppendEntity(poly);
tr.AddNewlyCreatedDBObject(poly, true);
// Create wipeout
Wipeout wipeout = new Wipeout();
wipeout.SetDatabaseDefaults();
// Set wipeout boundary using polyline
wipeout.SetBoundary(polyId);
// Add wipeout to the drawing
ObjectId wipeoutId = btr.AppendEntity(wipeout);
tr.AddNewlyCreatedDBObject(wipeout, true);
// Display changes
tr.Commit();
}
}
}
Solved! Go to Solution.