public RectangleClass DrawRectangle(string name, double xDist, double yDist, Point startPoint) { RectangleClass rect = new RectangleClass(name, xDist, yDist, startPoint); using (Application.DocumentManager.MdiActiveDocument.LockDocument()) { using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTableRecord space = (BlockTableRecord)trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); Point3dCollection points = new Point3dCollection(); points.Add(new Point3d(rect.StartPoint.X, rect.StartPoint.Y, 0)); points.Add(new Point3d(rect.PointTwo.X, rect.PointTwo.Y, 0)); points.Add(new Point3d(rect.PointThree.X, rect.PointThree.Y, 0)); points.Add(new Point3d(rect.PointFour.X, rect.PointFour.Y, 0)); Polyline2d polyline2D = new Polyline2d(Poly2dType.SimplePoly, points, 0, true, 0, 0, null); space.AppendEntity(polyline2D); trans.AddNewlyCreatedDBObject(polyline2D, true); trans.Commit(); } } return(rect); }
public RectangleClass DrawRectangle(string name, double xDist, double yDist, Point startPoint, bool maybe) { RectangleClass rect = new RectangleClass(name, xDist, yDist, startPoint); DrawLine($"{name} Line One", rect.StartPoint, rect.PointTwo); DrawLine($"{name} Line Two", rect.PointTwo, rect.PointThree); DrawLine($"{name} Line Three", rect.PointThree, rect.PointFour); DrawLine($"{name} Line Four", rect.PointFour, rect.StartPoint); return(rect); }