摘要
数控代码自动生成有助于提高数控编程的效率,降低编程难度,解决设计、生产过程自动化问题。本文对AutoCAD中二维图形和矢量汉字的雕刻机数控代码自动生成进行了研究。首先,对AutoCAD的DXF文件进行了研究,通过编程提取DXF文件中的图形实体数据,实现了G代码的自动生成。在图形实体数据的处理过程中,将圆(弧)与椭圆(弧)用直线进行了拟合,且建立数据链表,将处理后的数据存入链表。为方便G代码的输出,减少加工过程中的起落刀次数,在数据存入时采用了链表插入排序算法。然后,依据RT-4500雕刻机的数控加工代码将链表中的数据以G代码文本输出。为了验证生成的G代码的正确性,在Visual C++6.0中进行了数控加工程序的轨迹仿真,直观地显示了雕刻后的图形轨迹。其次,本课题研究了汉字中形文件(.shp)结构及其矢量汉字编码,通过编程提取矢量汉字的笔划数据,将获得的笔划数据整理并以G代码的格式输出。最后进行实例运行,将图形和汉字自动生成的G代码导入到RT-4500数控雕刻系统中进行雕刻,雕刻结果达到了预期效果。
NC code generated automatically is helpful for improving efficiency, reducing the difficulties for NC programming and solving the automation problems during the course of design and production process. The paper studies NC code generated automatically of engraving machine of 2D graphics and vector Chinese characters. First, DXF files from AutoCAD are studied and drawing entity data of DXF files are extracted by programming. Then, G code is generated automatically. In the process of dealing with drawing entity data, circle (or arc) and ellipse are fitted by lines. And the data-link is built to store to the data. Insertion-sorting algorithm of link is adopted while data are stored, which would be convenient for output of G code and reduce the number of up-and-down of cutter as well. And then, based on the NC processing programs of RT-4500 engraving machine, data in link are exported in the form of G code. In order to validate the correctness of G code, the NC processing programs are run to simulate trace in Visual C++6.0, which shows the trace of engraved clearly. Next, the paper studied the structure of shape files and coding of vector Chinese characters in detail. Strokes' data of vector Chinese characters are extracted by programming, and then pack up and export the data in the form of G code. Finally, examples are taken. The G code generated by graphics and vector Chinese characters are imported to RT-4500 engraving machine to engrave. The results are proved well as expected.
引文
[1] 黄毅宏,王春海,樊锐等.数字化加工技术[M].北京:化学工业出版社.2003.5
[2] 栗全庆.图形编程——数控加工自动编程技术的发展发向[J].组合机床与自动化加工技术,1996,No.5:36-39
[3] 于宏.基于AUTOCAD的数控自动编程系统的开发[D].东北大学硕士学位论文.2000.3
[4] J. Hartmann, H.Kuppeer and R.Klundere.Intergration of technological efficient NC-progamming systems in CAD/CAM systems for turning processes[J]. Advances in CAD/CAM. 1983,P203-210
[5] 蔡伯阳,林金明和谢明红.基于DXF文件的NC代码生成[J].现代制造工程,2002,No.2:20-21
[6] 赵后良,张俊.二维数控自动编程系统的设计[J].江苏机械制造与自动化,1997,No.2:32-34
[7] 李晶,骆明灯.SS-CADCAM微机零件CAD/CAM集成化系统[J].机械工程学报,1995,Vol.31,No.1:15-21
[8] 王建军,赵汝嘉.轴类零件数控自动编程系统[J].计算机辅助设计与制造,1996,No.7:25-27
[9] 王剑,郇极.AutoCAD支持下的数控车床自动编程系统[J].组合机床与自动化加工技术,1996,No.1:2-6
[10] 孔振宇,马骏,郑红,刘晋春.AutoCAD在字体轨迹自动编程方面的应用[J].机械与电子,1997(2):6-7
[11] 苏少卿.AutoCAD的字型文件(.shx)的结构和利用[J].计算机应用研究.1995(6):65-67
[12] 孟文,陈亚川.CAD矢量汉字系统的分析和开发[J].电脑与信息技术.1997(6):11-14
[13] 庄殿铮.AutoCAD2000大字体文件的格式分析[J].微机与应用.2002(7):48-52
[14] 王青松,面向对象的计算机数控雕刻控制软件的研制[D].浙江大学硕士学位论文,2001.2
[15] 袁绍渊.机床工业发展的成就和趋势[J].世界产品与技术,1998(4):30-32
[16] 张强.数控加工中心辅助编程系统的开发[D].哈尔滨工程大学硕士学位论文.2003.1
[17] 高青风,程国全,翁迅.从二维图形到数控代码自动编程的实现[J].工艺与装备.2005,No.3:73-74.
[18] 王静,连晓蕊.AutoCAD基础教程[M].北京:清华大学出版社.2004
[19] 陈为.基于AutoCAD二次开发的研究[J].计算机工程与应用,1997,No.1,39-42
[20] 向南平.图形交换文件初探[J].计算机应用研究.1991,No.5
[21] 杨素敏.AutoCAD2000定制与开发[M].人民邮电出版社 2000.6
[22] Can Cogun. NC parts programs generation from CAD exchange files[J]. Computer In Industry, Vol.20, No.2, 1992
[23] Pamas D.L.,J Madel.Functional Documents for Computer Systems[J]. Science of Computer Programming, 1995,(25):41-61
[24] 谭浩强编著.C程序设计(第二版)[M]。清华大学出版社。1997
[25] [美]Michael J.Young著,邱仲潘译.Visual C++6从入门到精通[M].电子工业出版社 2001.8
[26] 刘炜.关于AutoCAD与常用高级语言的图形接口问题[J].AutoCAD应用与开发.1990,No.2:33-35
[27] S.D. Jackson and R.O.Mittal. Automatic generation of 2-axis laser_cutter NC machine program and path planning from CAD[J]. Computer In Industry, 1993, Vol.21, No.2
[28] 董未名,严冬明,周登文,孙家广.基于CAD模型的直接快速成型软件[J].计算机辅助设计与图形学报,2004.3,16(3):361-363
[29] 刘卡林.面向加工中心的多轴数控加工仿真软件平台研究[D].哈尔滨工业大学博士学位论文,1995.4
[30] 魏志强,施平,冯开林.一种数控自动编程及数控代码仿真系统的设计[J].哈尔滨工业大学学报,1996,Vol.28,No.3:94-99
[31] 王强如,李兰友.C语言绘图与计算机仿真技术[M].北京航空航天大学出版社.1996
[32] 蔡云南.关于AutoCAD矢量字体和形文件[J].船舶.2002.4,No.2:60-63
[33] 龙素华.AutoCAD形文件的自动生成[J].扬州职业大学学报.1999.9,No.3:40-44
[34] 彭丹丹.高速高精度数控雕刻机控制技术的研究[D].合肥工业大学硕士学位论文,2005.5
[35] 王青松、傅建中.面向对象的计算机数控雕刻控制软件[J].机电一体化,2000(6):40-41
[36] 吴功才.基于RTLINUX的雕刻控制系统研究[D].河海大学硕士学位论文.2005.3