feat: add directional part sequencers (RightSide, LeftSide, BottomSide)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
17
OpenNest.Engine/Sequencing/BottomSideSequencer.cs
Normal file
17
OpenNest.Engine/Sequencing/BottomSideSequencer.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenNest.Engine.Sequencing
|
||||
{
|
||||
public class BottomSideSequencer : IPartSequencer
|
||||
{
|
||||
public List<SequencedPart> Sequence(IReadOnlyList<Part> parts, Plate plate)
|
||||
{
|
||||
return parts
|
||||
.OrderBy(p => p.Location.Y)
|
||||
.ThenBy(p => p.Location.X)
|
||||
.Select(p => new SequencedPart { Part = p })
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
17
OpenNest.Engine/Sequencing/LeftSideSequencer.cs
Normal file
17
OpenNest.Engine/Sequencing/LeftSideSequencer.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenNest.Engine.Sequencing
|
||||
{
|
||||
public class LeftSideSequencer : IPartSequencer
|
||||
{
|
||||
public List<SequencedPart> Sequence(IReadOnlyList<Part> parts, Plate plate)
|
||||
{
|
||||
return parts
|
||||
.OrderBy(p => p.Location.X)
|
||||
.ThenBy(p => p.Location.Y)
|
||||
.Select(p => new SequencedPart { Part = p })
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
17
OpenNest.Engine/Sequencing/RightSideSequencer.cs
Normal file
17
OpenNest.Engine/Sequencing/RightSideSequencer.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenNest.Engine.Sequencing
|
||||
{
|
||||
public class RightSideSequencer : IPartSequencer
|
||||
{
|
||||
public List<SequencedPart> Sequence(IReadOnlyList<Part> parts, Plate plate)
|
||||
{
|
||||
return parts
|
||||
.OrderByDescending(p => p.Location.X)
|
||||
.ThenBy(p => p.Location.Y)
|
||||
.Select(p => new SequencedPart { Part = p })
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user