在vb.net里读写.dxf文件,最好有例程测试给的,并或去圆弧,直线,多断线,文本以及其他坐标详细
问题是什么呢?例子挺简单的,有源代码和二次开发文档可以用。支持的类型也很全,3dFace
Arc(圆弧)Circle Dimensions 、Ellipse、Hatch 、Image、Insert 、Leader、Line(直线)、LwPolyline 、Mesh
MLine、MText、Point、PolyfaceMesh、Polyline(多段线)、Ray、Shape、Solid、Spline、Text(文本)
Tolerance、Trace、Underlay (DGN, DWF, and PDF underlays)
Wipeout
XLine (aka construction line)
// 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.Entities.Add(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);
读取DXF文件实例
Public bool Import(string fileName)
{
try
{
DxfDocument doc_dxf = new DxfDocument();
doc_dxf = netDxf.DxfDocument.Load(fileName);
if(doc_dxf != null)
{
int line_count = doc_dxf.Lines.Count();
if(line_count > 0)
{
lineList.Clear();
foreach(netDxf.Entities.Line ln in doc_dxf.Lines)
{
lineList.Add(ln);
}
}
int n_arc = doc_dxf.Arcs.Count();
if(n_arc > 0)
{
arcList.Clear();
foreach(netDxf.Entities.Arc arc in doc_dxf.Arcs)
{
arcList.Add(arc);
}
}
//这里还有其他的图元,类似的操作还有很多,这里省略
//......
}
return true;
}
catch(netDxf.IO.DxfVersionNotSupportedException ex)
{
MessageBox.Show(ex.Message);
}
return true;
}