| Package | Version | Downloads |
|---|---|---|
| DxfToCSharp.Core | ||
| DxfToCSharp.Tool | ||
| DxfToCSharp.Compilation |
DxfToCSharp is a powerful .NET library and toolset for generating C# code from DXF (Drawing Exchange Format) files. Built on top of the robust netDxf library, it provides seamless conversion of CAD drawings into executable C# code.
- π― High-Performance Code Generation - Convert DXF files to clean, readable C# code
- π§ Multiple Interfaces - GUI application, command-line tool, and programmatic API
- π Comprehensive DXF Support - Supports all major DXF entities and drawing elements
- π¨ Modern UI - Beautiful Avalonia-based desktop application
- β‘ Cross-Platform - Runs on Windows, macOS, and Linux
- π§ͺ Well-Tested - Comprehensive test suite with high code coverage
# Core library
dotnet add package DxfToCSharp.Core
# Compilation services
dotnet add package DxfToCSharp.Compilation# Install as global tool
dotnet tool install -g DxfToCSharp.Tool
# Use the tool
dxf2cs input.dxf output.csusing DxfToCSharp.Core;
using netDxf;
// Load DXF document
var dxfDocument = DxfDocument.Load("drawing.dxf");
// Configure generation options
var options = new DxfCodeGenerationOptions
{
Namespace = "MyProject.Drawings",
ClassName = "GeneratedDrawing"
};
// Generate C# code
var generator = new DxfCodeGenerator();
string csharpCode = generator.GenerateCode(dxfDocument, options);
// Save to file
File.WriteAllText("GeneratedDrawing.cs", csharpCode);# Basic usage
dxf2cs input.dxf output.cs
# With custom options
dxf2cs input.dxf output.cs --namespace "MyProject" --class "Drawing"The project is organized into several focused packages:
- DxfToCSharp.Core - Core code generation engine
- DxfToCSharp.Compilation - Compilation and validation services
- DxfToCSharp.Tool - Command-line interface
- DxfToCSharp - Desktop GUI application
- DxfToCSharp.Tests - Comprehensive test suite
| Package | Version | Purpose |
|---|---|---|
| netDxf.netstandard | 3.0.1 | DXF file parsing and manipulation |
| Microsoft.CodeAnalysis.CSharp | 4.14.0 | C# code analysis and compilation |
| Avalonia | 11.3.4 | Cross-platform UI framework |
| System.CommandLine | 2.0.0-beta4 | Command-line parsing |
We welcome contributions! Please see our Contributing Guidelines for details.
-
Clone the repository
git clone https://github.com/wieslawsoltes/DxfToCSharp.git cd DxfToCSharp -
Build the solution
dotnet build
-
Run tests
dotnet test
This project is licensed under the MIT.
See the LICENSE file for the complete license text.
WiesΕaw Ε oltΓ©s
- GitHub: @wieslawsoltes
- Website: GitHub Profile
- netDxf - Excellent DXF library by Daniel Carvajal
- Avalonia - Amazing cross-platform UI framework
- Microsoft Roslyn - Powerful C# compiler platform
Made with β€οΈ by WiesΕaw Ε oltΓ©s