fix: respect suppression state in filter panel and guard DetermineWinding
FilterPanel.LoadItem was hardcoding all layer and line type checkboxes to checked, ignoring actual visibility state. Now reads Layer.IsVisible and entity IsVisible to set correct checked state. Also guard DetermineWinding against shapes with fewer than 3 polygon points (defaults to CCW) to prevent crash when applying lead-ins. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -309,7 +309,12 @@ namespace OpenNest.CNC.CuttingStrategy
|
||||
if (shape.Entities.Count == 1 && shape.Entities[0] is Circle circle)
|
||||
return circle.Rotation;
|
||||
|
||||
return shape.ToPolygon().RotationDirection();
|
||||
var polygon = shape.ToPolygon();
|
||||
|
||||
if (polygon.Vertices.Count < 3)
|
||||
return RotationType.CCW;
|
||||
|
||||
return polygon.RotationDirection();
|
||||
}
|
||||
|
||||
private LeadIn ClampLeadInForCircle(LeadIn leadIn, Circle circle, Vector contourPoint, double normalAngle)
|
||||
|
||||
@@ -170,10 +170,11 @@ namespace OpenNest.Controls
|
||||
layersList.Items.Clear();
|
||||
var layers = entities
|
||||
.Where(e => e.Layer != null)
|
||||
.Select(e => e.Layer.Name)
|
||||
.Distinct();
|
||||
.Select(e => e.Layer)
|
||||
.GroupBy(l => l.Name)
|
||||
.Select(g => g.First());
|
||||
foreach (var layer in layers)
|
||||
layersList.Items.Add(layer, true); // checked = visible
|
||||
layersList.Items.Add(layer.Name, layer.IsVisible);
|
||||
|
||||
layersPanel.HeaderText = $"Layers ({layersList.Items.Count})";
|
||||
|
||||
@@ -191,10 +192,10 @@ namespace OpenNest.Controls
|
||||
// Line Types
|
||||
lineTypesList.Items.Clear();
|
||||
var lineTypes = entities
|
||||
.Select(e => e.LineTypeName ?? "Continuous")
|
||||
.Distinct();
|
||||
.GroupBy(e => e.LineTypeName ?? "Continuous")
|
||||
.Select(g => new { Name = g.Key, Visible = g.Any(e => e.IsVisible) });
|
||||
foreach (var lt in lineTypes)
|
||||
lineTypesList.Items.Add(lt, true); // checked = visible
|
||||
lineTypesList.Items.Add(lt.Name, lt.Visible);
|
||||
|
||||
lineTypesPanel.HeaderText = $"Line Types ({lineTypesList.Items.Count})";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user