# Auto-fill Equipment/Drawing from Export History ## Problem When a SolidWorks file is opened that doesn't match the `DrawingInfo` regex (e.g., `Conveyor Frame.sldasm` instead of `5028 A02 Conveyor.slddrw`), the equipment and drawing number dropdowns are left empty even though the file may have been exported before with known values. ## Decision - **Lookup key:** SolidWorks source file path (`ActiveDocument.FilePath`) - **Storage:** Query the existing `ExportRecords` table (no new table or migration) - **Priority:** Database lookup first; fall back to title regex parse if no history found ## Design ### Modify `UpdateActiveDocumentDisplay()` in `MainForm.cs` When the active document changes: 1. Query the DB for the most recent `ExportRecord` where `SourceFilePath` matches `activeDoc.FilePath` (case-insensitive) 2. If found, parse the stored `DrawingNumber` via `DrawingInfo.Parse()` and auto-fill equipment/drawing dropdowns 3. If not found, fall back to current behavior: `DrawingInfo.Parse(activeDoc.Title)` ### What doesn't change - No schema changes, no new migration - Equipment/drawing dropdowns still populated with historical values in `InitializeDrawingDropdowns()` - Export flow untouched ### Error handling - DB query wrapped in try/catch so failures don't break the UI - Case-insensitive path comparison (Windows paths are case-insensitive)