Refactored MainForm

This commit is contained in:
AJ
2025-09-29 13:22:47 -04:00
parent 6b37f0f6f7
commit 2d5ffdf5c0
37 changed files with 3235 additions and 862 deletions

View File

@@ -0,0 +1,13 @@
namespace ExportDXF.Models
{
/// <summary>
/// Enumeration of SolidWorks document types.
/// </summary>
public enum DocumentType
{
Unknown,
Part,
Assembly,
Drawing
}
}

View 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
View 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; }
}
}

View 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; }
}
}