C# 读取DXF文件

上传人:cl****1 文档编号:541718153 上传时间:2023-08-08 格式:DOC 页数:17 大小:71KB
返回 下载 相关 举报
C# 读取DXF文件_第1页
第1页 / 共17页
C# 读取DXF文件_第2页
第2页 / 共17页
C# 读取DXF文件_第3页
第3页 / 共17页
C# 读取DXF文件_第4页
第4页 / 共17页
C# 读取DXF文件_第5页
第5页 / 共17页
点击查看更多>>
资源描述

《C# 读取DXF文件》由会员分享,可在线阅读,更多相关《C# 读取DXF文件(17页珍藏版)》请在金锄头文库上搜索。

1、using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.IO;using System.Collections;namespace DXF public partial class Form1 : Form private FileStream fs; private StreamReader sr; priva

2、te ArrayList LayerList = new ArrayList(); private ArrayList LineList = new ArrayList(); private ArrayList ArcList=new ArrayList(); private ArrayList EllipseList = new ArrayList(); private ArrayList LwopolylineList = new ArrayList(); private ArrayList SplineList=new ArrayList(); private string str =

3、new string2; private int count; private double leftx; private double lefty; private double rightx; private double righty; public Form1() InitializeComponent(); private string ReadPair() string code = sr.ReadLine().Trim(); string codedata = sr.ReadLine().Trim(); count += 2; string result = new string

4、2 code, codedata ; return result; private void Read() while (sr.Peek() != -1) str = ReadPair(); if (str1 = SECTION) str = ReadPair(); switch (str1) case HEADER: ReadHeader(); break; case TABLES: ReadTable(); break; case ENTITIES: ReadEntities(); break; sr.Close(); fs.Close(); btDraw.Enabled = true;

5、label1.Text = count.ToString(); count = 0; private void ReadTable() while (str1 != ENDSEC) while (str0 != 2 | str1 != LAYER) str = ReadPair(); while (str0 != 0 | str1 != LAYER) str = ReadPair(); while (str0 = 0 & str1 = LAYER) ReadLAYER(); while (str1 != ENDSEC) str = ReadPair(); private void ReadLA

6、YER() LAYER newlayer = new LAYER(); while (str1 != ENDTAB) str = ReadPair(); switch (str0) case 2: newlayer.name = str1; break; case 62: newlayer.colornum = str1; break; case 6: newlayer.lstyle = str1; break; case 370: newlayer.lwidth = str1; break; if (str0 = 0 & str1 = LAYER) LayerList.Add(newlaye

7、r); return; LayerList.Add(newlayer); private void ReadEntities() while (str1 != ENDSEC) switch (str1) case LINE: ReadLine(); break; case ARC: ReadArc(); break; case CIRCLE: ReadArc(); break; case ELLIPSE: ReadEllipse(); break; case LWPOLYLINE: ReadLwpolyline(); break; case SPLINE: ReadSpline(); brea

8、k; default: str = ReadPair(); break; private void ReadArc() ARC newarc = new ARC(); while (str1 != ENDSEC) str = ReadPair(); switch (str0) case 8: newarc.LName = str1; break; case 10: newarc.CenterX = Double.Parse(str1); break; case 20: newarc.CenterY = Double.Parse(str1); break; case 40: newarc.Radiu = Double.Parse(str1); break; case 50: newarc.SAngle = Double.Parse

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 电子/通信 > 天线/微波/雷达

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号