feat: add Tab hierarchy (4 classes)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
34
OpenNest.Core/CNC/CuttingStrategy/Tabs/BreakerTab.cs
Normal file
34
OpenNest.Core/CNC/CuttingStrategy/Tabs/BreakerTab.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenNest.Geometry;
|
||||
|
||||
namespace OpenNest.CNC.CuttingStrategy
|
||||
{
|
||||
public class BreakerTab : Tab
|
||||
{
|
||||
public double BreakerDepth { get; set; }
|
||||
public double BreakerLeadInLength { get; set; }
|
||||
public double BreakerAngle { get; set; }
|
||||
|
||||
public override List<ICode> Generate(
|
||||
Vector tabStartPoint, Vector tabEndPoint, double contourNormalAngle,
|
||||
RotationType winding = RotationType.CW)
|
||||
{
|
||||
var codes = new List<ICode>();
|
||||
|
||||
if (TabLeadOut != null)
|
||||
codes.AddRange(TabLeadOut.Generate(tabStartPoint, contourNormalAngle, winding));
|
||||
|
||||
var scoreAngle = contourNormalAngle + System.Math.PI;
|
||||
var scoreEnd = new Vector(
|
||||
tabStartPoint.X + BreakerDepth * System.Math.Cos(scoreAngle),
|
||||
tabStartPoint.Y + BreakerDepth * System.Math.Sin(scoreAngle));
|
||||
codes.Add(new LinearMove(scoreEnd));
|
||||
codes.Add(new RapidMove(tabEndPoint));
|
||||
|
||||
if (TabLeadIn != null)
|
||||
codes.AddRange(TabLeadIn.Generate(tabEndPoint, contourNormalAngle, winding));
|
||||
|
||||
return codes;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
OpenNest.Core/CNC/CuttingStrategy/Tabs/MachineTab.cs
Normal file
20
OpenNest.Core/CNC/CuttingStrategy/Tabs/MachineTab.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenNest.Geometry;
|
||||
|
||||
namespace OpenNest.CNC.CuttingStrategy
|
||||
{
|
||||
public class MachineTab : Tab
|
||||
{
|
||||
public int MachineTabId { get; set; }
|
||||
|
||||
public override List<ICode> Generate(
|
||||
Vector tabStartPoint, Vector tabEndPoint, double contourNormalAngle,
|
||||
RotationType winding = RotationType.CW)
|
||||
{
|
||||
return new List<ICode>
|
||||
{
|
||||
new RapidMove(tabEndPoint)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
36
OpenNest.Core/CNC/CuttingStrategy/Tabs/NormalTab.cs
Normal file
36
OpenNest.Core/CNC/CuttingStrategy/Tabs/NormalTab.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenNest.Geometry;
|
||||
|
||||
namespace OpenNest.CNC.CuttingStrategy
|
||||
{
|
||||
public class NormalTab : Tab
|
||||
{
|
||||
public double CutoutMinWidth { get; set; }
|
||||
public double CutoutMinHeight { get; set; }
|
||||
public double CutoutMaxWidth { get; set; }
|
||||
public double CutoutMaxHeight { get; set; }
|
||||
|
||||
public override List<ICode> Generate(
|
||||
Vector tabStartPoint, Vector tabEndPoint, double contourNormalAngle,
|
||||
RotationType winding = RotationType.CW)
|
||||
{
|
||||
var codes = new List<ICode>();
|
||||
|
||||
if (TabLeadOut != null)
|
||||
codes.AddRange(TabLeadOut.Generate(tabStartPoint, contourNormalAngle, winding));
|
||||
|
||||
codes.Add(new RapidMove(tabEndPoint));
|
||||
|
||||
if (TabLeadIn != null)
|
||||
codes.AddRange(TabLeadIn.Generate(tabEndPoint, contourNormalAngle, winding));
|
||||
|
||||
return codes;
|
||||
}
|
||||
|
||||
public bool AppliesToCutout(double cutoutWidth, double cutoutHeight)
|
||||
{
|
||||
return cutoutWidth >= CutoutMinWidth && cutoutWidth <= CutoutMaxWidth
|
||||
&& cutoutHeight >= CutoutMinHeight && cutoutHeight <= CutoutMaxHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
OpenNest.Core/CNC/CuttingStrategy/Tabs/Tab.cs
Normal file
16
OpenNest.Core/CNC/CuttingStrategy/Tabs/Tab.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenNest.Geometry;
|
||||
|
||||
namespace OpenNest.CNC.CuttingStrategy
|
||||
{
|
||||
public abstract class Tab
|
||||
{
|
||||
public double Size { get; set; } = 0.03;
|
||||
public LeadIn TabLeadIn { get; set; }
|
||||
public LeadOut TabLeadOut { get; set; }
|
||||
|
||||
public abstract List<ICode> Generate(
|
||||
Vector tabStartPoint, Vector tabEndPoint, double contourNormalAngle,
|
||||
RotationType winding = RotationType.CW);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user