diff --git a/ExportDXF/Models/BomItem.cs b/ExportDXF/Models/BomItem.cs
index c986ca9..6d2c674 100644
--- a/ExportDXF/Models/BomItem.cs
+++ b/ExportDXF/Models/BomItem.cs
@@ -2,7 +2,6 @@ namespace ExportDXF.Models
{
public class BomItem
{
- public int ID { get; set; }
public string ItemNo { get; set; } = "";
public string PartNo { get; set; } = "";
public int SortOrder { get; set; }
@@ -12,13 +11,7 @@ namespace ExportDXF.Models
public string PartName { get; set; } = "";
public string ConfigurationName { get; set; } = "";
public string Material { get; set; } = "";
-
- // EF Core relationship to ExportRecord
- public int ExportRecordId { get; set; }
- public virtual ExportRecord ExportRecord { get; set; }
-
- // Optional 1:1 relationship to CutTemplate (only for sheet metal parts)
- public virtual CutTemplate CutTemplate { get; set; }
+ public CutTemplate CutTemplate { get; set; }
}
public struct Size
diff --git a/ExportDXF/Models/CutTemplate.cs b/ExportDXF/Models/CutTemplate.cs
index ee04b68..cebc4c4 100644
--- a/ExportDXF/Models/CutTemplate.cs
+++ b/ExportDXF/Models/CutTemplate.cs
@@ -4,12 +4,11 @@ namespace ExportDXF.Models
{
public class CutTemplate
{
- public int Id { get; set; }
public string DxfFilePath { get; set; } = "";
public string ContentHash { get; set; }
public string CutTemplateName { get; set; } = "";
+ public int Revision { get; set; } = 1;
- // Sheet metal properties (moved from BomItem)
private double? _thickness;
public double? Thickness
{
@@ -25,9 +24,5 @@ namespace ExportDXF.Models
get => _defaultBendRadius;
set => _defaultBendRadius = value.HasValue ? Math.Round(value.Value, 8) : null;
}
-
- // FK back to BomItem
- public int BomItemId { get; set; }
- public virtual BomItem BomItem { get; set; }
}
}
diff --git a/ExportDXF/Models/ExportContext.cs b/ExportDXF/Models/ExportContext.cs
index 8a0ab2f..a2cd6f5 100644
--- a/ExportDXF/Models/ExportContext.cs
+++ b/ExportDXF/Models/ExportContext.cs
@@ -1,4 +1,4 @@
-using ExportDXF.Models;
+using ExportDXF.Models;
using ExportDXF.ViewFlipDeciders;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
@@ -28,29 +28,14 @@ namespace ExportDXF.Services
public IViewFlipDecider ViewFlipDecider { get; set; }
///
- /// Prefix to prepend to exported filenames.
+ /// Filename template with placeholders (e.g., "4321 A01 PT{item_no:2}").
///
- public string FilePrefix { get; set; }
+ public string FilenameTemplate { get; set; }
///
- /// Equipment number from the UI (e.g., "5028").
+ /// Output folder for DXF files and Excel workbook.
///
- public string Equipment { get; set; }
-
- ///
- /// Drawing number from the UI (e.g., "A02", "Misc").
- ///
- public string DrawingNo { get; set; }
-
- ///
- /// Optional title/label for the export.
- ///
- public string Title { get; set; }
-
- ///
- /// Selected Equipment ID for API operations (optional).
- ///
- public int? EquipmentId { get; set; }
+ public string OutputFolder { get; set; }
///
/// Cancellation token for canceling the export operation.
@@ -82,8 +67,8 @@ namespace ExportDXF.Services
get
{
return Path.Combine(
- Application.StartupPath,
- DRAWING_TEMPLATE_FOLDER,
+ Application.StartupPath,
+ DRAWING_TEMPLATE_FOLDER,
DRAWING_TEMPLATE_FILE);
}
}
@@ -123,23 +108,17 @@ namespace ExportDXF.Services
if (!string.IsNullOrEmpty(title))
{
- // Close the document without saving
SolidWorksApp.CloseDoc(title);
ProgressCallback?.Invoke("Closed template drawing", LogLevel.Info, null);
}
}
- // Clear the reference regardless of success/failure
TemplateDrawing = null;
}
catch (Exception ex)
{
ProgressCallback?.Invoke($"Failed to close template drawing: {ex.Message}", LogLevel.Error, null);
-
- // Still clear the reference to prevent further issues
TemplateDrawing = null;
-
- // Don't throw here as this is cleanup code - log the error but continue
}
}
diff --git a/ExportDXF/Models/ExportRecord.cs b/ExportDXF/Models/ExportRecord.cs
deleted file mode 100644
index 4e6adda..0000000
--- a/ExportDXF/Models/ExportRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace ExportDXF.Models
-{
- public class ExportRecord
- {
- public int Id { get; set; }
- public string DrawingNumber { get; set; }
- public string EquipmentNo { get; set; }
- public string DrawingNo { get; set; }
- public string SourceFilePath { get; set; }
- public string OutputFolder { get; set; }
- public DateTime ExportedAt { get; set; }
- public string ExportedBy { get; set; }
- public string PdfContentHash { get; set; }
-
- public virtual ICollection BomItems { get; set; } = new List();
- }
-}