Skip to content

wieslawsoltes/DxfToCSharp

Repository files navigation

DxfToCSharp

.NET 9.0 License Platform

CI/CD Pipeline Code Coverage Code Formatting

CodeQL Security Analysis Documentation Security Scan

Static Code Analysis Validate Workflow Dependabot Updates

πŸ“¦ NuGet Packages

Package Version Downloads
DxfToCSharp.Core NuGet NuGet Downloads
DxfToCSharp.Tool NuGet NuGet Downloads
DxfToCSharp.Compilation NuGet NuGet Downloads

πŸš€ Overview

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.

✨ Key Features

  • 🎯 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

πŸ› οΈ Installation

Library (NuGet)

# Core library
dotnet add package DxfToCSharp.Core

# Compilation services
dotnet add package DxfToCSharp.Compilation

Command Line Tool

# Install as global tool
dotnet tool install -g DxfToCSharp.Tool

# Use the tool
dxf2cs input.dxf output.cs

πŸ“– Quick Start

Using the Library

using 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);

Using the Command Line Tool

# Basic usage
dxf2cs input.dxf output.cs

# With custom options
dxf2cs input.dxf output.cs --namespace "MyProject" --class "Drawing"

πŸ—οΈ Architecture

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

πŸ”§ Dependencies

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

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

  1. Clone the repository

    git clone https://github.com/wieslawsoltes/DxfToCSharp.git
    cd DxfToCSharp
  2. Build the solution

    dotnet build
  3. Run tests

    dotnet test

πŸ“„ License

This project is licensed under the MIT.

See the LICENSE file for the complete license text.

πŸ‘¨β€πŸ’» Author

WiesΕ‚aw Ε oltΓ©s

πŸ™ Acknowledgments

πŸ“Š Project Stats

GitHub stars GitHub forks GitHub issues GitHub pull requests


Made with ❀️ by WiesΕ‚aw Ε oltΓ©s

Sponsor this project

 

Packages

 
 
 

Contributors

Languages