• NetDxf 开发笔记-01


    netdxf介绍github库

    https://github.com/haplokuon/netDxf

    netDxf是一个.net库,用C语言编程,用于读取和写入AutoCAD DXF文件。它支持文本和二进制格式的AutoCad2000、AutoCad2004、AutoCad2007、AutoCad2010、AutoCad2013和AutoCAD2018DXF数据库版本。
    这个库很容易使用,我尽量使过程简单明了,例如,您不需要用图层、样式或线型定义填充表格部分。每次添加新项时,DxfDocument都会处理这个问题。

    public static void Main()
    {
    	// your DXF file name
    	string file = "sample.dxf";
    
    	// create a new document, by default it will create an AutoCad2000 DXF version
    	DxfDocument doc = new DxfDocument();
    	// an entity
    	Line entity = new Line(new Vector2(5, 5), new Vector2(10, 5));
    	// add your entities here
    	doc.AddEntity(entity);
    	// save to file
    	doc.Save(file);
    
    	// this check is optional but recommended before loading a DXF file
    	DxfVersion dxfVersion = DxfDocument.CheckDxfFileVersion(file);
    	// netDxf is only compatible with AutoCad2000 and higher DXF versions
    	if (dxfVersion < DxfVersion.AutoCad2000) return;
    	// load file
    	DxfDocument loaded = DxfDocument.Load(file);
    }
    

      支持的实体

    • 3dFace
    • Arc
    • Circle
    • Dimensions (aligned, linear, radial, diametric, 3 point angular, 2 line angular, and ordinate)
    • Ellipse
    • Hatch (including Gradient patterns)
    • Image
    • Insert (block references and attributes)
    • Leader
    • Line
    • LwPolyline (light weight polyline)
    • Mesh
    • MLine
    • MText
    • Point
    • PolyfaceMesh
    • Polyline
    • Ray
    • Shape
    • Solid
    • Spline
    • Text
    • Tolerance
    • Trace
    • Underlay (DGN, DWF, and PDF underlays)
    • Wipeout
    • XLine (aka construction line)

    所有实体都可以分组。所有DXF对象都可能包含扩展数据信息。AutoCad表格图元将作为插入(块参照)导入。支持简单线型和复杂线型。库永远无法读取某些实体,如面域、曲面和三维实体,因为它们依赖于未记录的专有数据。

  • 相关阅读:
    sql server delete语句
    sql server 通配符
    sql server join联结
    windows下如何使用两个版本的nodejs
    PHP的Trait 特性
    PHP错误与异常处理try和catch
    laravel belongsTo()&hasOne()用法详解
    Laravel Model 的 fillable (白名单)与 guarded (黑名单)
    js原生,缓动动画封装
    js原生轮播图
  • 原文地址:https://www.cnblogs.com/NanShengBlogs/p/14584807.html
Copyright © 2020-2023  润新知