public override bool WorldDraw(Drawable drawable, WorldDraw wd)
{
var ent = drawable as Entity;
if (ent != null)
if (ent.IsModPlusProduct())
{
var scale = 1;
var plane = ent.GetPlane();
Matrix3d ucs = AcApp.DocumentManager.MdiActiveDocument.Editor.CurrentUserCoordinateSystem;
var extents = ent.GeometricExtents;
//var pt = extents.MaxPoint;
var pt = extents.MaxPoint.TransformBy(ucs.Inverse());
Point3dCollection points = new Point3dCollection();
points.Add(new Point3d(pt.X + 30 * scale, pt.Y + 30 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 30 * scale, pt.Y + 40 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 40 * scale, pt.Y + 40 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 40 * scale, pt.Y + 60 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 30 * scale, pt.Y + 60 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 30 * scale, pt.Y + 70 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 60 * scale, pt.Y + 70 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 60 * scale, pt.Y + 60 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 50 * scale, pt.Y + 60 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 50 * scale, pt.Y + 40 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 60 * scale, pt.Y + 40 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 60 * scale, pt.Y + 30 * scale, plane.PointOnPlane.Z));
points.Add(new Point3d(pt.X + 30 * scale, pt.Y + 30 * scale, plane.PointOnPlane.Z));
Autodesk.AutoCAD.DatabaseServices.Polyline polyline =
new Autodesk.AutoCAD.DatabaseServices.Polyline();
for (int i = 0; i < points.Count; i++)
{
polyline.AddVertexAt(i, points[i].Convert2d(plane), 0.0, 0.0, 0.0);
}
polyline.ColorIndex = 150;
wd.Geometry.Draw(polyline); // Так не работает - вылетает автокад с фатальной ошибкой
wd.Geometry.Polyline(points, plane.Normal, IntPtr.Zero); // Так работает, но этого мало
}
return base.WorldDraw(drawable, wd);
}