C#开源库ACadSharp将Dwg转Dxf

介绍

开源库ACadSharp的地址:https://github.com/DomCR/ACadSharp

可以在NuGet中搜索到该库并安装。

Dwg转Dxf

csharp 复制代码
using ACadSharp.IO;
using ACadSharp;
using System;

namespace TestACadSharp.Tests
{
    /// <summary>
    /// 将dwg转dxf
    /// </summary>
    internal class TestDwgToDxf
    {
        public static void Run()
        {
            var dwgPath = "./TestData/demo.dwg";
            var dxfPath = "./TestData/demo.dxf";
            CadDocument doc = DwgReader.Read(dwgPath, onNotification);
            DxfWriter.Write(dxfPath, doc);
        }
        private static void onNotification(object sender, NotificationEventArgs e)
        {
            Console.WriteLine(e.Message);
        }
    }
}

注意:

  • 测试的dwg在AutoCAD2014中可以打开,该dwg所转的dxf在AutoCAD2014中未能成功打开,但是在一些CAD看图王(试验使用了浩辰CAD看图王)中可以成功预览所转的Dxf。
相关推荐
周杰伦fans21 小时前
C# required 关键字详解
开发语言·网络·c#
游乐码1 天前
c#ArrayList
开发语言·c#
唐青枫1 天前
C#.NET Monitor 与 Mutex 深入解析:进程内同步、跨进程互斥与使用边界
c#·.net
周杰伦fans1 天前
cad文件选项卡不见了怎么办?
c#
llm大模型算法工程师weng1 天前
Python敏感词检测方案详解
开发语言·python·c#
游乐码1 天前
c#stack
开发语言·c#
橘子编程1 天前
编程语言全指南:从C到Rust
java·c语言·开发语言·c++·python·rust·c#
zztfj1 天前
C# 异步方法 async / await CancellationToken 设置任务超时并手动取消耗时处理
c#·异步
无风听海1 天前
.NET10之C# 中的is null深入理解
服务器·c#·.net
龙侠九重天1 天前
C# 机器学习数据处理
开发语言·人工智能·机器学习·ai·c#