mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-30 21:21:35 -05:00
fix(core): narrow the perimeter-build catch to geometry failures
BuildPartPerimeter swallowed every exception. It now guards a missing program and an outline that forms no shape, and catches only geometry failures; a null perimeter still makes a cut-off exclude the part's whole bounding-box span. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
32edc18ede
commit
a451cf5ef3
2 files changed
+77
-2
No files matched your search
+10
-2
@@ -664,6 +664,11 @@ namespace OpenNest
|
||||
/// </summary>
|
||||
public static Geometry.Entity BuildPartPerimeter(Part part)
|
||||
{
|
||||
// Null is the conservative answer: the cut-off then excludes the part's whole
|
||||
// bounding-box span. Only malformed geometry earns it; anything else propagates.
|
||||
if (part?.Program == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
var entities = Converters
|
||||
@@ -683,7 +688,10 @@ namespace OpenNest
|
||||
e.Layer != SpecialLayers.Leadout).ToList();
|
||||
if (outline.Count == 0)
|
||||
return null;
|
||||
var profile = new Geometry.ShapeProfile(outline);
|
||||
var shapes = Geometry.ShapeBuilder.GetShapes(outline);
|
||||
if (shapes.Count == 0)
|
||||
return null;
|
||||
var profile = Geometry.ShapeProfile.FromShapes(shapes);
|
||||
|
||||
if (profile.Perimeter.IsClosed())
|
||||
{
|
||||
@@ -700,7 +708,7 @@ namespace OpenNest
|
||||
hull.Offset(part.Location);
|
||||
return hull;
|
||||
}
|
||||
catch
|
||||
catch (Exception e) when (Diagnostics.PlateOverlapAnalyzer.IsGeometryFailure(e))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user