- Rename Result to PackResult to avoid confusion with Result<T>
- Add PackingRequest as immutable configuration replacing mutable engine state
- Add PackingStrategy enum (AdvancedFit, BestFit, Exhaustive)
- Implement pipeline pattern for composable packing steps
- Rewrite AdvancedFitEngine as stateless using pipeline
- Rewrite BestFitEngine as stateless
- Add ExhaustiveFitEngine with symmetry breaking for optimal solutions
- Tries all bin assignments to find minimum bins
- Falls back to AdvancedFit for >20 items
- Configurable threshold via constructor
- Update IEngine/IEngineFactory interfaces for new pattern
- Add strategy parameter to MCP tools
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate duplicate logic to reduce code smells identified by Roslyn Bridge:
- Extract FlushPendingEdits() helper from Save() and Run() methods
- Simplify ClearData() to delegate to LoadDocumentData()
- Extract ConvertParts(), ConvertStockBins(), RunPackingAlgorithm() helpers
- Move DTO classes to separate Models.cs file
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add new MCP (Model Context Protocol) server project that exposes cut
list optimization tools for AI assistants. Implements tools for:
- create_cutlist: Optimized bin packing with parts and stock bins
- parse_length: Parse architectural format to decimal inches
- format_length: Format inches to feet/inches/fractions
- create_cutlist_report: Generate formatted printable text report
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move BinFileSaver from CutList/Services to CutList.Core namespace for
reuse by MCP server. Add GenerateReport() method that returns formatted
text instead of only writing to file. Refactor to use TextWriter base
class for flexibility.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Designer-generated changes from Visual Studio, includes updated
control sizing and removal of duplicate metadata entries.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates imports across the codebase to reference the new namespaces
for Formatting utilities, Document, BinFileSaver, and Toolbox.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Removes validation that required non-empty item names, as parts
may legitimately have no label assigned.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move Document.cs from Forms to Models namespace
- Move BinFileSaver.cs and Toolbox.cs from Forms to Services namespace
- Better separation of concerns between UI and business logic
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidates ArchUnits, FormatHelper, and Fraction classes into a
dedicated Formatting namespace for better organization.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename the core library project from SawCut to CutList.Core for consistent
branding across the solution. This includes:
- Rename project folder and .csproj file
- Update namespace from SawCut to CutList.Core
- Update all using statements and project references
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, clicking "No" in the confirmation dialog would still proceed to
load example data. Now both Cancel and No properly abort the operation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Changes default precision from 1/32" to 1/16" for cleaner measurements and
simplifies output by omitting unnecessary fraction components.
- Change default precision from 32 to 16
- Return whole numbers without "-0/N" suffix when fraction rounds to zero
- Update documentation to reflect new default precision
This makes measurements more readable (e.g., "12" instead of "12-0/16") while
maintaining sufficient precision for typical woodworking applications.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Improves the exported text file format with better organization, visual
hierarchy, and comprehensive summary information.
- Add header with creation timestamp and overall statistics
- Redesign bar sections with clearer labels and formatting
- Replace verbose item format with tabular layout (QTY/Length/Tag)
- Add final summary section with totals and best/worst utilization
- Use Unicode box-drawing characters for visual separation
- Fix namespace references (SawCut.FormatHelper → FormatHelper)
- Add null safety with DefaultIfEmpty for empty bin collections
- Make _bins field readonly for immutability
The new format is more professional and easier to scan visually, making it
simpler for operators to execute the cut list.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements grouping of identical bins (same items in same order) to reduce
visual clutter in the results grid. Instead of showing 10 identical bins as
separate rows, they now appear as a single row with a count.
- Add BinComparer for deep equality comparison of bins
- Add BinGroup to represent grouped bins with count
- Update ResultsForm to display grouped bins in grid
- Add Count column to show how many of each bin pattern
- Maintain original bins list for file export
This improves readability when the optimizer generates multiple identical
cutting patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove redundant Document initialization in MainForm
- Update CutListService to use SetBins method for MultiBinEngine
- Update MultiBinEngine instantiation to follow proper initialization pattern
- Ensure spacing is set after bins are configured
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Generate 25 random parts with lengths between 1-60 inches
- Add one stock bin of 144" with quantity 9999
- Use random quantities between 1-100 for parts
- Clear existing data when requested
- Update run button state after loading
- Add helper method GetRandomLength for generating test data
This completes the MVP pattern migration by moving example data
generation logic from the view to the presenter.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add backing fields for PartsToNest and StockBins collections
- Ensure collections are never null through property setters
- Add read-only views of collections via new properties
- Improve XML documentation
- Make LastFilePath internally settable for better control
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Enhance Tool, BinItem, and MultiBin classes with:
- Input validation in constructors and property setters
- Guard clauses for invalid states (negative values, empty names)
- Business logic methods (CanFitItem, CalculateWaste, etc.)
- Proper encapsulation with backing fields
- Comprehensive XML documentation
- Override Equals/GetHashCode for value semantics
- Better ToString() implementations
These changes enforce business rules at the domain level and prevent
invalid states from being created.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Rename Helper class to FormatHelper for clarity
- Add comprehensive XML documentation
- Update all references in BinFileSaver, ArchUnits, and Bin
- Remove unused System.Drawing import
- Better method documentation explaining parameters and return values
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Convert CutList.csproj to SDK-style project format
- Convert SawCut.csproj to SDK-style project format
- Remove obsolete packages.config files (now using PackageReference)
- Remove App.config (not needed in .NET 8)
- Update package references to use SDK-style format
- Enable nullable reference types and implicit usings
- Preserve publishing configuration for network deployment
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Introduce Model-View-Presenter pattern to eliminate business
logic from MainForm and enable proper separation of concerns.
New files:
- IMainView: Interface defining view contract
- MainFormPresenter: Contains all business logic orchestration
MainForm changes:
- Implements IMainView interface
- Delegates all business logic to presenter
- Focused purely on UI rendering and user input
- MessageBox calls now isolated to view implementation
Presenter responsibilities:
- Document operations (open, save, new)
- Validation orchestration
- Running packing algorithm
- Coordinating between services and view
- State management
Benefits:
- MainForm reduced from 380+ lines to clean view implementation
- Presenter can be unit tested without UI
- Business logic is reusable across different UI frameworks
- Clear separation: View = UI, Presenter = logic, Services = domain
- All SOLID principles now satisfied
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Refactor DocumentService and CutListService to return Result<T>
instead of throwing exceptions or using out parameters. This
removes all MessageBox calls from business logic.
DocumentService changes:
- Load() returns Result<Document> instead of Document
- Save() returns Result instead of void
- Validate() returns Result instead of bool with out parameter
- All exceptions caught and converted to Result.Failure
CutListService changes:
- Pack() returns Result<SawCut.Nesting.Result>
- Exceptions caught and converted to Result.Failure
Benefits:
- Services are now UI-agnostic (no MessageBox)
- Can be unit tested without UI dependencies
- Can be reused in console apps, web apps, etc.
- Errors are values, not exceptions
- Clear, type-safe error handling contract
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Replace hard-coded engine instantiation with factory pattern
to enable dependency injection and improve testability.
Changes:
- IEngineFactory: Interface for creating engines
- EngineFactory: Default implementation using AdvancedFitEngine
- MultiBinEngine: Now accepts IEngineFactory via constructor
This eliminates the hard-coded dependency on AdvancedFitEngine
and allows for easy swapping of engine implementations through
configuration or dependency injection.
Benefits:
- Dependency inversion principle satisfied
- Engines can be mocked in tests
- Engine selection can be configured externally
- Single responsibility for engine creation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implement Result<T> and Result classes to provide type-safe,
functional error handling throughout the application. This
eliminates the need for exceptions as control flow and provides
a consistent way to communicate success/failure.
Features:
- Result<T> for operations that return values
- Result for operations without return values
- Map() method for functional composition
- IsSuccess/IsFailure properties for easy checking
This pattern enables cleaner service contracts and eliminates
the need for out parameters and exception handling boilerplate.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Create CutListService and DocumentService to separate business
logic from UI concerns, following the service layer pattern.
Changes:
- CutListService: Handles bin packing algorithm orchestration
and data transformation from UI models to domain models
- DocumentService: Handles document persistence and validation
- Document: Removed Save/Load/Validate methods (now pure POCO)
- MainForm: Refactored to delegate to service classes instead
of containing business logic directly
Benefits:
- Improved separation of concerns
- Business logic can now be unit tested independently
- Removed MessageBox dependencies from business logic layer
- MainForm is now focused on UI concerns only
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Replace public mutable collection fields/properties with private
backing fields and expose them as IReadOnlyList. Add proper methods
for mutation (AddItem, AddItems, RemoveItem, SortItems).
Changes:
- Bin.Items: Now private with AddItem/AddItems/RemoveItem/SortItems
- Result.ItemsNotUsed: Now readonly with Add methods
- Result.Bins: Now readonly with Add methods
- Updated all engine classes to use new encapsulated APIs
This improves encapsulation and prevents external code from
bypassing business logic by directly manipulating collections.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Remove empty catch-and-rethrow blocks in Load() and Save() methods
that were catching exceptions only to rethrow them without adding
any value. This improves code clarity and exception propagation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Remove dangerous side effect where the Length property getter
was modifying the LengthInputValue field. Property getters should
be pure and not cause state mutations, as this violates the principle
of least surprise and can cause issues with data binding, serialization,
and debugging.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>