Files
OpenNest/OpenNest.IO/Bending/BendDetectorRegistry.cs
T
aj aec0523062 style: apply CSharpier formatting to all C# sources
Repo-wide sweep with the pinned CSharpier 1.3.0 tool. Whitespace and
line-wrapping only; OpenNest.Engine.Tests (109) and OpenNest.IO.Tests
pass after reformat, full solution builds 0 errors.

Added .csharpierignore so csproj/config XML keeps its existing layout
(CSharpier's XML wrapping churns attributes with zero benefit).

Formatting is now enforceable: dotnet csharpier check . passes.
2026-09-20 16:41:50 -04:00

41 lines
1.0 KiB
C#

using System.Collections.Generic;
using System.Linq;
using ACadSharp;
using OpenNest.Bending;
namespace OpenNest.IO.Bending
{
public static class BendDetectorRegistry
{
private static readonly List<IBendDetector> detectors = new();
static BendDetectorRegistry()
{
Register(new SolidWorksBendDetector());
}
public static void Register(IBendDetector detector)
{
detectors.Add(detector);
}
public static IReadOnlyList<IBendDetector> Detectors => detectors;
public static IBendDetector GetByName(string name)
{
return detectors.FirstOrDefault(d => d.Name == name);
}
public static List<Bend> AutoDetect(CadDocument document)
{
foreach (var detector in detectors)
{
var bends = detector.DetectBends(document);
if (bends.Count > 0)
return bends;
}
return new List<Bend>();
}
}
}