雕刻机毕业设计外文文献翻译

雕刻机毕业设计外文文献翻译
雕刻机毕业设计外文文献翻译

雕刻机毕业设计外文文献翻译

附录1 外文翻译-原文部分

DXF File Identification with C# for CNC Engraving Machine System Huibin Yang, Juan Yan

Abstract

This paper researches the main technology of open CNC engraving machine,the DXF identification technology. Agraphic information extraction method is proposed. By this method,the graphic information in DXF file can be identified and transformed into bottom motion controller’s code. So the engraving machine can achieve trajectory tracking. Then the open CNC engraving machine system is developed with C#. At last, the method is validated on a three axes motion experiment platform. The result shows that this method can efficiently identify the graphic information including line, circle, arc etc. in DXF file and the CNC engraving machine can be controlled well. Keywords

DXF, CNC Engraving Machine , GALIL,C#

1.Introduction

With the development of pattern recognition techniques, modern CNC engraving machine needn’t be programmed manually. By importing graphics file, the corresponding shape will be engraved by the machine immediately. The operating process of the machine is simplified enormously, and the rich programming knowledge is no longer need for operators. Among them, DXF

identification is a key technology of CNC engraving machine. By reading and recognition of the DXF file, the machining track can be directly generated, so the motion control of the CNC engraving machine can be achieved.

2. Research Status

Researchers have done a lot of researches on how to contact CAD software to NC code. Omirou and Barouniproposed a series of machine codes, with which the advanced programming ability is integrated into the control of modern CNC milling machine system [1]. Kovacic and Brezocnik proposed the concept of which using the genetic algorithm to program the CNC machine based on the CAD model under manufacturing environment [2].But some problems are still existed in this kind of CNC programming (such as the artificial participation degree is higher and the efficiency is lower).

The research direction of Chinese researchers mainly includes two aspects. One is the theoretical study of DXF file and NC machining, the other is the application of DXF file reading. ZhaiRui and Zhang Liang proposed a program structure, which is used to read data information of DXF file and do some preprocess based on the cross platform open source library DXF Lib by the analysis of DXF file structure characteristic [3]. Huang Jieqiong and Yuan Qun wrote the interface program to read the stored parts graphic information in DXF file by use of the object-oriented secondary development tools, Object ARX and C++, in the research of stamping parts machining. The stamping parts geometric model is automatically created by the automatic generation

algorithm of closed contour [4].

3. DXF File and Graphic Information Extraction

3.1. DXF File

DXF (Drawing Exchange File) is a representation of all information labeled data contained in the AutoCAD graphics file, and the ASCII or binary file format of AutoCAD file. It can be used as input/output interface and graphics file exchange between AutoCAD and other graphics applications [5].A complete DXF file is composed of six segments called SECTION. These segments were HEADER,CLASSES, TABLES, BLOCKS, ENTITIES and file ending character (group code is 0,group value is EOF)

3.2. Graphic Information Extraction Method

In order to extract useful information of the graphic, many parts in the file can be ignored. The corresponding geometric description can be completed as long as the sections of TABLES,BLOCK, ENTITIES are obtained. Each graphic element in the DXF file are stored with a fixed format, so it is convenient for data exchange, and also called its readability. The characteristics of each individual graphic element in DXF file is described by the parameter (group) consisted by paired group code and group value. Therefore, according to the target of open CNC engraving machine, it is enough to describe the target geometry contour by reading the ENTITIES section in DXF files only. The particular identification process is: First search the DXF file until the “ENTITLES” is found, then build a graphic element object. Then search the graphic element type (LINE, CIRCLE, ARC),and search the corresponding value followed by the group code. For example, if the program has found the ENTITLES section and confirm the first graphic element is LINE (The program found “LINE” after “ENTITLES”). Then it will search the group code which represents the

parameters of the line. The number at the next line after the group code is the value of the parameter.(e.g. The number at the next line after “10” represent the X value of start point of this line, and “20” for Y value of start point,“11” for X value of end point,“21” for Y value of end point, etc.). Table 1 shows an example of an ENTITIES section. Table 1 shows an example of an ENTITIES section.

By getting these parameters and values, system then “sees” the graph and “knows” the specific parameters of the graph which is drew by AutoCAD. Figure 1 is the flow diagram of extraction of graphic information. Table 1 shows an example of an ENTITIES section.

3.3. C# Realization of Graphic Information Extraction

In order to store the graph data, the convenient method is to store numeric variables by using array, and it is also very convenient for call and assignment operation. First define a 2D array:

s[i,j] (i <= 100,j <= 20),define a 100 lines and 20 lows array at initialization, in which, every line i stores a graphic element, every element j in a line stands for the value after the group code. The format and meaning are shown in Table 2 Then, the graphic element storage state is s[i,0],s[i,1],???,s[i,15] (I = 0,1,2,???).The advantage of this design is: For each graphic element, all the geometric elements associated with the trajectory can be stored in an array variable space which has a fixed serial number. It is convenient and not easy to make mistakes in the calculation or logical judgment. But to any entire graphics trajectory, the number of lines or curves is not consistent, so it is important to apply for enough variable memory space to adapt to different requirements of graphics trajectory. Part of the C# program of reading arc graphic element in DXF are as follows:

do

{

Line = mysr. ReadLine ();

if (Li ne == “ENTITIES”)

{

……

if (Line == “10”)

{

Line = mysr.ReadLine();

string m;

m = Line;

double n;

n = Convert.ToDouble(m);

s[i,j] = n;

j++;

}

……

} while (Line! = null)

4. Graphics Trajectory Generation

To open CNC engraving machine,the key point is how to convert the graphic element information in DXF file into motion controller code, so as to control the machine’s motion according to the machining trajectory.

4.1. DXF Analysis Principle

The so-called DXF analysis is the standardization of each graphic element

which has been read in order to according with the standard instructions of motion controller. Considering the basic type of graphic element is line, circle or arc, the standardization requirements of different graphic element type are different. The specific principles are as follows:

1) LINE

Line has only start and end point coordinate. the actual useful memory space is s[i,0],s[i,1],…,s[i,6],other parts are all zero.

2) ARC

As the format of arc in the DXF is include the center coordinates value, radius, start angle and end angle. So the center coordinates value, radius, start angle and end angle can be recognized and stored in s[i,7],s[i,8],…,s[i,12] .But for the GALIL DMC2143 motion controller which is used in the open CNC engraving machine,the arc instruction requires start and end point coordinate and rotation angle of the arc. So, the analysis of arc includes two aspects: a) Calculate the start and end point coordinate. b) Calculate the rotation angle and store in s [i,15].

3) CIRCLE

Because the r otation angle of circle is 360?,it can be set as a fixed value. For the sake of convenience, the starting position of circle is set to the left or right quadrantal points.

4.2. DXF Analysis Method

According to 3.1, the difficulty of graphic element analysis is arc. Although

the information in DXF file can confirm geometry feature, for the track sequencing, the start and end point coordinates are needed; and for the motion controller programs, it also need to change the format for direct connection. By four elements of center, radius, start angle and end angle as well as simple trigonometric function calculation, the start and end point position as well as the rotation angle of the arc can be determined. For example, if center of the arc is o(x0,y0),radius is r, start angle is θ (0 < θ < 90?) and end angle is δ (0 < θ < 90?),according to the parametric equation of

the circle, the start point a(x1,y1),end point b(x2,y2),and rotation angle ε can be calculated using Equation (1) to Equation (3):

5. Development of Open CNC Engraving Machine System

The hardware of the open CNC engraving machine system includes a motion controller and an upper computer (PC). The real-time control of the CNC engraving machine body is done by the motion controller. The main task of the motion controller is servo motor control and IO logic control. The PC runs The DXF analysis algorithm, Human-Machine Interface (HMI) and sends the motion control instructions got from the DXF analysis algorithm to the motion controller, so the engraving machine can be controlled. The software of the system includes PC program and motion controller program.

5.1. PC Program

The PC program includes HMI and DXF analysis program running in the background. DXF analysis program are mainly programmed based on DXF analysis principles and methods on 3.

5.2. Program Design of Motion Controller

In this design, the subprograms of linear and circular interpolation are programmed in GALIL motion controller. According to the results of DXF analysis in PC, call different subprogram in proper order and assign variable, the continuous tracking trajectory can be realized. The linear interpolation program of GALIL motion controller is as follows:

#LINEAR

MT 2,2

VMAB

VS 5000

VA 100000

VD 100000

VP X,Y

VE

BGS

EN

6. Test Running Result

By C#, the authors first finished the DXF file identification as well as the

extraction and storage of graphic element information. The graphic element ordering operations were also achieved. At last,the graphics trajectories were generated by calling the bottom GALIL software instructions and achieved motion tacking. The test was carried out on a three axes motion experiment platform, the carving cutter was replaced with pen. Pen was fixed on the experiment platform. The test used a trajectory graph drawn by AutoCAD. The final result shows that the developed open CNC engraving machine system can accurately complete the identification of DXF file, and the walk path is consistent with the CAD file.

References

[1] Omirou Sotiris,L. and Barouni Antigoni,K. ( ) Integration of New Programming Capabilities into a CNC Milling

System. Robotics and Computer-Integrated Manufacturing,21,518-527.

[2] Kovacic,M.,Brezocnik,M.,Pahole,I.,Balic,J. and Kecelj,B. ( ) Evolutionary Programming of CNC Machines.

Journal of Materials Processing Technology,164-165,1379-1387.

[3] Zhai,R. and Zhang,L. ( ) Reading Frame Design Based on the DXF File Format. Fujian Computer,4,107-109.

[4] Huang,J.Q. and Yuan,Q. ( ) Automatic Input and Identification for Stamping Graph Based on AutoCAD. Machinery Design & Manufacture,2,82-84.

[5] Bai,X.C. and Chen,Y.M. ( ) Automatic Programming of Bridge Cutting Machine Based on the DXF File. Equipment Manufacturing Technology,2,110-

112.

附录2 外文翻译-中文部分

利用C#识别DXF文件的数控雕刻机系统

Huibin Yang, Juan Yan

摘要

本文研究开放式数控雕刻机的关键技术,即DXF识别技术。图形信息提取方法被提出。经过这种方法,在DXF文件中的图形信息能够被识别和转换为运动控制器底部的代码。因此,雕刻机能够实现轨迹跟踪。然后利用C#对放数控雕刻机系统进行开发,最后在一个三轴运动的实验平台上对这个方法进行验证。结果表明该方法能够有效地识别DXF文件中的线、圆、弧等图形信息,而且数控雕刻机能够被控制得很好。

关键字:DXF;数控雕刻机;GALIL;C#

1 介绍

随着模式识别技术的发展,现代数控雕刻机不必手动编程。经过导入图形文件,相应的形状就会被雕刻机立即雕刻出来.极大的简化了雕刻机的

操作过程,使得操作者不再需要丰富的编程知识。其中,DXF识别是数控雕刻机的关键技术。经过阅读和识别DXF文件,能够直接生成加工轨迹,实现对数控雕刻机的运动控制。

2 研究现状

研究人员已经做了大量研究如何将CAD软件与NC代码联系起来。Omirou和Barouni提出一系列机器代码,经过先进的编程能力集成到现代数控铣床的控制系统中。Kovacic和Brezocnik提出运用遗传算法去给基于CAD模型在制造环境下的数控机床编程的理论,可是用这种数控编程的方法也存在很多的问题(例如人工参与程度高但效率低)。

中国研究人员的研究方向主要包括两个方面,一个是DXF文件和数控加工的理论研究,另一个是读取DXF文件的应用程序。翟睿和张良提出一个用于读取DXF文件的数据信息和做一些基于跨平台开源库DXF的DXF 文件结构特点分析的预处理的程序结构。黄洁琼和元群编写使用面向对象的二次开发工具来读取存储部分图形信息的DXF文件的接口程序,以ARX 和C++为对象来研究冲压件的加工。冲压件的几何模型运用封闭轮廓的自动生成算法来自动创立。

3 DXF文件和图形信息提取

3.1 DXF文件

DXF(图纸交换文件)表示所有的被标记的信息包含在AutoCAD的图形文件和ASCII或二进制格式文件中,它能够用作输入/输出接口和图形文件在AutoCAD和其它图形应用程序之间转换。一个完整的DXF文件由六个被称作SECTION的段组成,这六段分HEADER,CLASSES,TABLES,

BLOCKS,ENTITIES和文件结束字符(组代码为0,组值为EOF)。DXF文件每一段的结构和含义如图1所示。

记录在AutoCAD系统中

所有的标题变量的、当

包括所有应用程序定义

的类信息。大部分信息

包括四个表。每个表包含一个数

量可变的条目。根据这些表在文

记录块名称、当前层的名字、

块类型、块插入基点和所有已

使用点、线、圆、弧,包括实体

与块的关联数据来定义实际的

图1 DXF文件结构

3.2 图形信息提取方法

为了提取图形中的有用信息,在文件中的许多地方能够忽略。只要获得了表、块、实体的部分就能够做出对应的几何描述。每个在DXF文件中的图形元素都被存储为一个固定的格式,因此它的数据交换非常的方便,这也被称为它的可读性。每个在DXF文件中的图形元素的特征用配对组代码和组值等参数来描述。因此,根据开放式数控雕刻机锁定目标,它足以经过读取DXF文件中的实体部分来描述目标的几何轮廓。其特定的识别过

程是:首先搜索DXF文件,直到找到“ENTITLES”,然后构建一个图形元素对象。然后搜索图形元素类型(线、圆、弧)和紧随其后的组织代码的值。例如,如果程序发现ENTITLES部分并确认第一个图形元素是LINE (程序发现“LINE”在“ENTITLES”之后)。然后它将搜索组代码代表的参数。组代码后下一行的数字就是参数的值。(如:下一行的数字“10”代表这一行的起始点的X值,“20”代表起始点的Y值,“11”代表这一行终点的X值,“21”代表这一行终点的Y值等)。表1为ENTITIES部分的一个例子。

经过这些参数和值,系统就能“看到”图形并“知道”所画的AutoCAD图的具体参数。

表1 ENTITIES部分举例

DXF文件的部分解释

ENTITIES 段名称

0 组代码

LINE 图形元素类型

10

50.0 起始点X的值

20

100.0 起始点Y的值

30

0.0 起始点Z的值

11

350.0 终点X的值

21

500.0 终点Y的值

31

0.0 终点Z的值

ENDSEC 段结束符

3.3 C#实现图形信息提取

为了存储图形数据,较为方便的方法是使用数组来存储数字变量,也便于调用和赋值操作。首先定义一个二维数组:

s[i,j] (i <= 100,j <= 20),定义一个100行和20个低点的初始化数组,每一行的i存储一个图形元素,在每一行的元素j代表组代码的值。格式各意义如表2。

然后,图形元素存储状态是s[i,0],s[i,1],???,s[i,15] (I = 0,1,2,???)。

这种设计的优点是:对于每一个图形元素,所有几何元素与轨迹能够存储在一个有固定的序列号的数组变量空间。在计算或逻辑判断时既方便又不容易犯错误。但对于整个图形轨迹,直线或曲线的数量并不一致,因此重要的是要有足够的变量内存空间来适应不同图形轨迹的需求。

部分阅读DXF文件中的图形元素的C#程如:

do

{

Line = mysr. ReadLine ();

if (Line == “ENTITIES”)

{

……

if (Line == “10”)

{

Line = mysr.ReadLine();

string m;

m = Line;

double n;

n = Convert.ToDouble(m);

s[i,j] = n;

j++;

}

……

} while (Line! = null)

表2 数据存储格式表

数组变量的位置数据的含义

[i, 0] 属性标志:1代表线,2代表圆,3代表弧

[i, 1] 起点的X轴坐标值

[i, 2] 起点的Y轴坐标值

[i, 3] 起点的Z轴坐标值

[i, 4] 终点的X轴坐标值

[i, 5] 终点的Y轴坐标值

[i, 6] 终点的Z轴坐标值

[i, 7] 一个圆或弧的中心的X轴坐标值

[i, 8] 一个圆或弧的中心的Y轴坐标值

[i, 9] 一个圆或弧的中心的Z轴坐标值

[i, 10] 一个圆或弧的半径值

[i, 11] 弧的起始角

[i, 12] 弧的终点角

[i, 13] 后续数据识别序号的排序过程

[i, 14] 给后续操作

[i, 15] 给后续操作

4 图形轨迹生成

要使数控雕刻机运转起来,关键是如何把DXF文件中的图形元素信息转化为运动控制器代码,以便根据运动轨迹来控制机器的运动。

4.1 DXF分析原理

所谓的DXF分析就是把每个已阅读的图形元素标准化为符合标准的运动控制器的指令。考虑图形元素的基本类型是线,圆形和弧形,不同类型的图形元素的标准化是不同的。具体原则如下:

1) 线

线只有开始和结束点坐标.实际有用的内存空间s[i,0],s[i,1],…,s[i,6],其它部分都是零。

2) 弧

在DXF中弧的格式包括中心坐标的值,半径,开始角度和结束角度。中心坐标的值,半径,起始角度和结束角能够识别和存储在s[i,7],s[i,8],…,s[i,12]中。但对于用于开放式数控雕刻机的GALIL DMC2143运动控制器,弧指令需要开始和结束点的坐标和弧的旋转角度.因此弧的分析包括两个方面:1)计算开始和结束点坐标。2)计算旋转角度并存储在s [i,15]中。

3) 循环

因为圆的旋转角是360?,它能够设置为一个固定值.为了方便,循环的起始位置设为左边或者右边的象限点。

4.2 DXF分析方法

根据3.1知,图形元素分析最困难的是弧。尽管DXF文件中的信息能够确定几何特性,跟踪测序,获得需要的开始和结束点的坐标和运动控制器程序,但需要改变格式来直接连接。中心、半径、开始角度和结束角度这四种元素能够利用简单的三角函数来计算,开始和结束点的位置以及弧的旋转角度就能够确定。例如:如果弧中心是o(x0,y0),半径为r,开始角是θ(0 <θ< 90?)和结束角是δ(0 <θ< 90?),根据圆的参数方程,起点a(x1,y1),终点b(x2,y2),和旋转角ε能够使用方程(1)到方程(3)来计算:

相关文档
最新文档