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。
相关推荐
拼好饭和她皆失1 小时前
C#学习入门
开发语言·学习·c#
小小编程能手3 小时前
大小端字节序
c#
冒泡P5 小时前
【Unity】TextMeshPro富文本中使用精灵图集
ui·unity·c#·游戏引擎
世洋Blog6 小时前
开发思想-组合模式和接口多态的一点思考
c#·组合模式
梵克之泪8 小时前
【号码分离】从Excel表格、文本、word文档混乱文字中提取分离11位手机号出来,基于WPF的实现方案
开发语言·ui·c#
玩泥巴的9 小时前
使用.NET 8+ 与飞书API构建组织架构同步服务
c#·.net·二次开发·飞书
道一2310 小时前
C# 读取文件方法介绍
开发语言·c#
Charles_go14 小时前
C#中级8、什么是缓存
开发语言·缓存·c#