摘要数控加工中,保证NC 程序的正确性和刀具轨迹的准确性非常重要。数控程序不能直接运行在数控系统上,需要一个中间软件将程序代码转换成系统能识别的代码格式,而且数控源代码无法避免地会出现一些错误,需要对其进行词法和语法的检测。对于一些小的数控程序,人工检错尚能应付,但对于上千行上万行的数控程序,人工检查费时费力而且效率很低。本文基于 PC+运动控制卡开放式数控系统,针对上述问题,设计出一个通用的数控代码编译软件,具有词法、语法检错、代码编译和显示刀具轨迹功能。 首先,本文分析了课题的意义,对国内外研究现状和存在问题进行介绍和分析。针对该领域存在的问题,本论文提出基于正则表达式的、具有面向对象思想的 NC 编译器解决方案。 接着从数控代码的结构入手,研究正则表达式的判定内容。并通过国家标准,分析了数控程序常见的词法和语法错误。程序的设计逻辑分为词法分析、语法分析和编译绘图三个部分。 软件用.NET4.5作为软件框架,C++/CLI作为开发语言,Visual Studio 2013 作为开发平台。本文将简要介绍NC 代码编译器的开发内容并重点介绍三个功能模块的实现过程。本次课题设计的NC代码编译器,可以迅速精确地找出NC程序的所有词法语法错误,并提示用户进行改正。对于正确的 NC 代码,会快速地生成其加工信息,用户将得到关于刀具轨迹和机床状态的全部信息,并以动画方式呈现。 25137
毕业论文关键词:NC 编译器,正则表达式,代码检错,路径仿真
Title The Design of NC Code Complier Based on Regular Expression
Abstract
In the process of NC machining, it is very important to ensure the validity of NC program and
the accuracy of tool path. Meanwhile, the NC system cannot carry out the NC program directly,
which means a NC complier is needed to translate the NC code into the format identified by
computer. In addition, the error in NC code is inevitable, which means a lexical check and a
syntactic check is necessary. It is possible to check the short programs manually, but for the large
programs, Converting manually takes a very long time. This article is based on open NC system
built by PC & Motion controller. To solve the problems above, I design a general NC complier
whose function is powerful, including lexical, syntactic and semantic analysis.
First, this essay investigates the development of the NC code complier, introducing and
analyzing its actuality and existing problems at home and abroad. Aimed at the problems in this
field, A solution based on regular expression and object-oriented thought is proposed.
Then I look into the structure of NC code, and decide what the regular expression contains.
Normal error in NC code is concluded by referring to the national standard. The NC complier is
pided into three parts: lexical analysis, syntactic analysis and semantic analysis/drawing.
This program is based on .NET Framework 4.5, programmed by C++/CLI, whose IDE is Visual
Studio 2013. This essay briefly introduces the code context and emphasizes on the
implementation process of three functional modules.
The NC code complier designed in this project is able to find all lexical and syntactic error
accurately and remind users to correct them. If the code is correct, the complier will generate the
machining information rapidly and show the users all information about the tool path and
machine condition in picture and animation.
Keywords: NC complier, regular expression, code check, path simulation
目录
1 绪论 .. 1
1.1 概述 . 1
1.2 本文研究意义 1
1.3 数控代码编译技术的研究方法 .. 2
- 上一篇:基于表面弹性的绵蚕识别技术研究
- 下一篇:基于Ublox GPS模块差分定位技术研究
-
-
-
-
-
-
-
java+mysql车辆管理系统的设计+源代码
酸性水汽提装置总汽提塔设计+CAD图纸
中考体育项目与体育教学合理结合的研究
杂拟谷盗体内共生菌沃尔...
当代大学生慈善意识研究+文献综述
大众媒体对公共政策制定的影响
电站锅炉暖风器设计任务书
河岸冲刷和泥沙淤积的监测国内外研究现状
十二层带中心支撑钢结构...
乳业同业并购式全产业链...