CADability icon indicating copy to clipboard operation
CADability copied to clipboard

Border.GetParallel null exception

Open davidebazzi opened this issue 9 months ago • 5 comments

When an arc of the border will disappear for the computed offset there is an exception. Code to reproduce the bug: CADability.Shapes.BorderBuilder bb = new CADability.Shapes.BorderBuilder(); bb.AddSegment(new Line2D(new GeoPoint2D(2, 0), new GeoPoint2D(8, 0))); bb.AddSegment(new Arc2D(new GeoPoint2D(8, 2), 2, Angle.A270, SweepAngle.Deg(90))); bb.AddSegment(new Line2D(new GeoPoint2D(10, 2), new GeoPoint2D(10, 8))); bb.AddSegment(new Arc2D(new GeoPoint2D(8, 8), 2, Angle.A0, SweepAngle.Deg(90))); bb.AddSegment(new Line2D(new GeoPoint2D(8, 10), new GeoPoint2D(2, 10))); bb.AddSegment(new Arc2D(new GeoPoint2D(2, 8), 2, Angle.A90, SweepAngle.Deg(90))); bb.AddSegment(new Line2D(new GeoPoint2D(0, 8), new GeoPoint2D(0, 2))); bb.AddSegment(new Arc2D(new GeoPoint2D(2, 2), 2, Angle.A180, SweepAngle.Deg(90)));

CADability.Shapes.Border b = bb.BuildBorder(false);

CADability.Shapes.Border[] b1 = b.GetParallel(-1.5, false, 0.001, 0); //It works. CADability.Shapes.Border[] b2 = b.GetParallel(-2.5, false, 0.001, 0); //It generates and exception.

davidebazzi avatar Apr 23 '25 06:04 davidebazzi