Refactored MainForm
This commit is contained in:
13
ExportDXF/Models/DocumentType.cs
Normal file
13
ExportDXF/Models/DocumentType.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace ExportDXF.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration of SolidWorks document types.
|
||||
/// </summary>
|
||||
public enum DocumentType
|
||||
{
|
||||
Unknown,
|
||||
Part,
|
||||
Assembly,
|
||||
Drawing
|
||||
}
|
||||
}
|
||||
38
ExportDXF/Models/ExportContext.cs
Normal file
38
ExportDXF/Models/ExportContext.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using ExportDXF.ViewFlipDeciders;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
|
||||
namespace ExportDXF.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Context object containing all information needed for an export operation.
|
||||
/// </summary>
|
||||
public class ExportContext
|
||||
{
|
||||
/// <summary>
|
||||
/// The document to be exported.
|
||||
/// </summary>
|
||||
public SolidWorksDocument ActiveDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The view flip decider to determine if views should be flipped.
|
||||
/// </summary>
|
||||
public IViewFlipDecider ViewFlipDecider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Prefix to prepend to exported filenames.
|
||||
/// </summary>
|
||||
public string FilePrefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cancellation token for canceling the export operation.
|
||||
/// </summary>
|
||||
public CancellationToken CancellationToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Callback for reporting progress and status messages.
|
||||
/// </summary>
|
||||
public Action<string, Color?> ProgressCallback { get; set; }
|
||||
}
|
||||
}
|
||||
65
ExportDXF/Models/Item.cs
Normal file
65
ExportDXF/Models/Item.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using SolidWorks.Interop.sldworks;
|
||||
|
||||
namespace ExportDXF.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an item extracted from a BOM or assembly.
|
||||
/// </summary>
|
||||
public class Item
|
||||
{
|
||||
/// <summary>
|
||||
/// Item number from the BOM.
|
||||
/// </summary>
|
||||
public string ItemNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Part name or file name.
|
||||
/// </summary>
|
||||
public string PartName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Configuration name.
|
||||
/// </summary>
|
||||
public string Configuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item description.
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quantity of this item.
|
||||
/// </summary>
|
||||
public int Quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Material specification.
|
||||
/// </summary>
|
||||
public string Material { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sheet metal thickness in millimeters.
|
||||
/// </summary>
|
||||
public double Thickness { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sheet metal K-factor.
|
||||
/// </summary>
|
||||
public double KFactor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bend radius in millimeters.
|
||||
/// </summary>
|
||||
public double BendRadius { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The exported DXF filename (without path or extension).
|
||||
/// </summary>
|
||||
public string FileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The SolidWorks component reference.
|
||||
/// </summary>
|
||||
public Component2 Component { get; set; }
|
||||
}
|
||||
}
|
||||
30
ExportDXF/Models/SolidWorksDocument.cs
Normal file
30
ExportDXF/Models/SolidWorksDocument.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using ExportDXF.Models;
|
||||
|
||||
namespace ExportDXF.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a SolidWorks document with essential metadata.
|
||||
/// </summary>
|
||||
public class SolidWorksDocument
|
||||
{
|
||||
/// <summary>
|
||||
/// The title/name of the document.
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The full file path of the document.
|
||||
/// </summary>
|
||||
public string FilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of document (Part, Assembly, or Drawing).
|
||||
/// </summary>
|
||||
public DocumentType DocumentType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The native SolidWorks document object (ModelDoc2, PartDoc, etc.).
|
||||
/// </summary>
|
||||
public object NativeDocument { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user