Commit Graph

57 Commits

Author SHA1 Message Date
fa36d82285 feat: Add material shape dropdown and Save As button to MainForm
UI improvements:
- Add material shape dropdown (Round Tube, Square Tube, Angle, etc.)
- Add Save As toolbar button for saving to a new file
- Simplify toolbar button styling (show text with icons)
- Expose SelectedMaterialShape property for report generation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 21:56:42 -05:00
b0c9470bb7 feat: Add cut method and material shape to saved reports
Include cutting tool name and material shape in the text report output.
This provides better context when reviewing saved cut lists.

Changes:
- BinFileSaver: Add CutMethod and MaterialShape properties
- ResultsForm: Pass cut method and material to file saver
- IMainView: Extend ShowResults with additional parameters
- MainFormPresenter: Use document name for save filename if available

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 21:56:33 -05:00
6db8ab21f4 feat: Improve document management with Save/Save As and keyboard shortcuts
- Track file path after save/load so Save doesn't prompt again
- Add Save As (Ctrl+Shift+S) to always prompt for location
- Update window title to show current filename
- Generate incremental default filenames (CutList_1.json, etc.)
- Add keyboard shortcuts: Ctrl+S (Save), Ctrl+O (Open), Ctrl+N (New)
- Enter key in items grid moves to Length column on next row

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 16:20:59 -05:00
b19ecf3610 refactor: Redesign nesting engines with pipeline pattern and add exhaustive search
- 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>
2026-02-01 15:16:40 -05:00
6e8469be4b refactor: Extract duplicate code in MainForm and CutListTools
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>
2026-02-01 13:18:23 -05:00
046976c429 refactor: Replace hash code magic number with named constant
Add HashMultiplier constant to BinComparer, BinItem, MultiBin, and Tool

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 13:07:52 -05:00
88d67336d9 refactor: Relocate BinFileSaver to CutList.Core with report generation
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>
2026-01-31 23:11:12 -05:00
04494a6744 chore: Remove unused using statements
Cleanup of unnecessary imports across the codebase.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 08:08:49 -05:00
410b4ba550 chore: Regenerate MainForm designer files
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>
2026-01-30 08:08:11 -05:00
3ee3ba7556 refactor: Update using statements for relocated types
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>
2026-01-30 08:07:59 -05:00
9abda896ea refactor: Relocate Document, BinFileSaver, and Toolbox to proper folders
- 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>
2026-01-30 08:07:37 -05:00
f25e31698f Rename SawCut library to CutList.Core
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>
2026-01-28 12:31:30 -05:00
AJ
c612a40a46 Fix example data dialog to respect 'No' response
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>
2025-11-23 18:04:17 -05:00
AJ
a619353375 Enhance cut list report formatting and readability
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>
2025-11-23 18:03:52 -05:00
AJ
36fd8df1ac Add bin grouping to consolidate identical bins in results
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>
2025-11-23 18:03:35 -05:00
AJ
1c8a9e8315 Clean up and fix service integration
- 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>
2025-11-22 23:03:37 -05:00
AJ
b1137f6b19 Implement MainFormPresenter.LoadExampleData
- 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>
2025-11-22 23:03:24 -05:00
AJ
1e168c7e92 Improve Document model encapsulation and null safety
- 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>
2025-11-22 23:02:49 -05:00
AJ
d1a5dd279c Add validation and business logic to domain models
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>
2025-11-22 23:02:37 -05:00
AJ
f55092d877 Refactor Helper to FormatHelper with improved documentation
- 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>
2025-11-22 23:02:24 -05:00
AJ
70f1380847 Migrate projects from .NET Framework 4.7.2 to .NET 8
- 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>
2025-11-22 23:02:12 -05:00
AJ
b92906bdea Implement MVP pattern to separate UI from business logic
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>
2025-11-18 17:43:44 -05:00
AJ
c8fd22f5b1 Update services to use Result pattern
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>
2025-11-18 17:43:33 -05:00
AJ
9abd00487b Add Result pattern for standardized error handling
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>
2025-11-18 17:43:12 -05:00
AJ
c7c841acab Extract business logic into dedicated service layer
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>
2025-11-18 16:03:07 -05:00
AJ
2c6fe924e5 Remove useless catch-and-rethrow blocks in Toolbox
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>
2025-11-18 16:02:36 -05:00
AJ
ee7275ac4f Fix state-mutating getter in LengthItem.Length
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>
2025-11-18 16:02:27 -05:00
AJ
95b663c893 SyncDocumentFromUI 2025-10-01 23:09:00 -04:00
AJ
ccbf8beeae Allow quantity -1 for infinite. 2025-01-05 23:16:39 -05:00
AJ
a1ad16bc52 Document 2025-01-02 23:21:34 -05:00
AJ
1636a62a77 Refactored BinLayoutView 2025-01-02 23:20:48 -05:00
AJ
491b98f983 Added cancel option to load example data 2025-01-01 01:30:47 -05:00
AJ
913064f4f8 Load Example Data 2025-01-01 00:47:01 -05:00
AJ
58b3c49cc6 Added option to OpenFileAfterSave 2024-12-24 13:34:31 -05:00
AJ
90ae89802a BinFileSaver 2024-12-09 11:15:08 -05:00
AJ Isaacs
791eb23fc0 Show mixed fractions instead of decimals for output 2024-12-09 10:26:36 -05:00
AJ Isaacs
26de4b885b Updated Newtonsoft.Json 2024-12-09 09:37:57 -05:00
AJ
2ce685bb83 Added Toolbox to manage tools 2023-01-14 08:39:01 -05:00
AJ
2af0c5967f Show results windows maximized 2023-01-14 07:37:48 -05:00
AJ
eac422cba6 Fixed bin height when drawing BinLayoutView 2023-01-14 02:13:02 -05:00
AJ
9ae37ca10c Fixed method name DrawingRowNumbers to DrawRowNumbers 2023-01-13 06:43:37 -05:00
AJ
b65dd1ec7d Used lower value priority bins first. 2022-02-09 11:22:56 -05:00
AJ
4427cde20d End edit for controls before running 2022-02-09 11:14:33 -05:00
AJ
804eedc649 Fixed DataSource reference. 2021-11-15 11:39:12 -05:00
AJ
a750fe0953 Fixed bin id increment twice. 2021-11-15 11:38:38 -05:00
AJ
497d1fc7fc Revised publish url 2021-11-15 09:27:05 -05:00
AJ
90d770e10c Fixed utilization greater than 100 percent 2021-11-15 09:10:20 -05:00
AJ
029414099e Remember save file name. 2021-11-15 08:46:46 -05:00
AJ
f892a4096b Base class LengthItem
Item and BinInputItem are basically the same for accepting string input.
2021-10-14 08:06:29 -04:00
AJ
495abe8cc3 Reordered methods within MainForm 2021-10-14 07:53:07 -04:00