Using Autodesk.AutoCAD.Runtime;
Using Autodesk.AutoCAD.ApplicationServices;
Using Autodesk.AutoCAD.DatabaseServices;
Using Autodesk.AutoCAD.Geometry;
Namespace Wipeoutapplication
{
public class Commands
{
[Commandmethod ("CW")]
public void Createwipeout ()
{
Document doc =
Application.DocumentManager.MdiActiveDocument;
Database db = Doc. Database;
Transaction TR =
Db. Transactionmanager.starttransaction ();
using (TR)
{
Blocktable BT =
(blocktable) tr. GetObject (
Db. Blocktableid,
Openmode.forread,
False
);
Blocktablerecord BTR =
(Blocktablerecord) tr. GetObject (
Bt[blocktablerecord.modelspace],
Openmode.forwrite,
False
);
Point2dcollection pts =
New Point2dcollection (5);
Pts. ADD (New point2d (0.0, 0.0));
Pts. ADD (New point2d (100.0, 0.0));
Pts. ADD (New point2d (100.0, 100.0));
Pts. ADD (New point2d (0.0, 100.0));
Pts. ADD (New point2d (0.0, 0.0));
Wipeout wo = new Wipeout ();
Wo. Setdatabasedefaults (DB);
Wo. Setfrom (pts, New Vector3D (0.0, 0.0, 0.1));
Btr. Appendentity (wo);
Tr. Addnewlycreateddbobject (Wo, true);
Tr.commit ();
}
}
}
}