版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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; priv
2、ate 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 st
4、ring2 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 =
5、 true; 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
6、void readlayer() layer newlayer = new layer(); while (str1 != endtab) str = readpair(); switch (str0) case 2: = 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) layerli
7、st.add(newlayer); 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: r
8、eadspline(); break; 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;
9、 case 40: newarc.radiu = double.parse(str1); break; case 50: newarc.sangle = double.parse(str1); break; case 51: newarc.eangle = double.parse(str1); break; case 370: newarc.lwidth = str1; break; case 0: arclist.add(newarc); return; private void readline() line newline = new line(); while (str1 != en
10、dsec) str = readpair(); switch (str0) case 8: newline.lname = str1; break;精品. case 10: newline.startx = double.parse(str1); break; case 20: newline.starty = double.parse(str1); break; case 11: newline.endx = double.parse(str1); break; case 21: newline.endy = double.parse(str1); break; case 62: newli
11、ne.colornum = str1; break; case 370: newline.lwidth = str1; break; case 0: linelist.add(newline); return; private void readellipse() ellipse newellipse = new ellipse(); while (str1 != endsec) str = readpair(); switch (str0) 精品. case 8: newellipse.lname = str1; break; case 10: newellipse.centerx = do
12、uble.parse(str1); break; case 20: newellipse.centery = double.parse(str1); break; case 11: newellipse.deltax = double.parse(str1); break; case 21: newellipse.deltay = double.parse(str1); break; case 40: newellipse.radio = double.parse(str1); break; case 41: newellipse.psangle = double.parse(str1); b
13、reak; case 42: newellipse.peangle = double.parse(str1); break; case 370: newellipse.lwidth = str1; break; case 0: ellipselist.add(newellipse); return; private void readlwpolyline() 精品. lwpolyline newlw = new lwpolyline(); while (str1 != endsec) str = readpair(); switch (str0) case 8: newlw.lname = s
14、tr1; break; case 370: newlw.lwidth = str1; break; case 62: newlw.colornum = str1; break; case 90: newlw.pointcount = int32.parse(str1); break; case 70: newlw.flag = int32.parse(str1); break; case 10: newlw.pointx = new doublenewlw.pointcount; newlw.pointy = new doublenewlw.pointcount; /if (newlw.fla
15、g = 1) newlw.converxity = new doublenewlw.pointcount; /else /newlw.converxity = new doublenewlw.pointcount - 1; newlw.pointx0 = double.parse(str1); str=readpair(); newlw.pointy0 = double.parse(str1); for (int i = 1; i newlw.pointcount; i+)精品. string temp = sr.readline().trim(); if (temp = 42) newlw.
16、converxityi - 1 = double.parse(sr.readline().trim(); i-; else if (temp = 20) string r = sr.readline().trim(); newlw.pointyi = double.parse(r); else string r = sr.readline().trim(); newlw.pointxi = double.parse(r); i-; string s = sr.readline().trim(); if (s = 42) newlw.converxitynewlw.pointcount - 1
17、= double.parse(sr.readline().trim(); else if (s = 0) sr.readline(); lwopolylinelist.add(newlw);精品. return; else sr.readline(); break; case 0: lwopolylinelist.add(newlw); return; public void readspline() spline newspline = new spline(); while (str1 != endsec) str = readpair(); switch (str0) case 8: n
18、ewspline.lname = str1; break; case 370: newspline.lwidth = str1; break; case 62: newspline.colornum = str1; break; case 70: newspline.flag = int32.parse(str1); break;精品. case 74: newspline.count = int32.parse(str1); newspline.throughpx = new doubleint32.parse(str1); newspline.throughpy = new doublei
19、nt32.parse(str1); break; case 12: newspline.svertorx = double.parse(str1); break; case 22: newspline.svertory = double.parse(str1); break; case 13: newspline.evertorx = double.parse(str1); break; case 23: newspline.evertory = double.parse(str1); break; case 11: newspline.throughpx0 = double.parse(st
20、r1); str = readpair(); newspline.throughpy0 = double.parse(str1); str = readpair(); for(int i=1;inewspline.throughpx.length;i+) str=readpair(); if(str0=11) newspline.throughpxi=double.parse(str1); i-; else if(str0=21) 精品. newspline.throughpyi=double.parse(str1); i-; if(newspline.flag=11) for(int i=0
21、;i3;i+) str=readpair(); break; case 0: splinelist.add(newspline); return; public void readheader() while (str1 != endsec) str = readpair(); switch (str1) case $extmin: str = readpair();精品. leftx = double.parse(str1); str = readpair(); lefty = double.parse(str1); break; case $extmax: str = readpair()
22、; rightx = double.parse(str1); str = readpair(); righty = double.parse(str1); break; /打开dxf文件 private void btopen_click(object sender, eventargs e) btdraw.enabled = false; layerlist.clear(); linelist.clear(); arclist.clear(); ellipselist.clear(); lwopolylinelist.clear(); splinelist.clear(); this.ope
23、nfiledialog1.showdialog(); if (this.openfiledialog1.filename.trim() != ) 精品. string path = this.openfiledialog1.filename; fs = new filestream(path, filemode.open, fileaccess.read); sr = new streamreader(fs); read(); private void btdraw_click(object sender, eventargs e) double width = math.ceiling(rightx) - math.ceiling(leftx) + 40; double height = math.ceiling(righty) - math.ceiling(lefty) + 40; bitmap bmp = new bitmap(int)width, (int)height); graphics gx = graphics.fromimage(bmp); double
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2021年银行从业资格(中级)《公司信贷》考试多选题题库及答案解析
- 重庆三峡学院《巧固球》2023-2024学年第一学期期末试卷
- 重庆人文科技学院《国际法》2022-2023学年期末试卷
- 重庆人文科技学院《风景园林设计》2022-2023学年第一学期期末试卷
- 重庆三峡学院《化工过程分析与合成》2022-2023学年第一学期期末试卷
- 安全员、消防员内务管理规程
- 重庆三峡学院《钢结构原理》2023-2024学年第一学期期末试卷
- 重庆三峡学院《电气测试技术综合设计》2022-2023学年期末试卷
- 重庆人文科技学院《史记》2023-2024学年第一学期期末试卷
- J1113压铸机操作规程
- 公司公务车辆管理规定培训课件
- 儿科学9循环系统疾病
- 体质测试成绩表(自动统计数据)(小学、初中)
- 【基于杜邦分析体系的企业盈利能力分析文献综述及理论基础2700字】
- 医患沟通的法律基础
- 私立民办小学、初中、高中学校建设可行性项目投资计划书
- 分娩镇疼的护理课件
- 妊娠合并精神抑郁护理查房
- 项目研发商业计划书
- 软件使用授权书
- 肥料、农药采购服务方案(技术方案)
评论
0/150
提交评论