中华DIY论坛

标题: EMC2_User_Manual(翻译) [打印本页]

作者: 大花猫    时间: 2016-9-23 10:37
标题: EMC2_User_Manual(翻译)
作者:dennis丁雷 QQ:1160577904E-mail:dinglei618@hotmail.com
博客地址:http://blog.sina.com.cn/u/2370524133
第 1 章  前言 Foreword
EMC2 is modular and flexible. These attributes lead many to seeit as a confusing jumble of little
things and wonder why it is the way it is. This page attempts to answer thatquestion before you
get into the thick of things.
    EMC2是模块化设计的,柔性很强。很多人都觉得它是由一些令人迷惑的小东西堆叠而成,很奇怪它是怎样
做到的。那么在进入实质内容以前,让我们首先试图回答这个问题。
EMC started at the National Institute of Standards andTechnology in the USA. It grew up using
Unix as it’s operating system. Unix made it different. Among early Unixdevelopers there grew a set
of code writing ideas that some call the Unix way. These early EMC authorsfollowed those ways.
    EMC项目起源于NIST(美国国家标准与技术研究院)。它起初是在Unix操作系统下运行的,这使它与众不同。
早期Unix开发者规定了一些代码编写的原则或方法,称为Unix编程方法(Unix way),EMC项目的作者们遵循了这
些方法。
Eric S. Raymond, in his book The Art of Unix Programming, summarizesthe Unix philosophy
as the widely-used engineering philosophy, "Keep it Simple, Stupid"(KISS Principle).
He then describes how he believes this overall philosophy is applied as acultural Unix
norm, although unsurprisingly it is not difficult to find severe violations ofmost of the
following in actual Unix practice:
* Rule of Modularity: Write simple parts connected by clean interfaces.
* Rule of Clarity: Clarity is better than cleverness.
* Rule of Composition: Design programs to be connected to other programs.
* Rule of Separation: Separate policy from mechanism; separate interfaces fromengines.
    EricS. Raymond在他的著作《The Art ofUnix Programming》中把Unix的哲学上升为普遍适用的工程哲学,
即“KISS原则”(Keepit Simple, Stupid)(保持简单化、傻瓜化)。然后他描述了这个KISS原则和Unix规范
之间的文化纽带,尽管他也明明知道在Unix的编程实践中找到违反这些规则的例子代码也是不困难和不令人惊奇
的。
    模块化原则:写出具有清晰接口的简单模块。
    简洁性原则:简洁比聪明更重要。
    组合性原则:设计程序是为了和其它程序对接。
    分离性原则:把策略从机制中分离出来,把接口从上分离出来。(译者注:这句太难懂了,个人理解:从面
向对象的角度说,就是把解决问题的方法和问题本身分离,也就是方法和数据分离;然后把接口从方法中分离出
来。)
Mr Raymond offered several more rules but these four describeessential characteristics of the EMC2
motion control system.
    Raymond先生还提出了一些其它的原则,但这四个原则就是EMC2运动控制系统最重要的特征。
The Modularity rule is critical. Throughout these handbooks youwill find talk of the interpreter or
task planner or motion or HAL. Each of these is a module or collection ofmodules. It’s modularity
that allows you to connect together just the parts you need to run yourmachine.
    模块化原则是最关键的原则。纵观EMC2系列手册,你会发现无论是G代码解释器、任务规划器、运动控制器,还
是硬件抽象层(HAL),它们都是模块或模块的集合。模块化使你能把需要的功能集成起来构成一个系统,而不需要
的部分则可以去掉。
The Clarity rule is essential. EMC2 is a work in progress – itis not finished nor will it ever be. It is
complete enough to run most of the machines we want it to run. Much of thatprogress is achieved
because many users and code developers are able to look at the work of othersand build on what
they have done.
    简洁性原则是最重要的原则。EMC2项目已经可以在很多机器系统上运行,但它仍然是一个正在进行的项目,它
永远也不会停止。EMC2的成功归功于许多用户以及代码开发人员。由于遵守了简洁性编程的原则,人们才能够互相
看到彼此的工作,并很容易的理解代码以及为其添加新的内容。
The Composition rule allows us to build a predictable controlsystem from the many modules
available by making them connectable. We achieve connectability by setting upstandard interfaces
to sets of modules and following those standards.
    组合性原则促使开发人员为模块提供可连接性,这样使用人员就可以从许多模块中只选择他们需要的模块来构
成目标系统。EMC2的组合性是通过标准的接口以及符合该接口标准的模块实现的。
The Separation rule requires that we make distinct parts that dolittle things. By separating functions
debugging is much easier and replacement modules can be dropped into the systemand
comparisons easily made.
    分离性原则要求开发人员尽量分解系统功能,并用不同的部件实现它们。这么做的好处一是便于调试,二是可
以方便的比较同一功能的不同实现(因为它们有相同的接口,可以很容易的组合进系统中进行测试)。
What does the Unix way mean for you as a user of EMC2. It meansthat you are able to make choices
about how you will use the system. Many of these choices are a part of machineintegration, but many
also affect the way you will use your machine. As you read you will find manyplaces where
you will need to make comparisons. Eventually you will make choices, "I’lluse this interface rather
than that” or, “I’ll write part offsets this way rather than that way."Throughout these handbooks
we describe the range of abilities currently available.
    那么Unix规范对于使用者又意味着什么呢?它意味着你可以选择怎样配置EMC2系统的功能以适应你的数控系统,
也就是说配置EMC2系统是设计数控机床工作的一部分。同时EMC2的某些功能或配置又反过来影响你设计数控机床的
方法和过程。在阅读系列手册的过程中,你会一边看一边比较,最后你可能说:“我将使用这个接口而不使用那个
接口”,或者“我将这样使用部件偏移而不会那样使用”。继续看下去吧,在系列手册中,我们将讨论所有这些功
能和配置。
As you begin your journey into using EMC2 we offer twocautionary notes:2
Praphrasing the words of Doug Gwyn on UNIX: "emc2 was not designed to stopits users from
doing stupid things, as that would also stop them from doing cleverthings."
Likewise the words of Steven King: "emc2 is user-friendly. It just isn’tpromiscuous about
which users it’s friendly with."
    在你继续阅读之前,我们提供两条注意事项:
EMC2不会防止它的使用者干傻事,因为那会同样防止它的使用者干聪明的事。
EMC2肯定是用户友好的,只不过它在对哪个用户友好的问题上,用情比较专一而已。
EMC2_User_Manual_翻译2章
第 2 章  EMC2 The Enhanced Machine Control
  2.1  关于本手册
The focus ofthis manual is on using EMC. It is intended to be used once EMC is installedand
configured. For standard installations see the Getting Started Guide for stepby step instructions
to get you up and going. For detailed information on installation andconfiguration of EMC see the
Integrator Manual.
    本手册的焦点是如何使用EMC2 。当EMC2安装并配置完毕后应当阅读本手册。关于简易安装EMC2的问题,请参见
入门手册“Getting Started Guide”。关于安装和配置的详细信息,请参见综合手册“Integrator Manual”。
  2.2  EMC2如何工作
The EnhancedMachine Controller (EMC2) is a lot more than just another CNC mill program. It
can control machine tools, robots, or other automated devices. It can controlservo motors, stepper
motors, relays, and other devices related to machine tools.
There are fourmain components to the EMC2 software: a motion controller, a discrete I/Ocontroller,
a task executor which coordinates them, and graphical user interfaces. In additionthere is
a layer called HAL (Hardware Abstraction Layer) which allows configuration ofEMC2 without the
need of recompiling.
    可不敢把EMC2想象成另外一个CNC数控加工程序,它能做的可多了。它可以控制机床、机器人、自动化设备,
还能控制伺服电机、步进电机、继电器以及其它机床电器。
    EMC2由四个主要部分:运动控制器、离散IO控制器、任务执行器(用来协调这四个部件)、图形用户界面。
另外还有一个硬件抽象层HAL(Hardware Abstraction Layer),有了HAL,无需重新编译EMC2,就可以按照实际
需要配置EMC2的硬件。
Figure 2.1 showsa simple block diagram showing what a typical 3-axis EMC2 system might look
like. This diagram shows a stepper motor system. The PC, running Linux as itsoperating system,
is actually controlling the stepper motor drives by sending signals through theprinter port. These
signals (pulses) make the stepper drives move the stepper motors. The EMC2 canalso run servo
motors via servo interface cards or by using an extended parallel port toconnect with external
control boards. As we examine each of the components that make up an EMC2system we will
remind the reader of this typical machine.
    图2.1(参见英文原版图片)的方框图展示了一个典型的3轴数控系统看起来的样子。这是一个步进电机系统。
PC机上运行着Linux操作系统和EMC2程序,控制信号则从打印口(并口)传送到电机驱动器上,电机驱动器根据
控制信号驱动步进电机(当然EMC2也可以通过伺服接口卡或使用与扩展并口相连的外部控制卡来控制伺服电机)。
我们接下来会介绍EMC2系统的每一个组成部分,在介绍的过程中可能会反复提到这幅图片。
  2.3  用户接口
A user interfaceis the part of the EMC2 that the machine tool operator interacts with. The EMC2
comes with several types of user interfaces:
AXIS an OpenGL-based GUI (Graphical User Interface), with an interactive G-Codepreviewer.
This interface is one of the few that are still under active development andimprovement.
Keystick a character-based screen graphics program suitable for minimalinstallations (without
the X server running).
Xemc an X Windows program
two Tcl/Tk-based GUIs named TkEMC and Mini
a HAL based user interface called halui, which allows to control emc2 usingknobs and
switches
a telnet based user interface called emcrsh, which allows commands to be sentto emc2 from
remote computers
    用户接口是EMC2的一部分,机床操作员与这个接口交互从而达到操作机床的目的。EMC2提供了几种不同的用
户接口供用户选择使用:
    AXIS 界面:是一个基于“OpenGL”的图形用户界面,有一个交互式的G代码预览器。AXIS界面目前仍然处
于持续开发升级的过程中。
    Keystick界面:是一个基于字符的界面,没有图形,只不过字符排列有规律,看起来像图形一样。只能用
键盘操作。如果目标系统没有X server,还想使用EMC2的话,就只能用这个将就了。
    Xemc界面:一个X Windows的图形用户界面。
    TkEMC界面和Mini界面:两个基于“Tcl/Tk”的图形用户界面。
    halui用户接口:基于HAL的用户接口,允许使用开关、旋钮控制EMC2系统。
    emcrsh用户接口:基于telnet的用户接口,允许用远程计算机发来的命令控制EMC2系统。
2.4  语言
EMC2 usestranslation files to translate EMC User Interfaces into many languages. Youjust need to
log in with the language you intend to use and when you start up EMC it comesup in that language.
If your language has not been translated contact a developer on the IRC or themailing list if you
can assist in the translation.
    EMC2使用翻译文件把用户接口翻译成多种语言。你只需用你想使用的语言登录进操作系统,然后当你启动
EMC2时,你看到的界面就已经采用你想使用的语言了。如果你想使用的语言还没有被翻译,而你恰好想帮忙翻
译,可以通过“IRC”或邮件列表的方式与开发人员取得联系。
2.5  像机床操作员一样思考
This book will noteven pretend that it can teach you to run a mill or a lathe. Becoming amachinist
takes time and hard work. An author once said, "We learn from experience,if at all." Broken tools,
gouged vices, and scars are the evidence of lessons taught. Good part finish,close tolerances, and
careful work are the evidence of lessons learned. No machine, no computerprogram, can take the
place of human experience.
As you begin towork with the EMC2 program, you will need to place yourself in the position of
operator. You need to think of yourself in the role of the one in charge of amachine. It is a machine
that is either waiting for your command or executing the command that you havejust given it.
Throughout these pages we will give information that will help you become agood operator of the
EMC2 mill. You will need some information right up front here so that thefollowing pages will make
sense to you.
    本书不能教你如何开动一台铣床或车床,成为这方面的专家需要时间和艰苦的努力。有位作家曾经说过:“
如果我们学到了什么,那一定是在亲身经历中学到的”。破损的刀具、凿坏的工装、伤痕累累的产品是我们得到
的教训,完美的收刀、精密的加工、精细的产品是我们得到的经验。没有任何机床、计算机软件能取代人的阅历
和经验。
    现在要和EMC2一起工作了,你需要把自己放到机床操作员的位置,要知道是你主宰着机床,而机床就在等待
你的命令,执行你的命令。当然通过学习系列手册,你会得到一些信息,它们将帮助你成为一名好的EMC2铣床操
作员。在继续之前,你可能需要一些基本信息,接下来的一些篇幅将帮助你找找感觉。
2.6  操作方式 Modes of Operation
When an EMC2 isrunning, there are three different major modes used for inputting commands.
These are Manual, Auto, and MDI. Changing from one mode to another makes a bigdifference in
the way that the EMC2 behaves. There are specific things that can be done inone mode that can
not be done in another. An operator can home an axis in manual mode but not inauto or MDI
modes. An operator can cause the machine to execute a whole file full ofG-codes in the auto mode
but not in manual or MDI.
    当一个EMC2系统运行时,输入命令的方式主要有三种:手动、自动、MDI。在这三种方式下,EMC2 的行为表
现差异很大。有些事情在一种方式下可以,在另一种方式下却不可以。比如在手动方式时,操作员可以原点复归
某个轴,但在自动和MDI方式下却不行。又比如在自动方式下,操作员可以执行一个全部是G代码的文件,但在手
动和MDI方式下却不行。
In manual mode,each command is entered separately. In human terms a manual command might
be "turn on coolant" or "jog X at 25 inches per minute".These are roughly equivalent to flipping a
switch or turning the hand wheel for an axis. These commands are normallyhandled on one of the
graphical interfaces by pressing a button with the mouse or holding down a keyon the keyboard.
In auto mode, a similar button or key press might be used to load or start therunning of a whole
program of G-code that is stored in a file. In the MDI mode the operator mighttype in a block of
code and tell the machine to execute it by pressing the <return> or<enter> key on the keyboard.
    在手动方式下,每个命令是分开输入的,用人类的语言讲,这些命令类似于“开启冷却”或者“在X轴上每分
钟前进25英寸”等等,它们大致相当于拨动一个开关或者转动某个轴上的手轮,具体操作则是在某个图形用户界
面上用鼠标点击某个按钮或按住键盘上的某个按键完成的。在自动方式下,点击一个按钮就可以装载或启动预先
存储在某个文件里面的全部G代码程序。在MDI方式下,操作员可以键入一批代码,然后按回车键命令机床执行。
Some motioncontrol commands are available and will cause the same changes in motion in all
modes. These include ABORT, ESTOP, and FEED RATE OVERRIDE. Commands like theseshould be
self explanatory.
The AXIS userinterface hides some of the distinctions between Auto and the other modes bymaking
Auto-commands available at most times. It also blurs the distinction betweenManual and MDI
because some Manual commands like Touch Off are actually implemented by sendingMDI commands.
It does this by automatically changing to the mode that is needed for theaction the user
has requested.
    有些运动控制命令在所有操作方式下均可使用,效果也相同。包括ABORT、 ESTOP、FEED RATE OVERRIDE等。
这些命令都具有自解释的特点。
    AXIS用户界面有一个特点,就是它隐藏了一些如上所述的三种操作方式的区别。它在大部分情况下都能提供
自动命令,从而隐藏了自动方式和其它两种方式的区别;它也淡化了手动方式和MDI方式的区别,像“Touch Off”
这种手动命令也可以通过发送MDI命令来执行。在用户提出请求时,它会自动切换到相应的操作方式,从而实现这
种隐藏,而用户在感觉上没有什么异常。
EMC2_User_Manual_翻译3章
第 3 章  用户概念 User Concepts
This chaptercovers important user concepts that should be understood before attempting torun a
CNC machine with g code.
    本章包含重要的用户概念,在使用G代码运行一个CNC机床之前,应当理解本章的概念。
3.1  轨迹控制 Trajectory Control
3.1.1  轨迹规划 Trajectory Planning
Trajectoryplanning, in general, is the means by which EMC follows the path specified byyour G
Code program, while still operating within the limits of your machinery.
A G Code program can never be fully obeyed. For example imagine you specify asa single-line
program the following move:
G1 X1 F10 (G1 islinear move, X1 is the destination, F10 is the speed)
In reality, thewhole move can’t be made at F10, since the machine must accelerate from a stop,
move toward X=1, and then decelerate to stop again. Sometimes part of the moveis done at F10,
but for many moves, especially short ones, the specified feed rate is neverreached at all. Having
short moves in your G Code can cause your machine to slow down and speed up forthe longer
moves if the "naive cam detector" is not employed with G64 Pn.
The basicacceleration and deceleration described above is not complex and there is nocompromise
to be made. In the INI file the specified machine constraints such as maximumaxis velocity and
axis acceleration must be obeyed by the trajectory planner.
    轨迹规划是指EMC2跟踪G代码所指定路径的方法,轨迹规划时不能超出机床工作台的运行范围。从某种程度
讲,G代码程序永远不能被机床严格执行。就比如下面这一行程序:
    G1 X1 F10 (G1 表示线性移动, X1 是目的位置, F10 代表速度)
    事实上,这个动作不可能完全以F10的速度完成,因为机床必须从静止开始加速,向 X=1的位置进发,在要
到达目标位置之前还要减速最后停止。这样就只有部分运动是以F10完成的,如果路程比较短,可能 F10这个速
度根本就不会达到。在“G64 Pn”的方式下,如果不指定“ naive cam detector”参数即“Q-”参数,则采用
短运动段会让机床运行变慢,采用长运动段可以让机床运行的快一点。
    机床加速性能和减速性能取决于机床本身,经实验确定以后,作为机床的特性固定下来,没什么要讨论的。
另外机床最大速度也是机床的一个特性。这些特性参数都保存在INI文件中,轨迹规划器必须遵守这些特性。
3.1.2  路径跟随 Path Following
A lessstraightforward problem is that of path following. When you program a corner inG Code, the
trajectory planner can do several things, all of which are right in some cases:it can decelerate to a
stop exactly at the coordinates of the corner, and then accelerate in the newdirection. It can also do
what is called blending, which is to keep the feed rate up while going throughthe corner, making it
necessary to round the corner off in order to obey machine constraints. You cansee that there is a
trade off here: you can slow down to get better path following, or keep thespeed up and have worse
path following. Depending on the particular cut, the material, the tooling,etc., the programmer
may want to compromise differently.
Rapid moves also obey the current trajectory control. With moves long enough toreach maximum
velocity on a machine with low acceleration and no path tolerance specified,you can get a fairly
round corner.
    路径跟随的问题要稍微简单一些。当你用 G代码设计的产品有个棱角的时候,轨迹规划器有几种不同的轨迹
规划方式处理这个棱角:比如可以减速并停在棱角所处的坐标位置,然后再按照新的方向加速并离开棱角;它还
可以采用混合模式(blending):在通过棱角时保持进给速度,由于机床特性方面的限制,这样做的结果必然在
棱角处产生一个圆角。因此在棱角处的路径跟随就存在这样一种情况:要获得更好的路径跟随效果就必须减速,
要保持速度,就必然导致差一点的路径跟随效果。具体如何抉择,要由程序员根据具体产品、材料、刀具等情况
权衡而定。
    快速加工也遵循当前采用的轨迹控制方式。比如采用 G64方式,不指定误差条件,且加速度较低时,让机床
运行足够长的距离并达到最大速度,就可以得到非常好的圆角效果。
3.1.3  编程确定轨迹规划方式 Programming the Planner
The trajectorycontrol commands are as follows:
    轨迹控制命令如下:
G61 (Exact PathMode) visits the programmed point exactly, even though that means it might
temporarily come to a complete stop in order to change direction to the nextprogrammed
point.
G61.1 (Exact Stop Mode) tells the planner to come to an exact stop at everysegment’s end.
    G61:准确路径方式。准确跟踪编程位置,如果到下一个编程位置需要改变方向,则机床会完全停止再改变
方向。
    G61.1:准确定位方式。在每一个程序段结束时,机床都会停止到相应的编程位置。(无论下一个运动的方
向是否需要改变)
G64 (BlendWithout Tolerance Mode) G64 is the default setting when you start EMC. G64 isjust
blending and the naive cam detector is not enabled. G64 and G64P0 tell theplanner to sacrifice
path following accuracy in order to keep the feed rate up. This is necessaryfor some
types of material or tooling where exact stops are harmful, and can work greatas long as the
programmer is careful to keep in mind that the tool’s path will be somewhatmore curvy than
the program specifies. When using G0 (rapid) moves with G64 use caution onclearance moves
and allow enough distance to clear obstacles based on the accelerationcapabilities of your
machine.
    G64:不附加误差条件的混合方式。这个方式也是启动EMC2时默认的方式。G64只是混合方式,没有采用“
naive camdetector”功能。“G64”和“G64 P0”是一样的效果,都是告诉轨迹规划器牺牲路径跟随的精度,
保证提升进给速度。有时候程序设计人员就想要一个圆角,那么这个模式就用的上了,当然设计人员要清楚
采用这种方式加工出的圆角可能和设计值有一定偏差,曲率会大一点。当使用“G0 G64”组合进行快速加工时,
要根据机床的加速度性能预留足够的加速空间以保证切削效果。
G64 P- Q- (BlendWith Tolerance Mode) This enables the "naive cam detector" andenables blending
with a tolerance. If you program G64 P0.05, you tell the planner that you wantcontinuous
feed, but at programmed corners you want it to slow down enough so that the toolpath can
stay within 0.05 user units of the programmed path. The exact amount ofslowdown depends
on the geometry of the programmed corner and the machine constraints, but theonly thing
the programmer needs to worry about is the tolerance. This gives the programmercomplete
control over the path following compromise. The blend tolerance can be changedthroughout
the program as necessary. Beware that a specification of G64 P0 has the sameeffect as G64
alone (above), which is necessary for backward compatibility for old G Codeprograms. See the
G Code Chapter for more information on G64 P- Q-.
    G64 P- Q- :附加误差条件的混合方式。其中“Q-”参数将打开“naive cam detector”功能,“P-”参
数指定误差条件。程序代码“ G64 P0.05”指示轨迹规划器采用连续加工方式(即混合方式blending),但要
在棱角处降速以确保轨迹误差不大于0.05个用户单位(英寸或毫米)。具体降速的程度取决于待加工产品的几
何尺寸以及机床特性,但这些算法都不需要程序员考虑,程序员只需要考虑他想要多少误差就行了。这种方式
给了程序员很大的轨迹跟随控制力,在程序中,他可以随时改变这个误差值来获得他想要的任何效果。要注意
的是“G64 P0”和“G64”是一样效果,它只是为了和旧G代码程序保持兼容而设计的。参考 G代码相关的章节
可以获得更多关于“G64 P- Q-”的信息。
Blending withouttolerance The controlled point will touch each specified movement at at least
one point. The machine will never move at such a speed that it cannot come toan exact stop
at the end of the current movement (or next movement, if you pause whenblending has already
started). The distance from the end point of the move is as large as it needsto be to keep up
the best contouring feed.
    不附加误差条件的混合方式(两个原则):一是实际轨迹的控制点至少要经过每个设计轨迹运行段中的至
少一个点;二是机床不会加速到一个它想停都停不下来的速度(当轨迹规划器觉得按照当前的机床特性和当前
的速度以及当前位置与运动终点的距离计算,它没办法在运动终点停止,它就会停止加速或者开始减速)。所
以要保持最佳的轮廓进给速度,就应当在终点以前留足够的距离供机床加速和减速用。
Naive CamDetector Successive G1 moves that involve only the XYZ axes that deviate lessthan
Q- from a straight line are merged into a single straight line. This mergedmovement replaces
the individual G1 movements for the purposes of blending with tolerance.
Betweensuccessive movements, the controlled point will pass no more than P- from theactual
endpoints of the movements. The controlled point will touch at least one pointon each movement.
The machine will never move at such a speed that it cannot come to an exactstop at the end of
the current movement (or next movement, if you pause when blending has alreadystarted)
On G2/3 moves inthe G17 (XY) plane when the maximum deviation of an arc from a straight line
is less than the G64 Q- tolerance the arc is broken into two lines (from startof arc to midpoint,
and from midpoint to end). those lines are then subject to the naive camalgorithm for lines. Thus,
line-arc, arc-arc, and arc-line cases as well as line-line benefit from the"naive cam detector".
This improves contouring performance by simplifying the path.
    Naive Cam Detector:在连续的运动之间,当后面的G1直线运动代码坐标只含XYZ轴时,如果该运动偏离
上一运动直线的值小于“Q-”参数,则该运动合并到上一运动的直线中。这样做的目的是要把误差混合掉。
    在连续的运动之间,实际经过的控制点和理论(程序)上的端点之间不能有大于“P-”参数的误差。实际
轨迹的控制点至少要经过每个设计轨迹运行段中的至少一个点,机床不会加速到一个它想停都停不下来的速度
(当轨迹规划器觉得按照当前的机床特性和当前的速度以及当前位置与运动终点的距离计算,它没办法在运动
终点停止,它就会停止加速或者开始减速)(以混合方式开始运行后,即使暂停了机床的运行,那么再启动后
仍然遵循这些原则,只不过运动终点可能会重新计算了)。
    在G17(XY)平面上做G2、G3圆弧运动时,如果圆弧偏离运动方向的偏离值小于Q-参数,该圆弧将由两个
直线运动(起点到圆弧中点、圆弧中点到圆弧终点)代替,而这两个直线运动也适用“naive cam detector”
算法。这样一来,直线转圆弧、圆弧转圆弧、圆弧转直线运动都可能被化解为直线转直线运动,也就都能享受
“naive camdetector”算法的好处,简化了路径,提高了轮廓加工的性能。
In the followingfigure the blue line represents the actual machine velocity. The red lines arethe
acceleration capability of the machine. The horizontal lines below each plot isthe planned move.
The upper plot shows how the trajectory planner will slow the machine down whenshort moves are
encountered to stay within the limits of the machines acceleration setting tobe able to come to an
exact stop at the end of the next move. The bottom plot shows the effect of theNaive Cam Detector
to combine the moves and do a better job of keeping the velocity as planned.
    下图中(参见英文原版图片,实则是上下两个图),蓝线代表程序设定的机床速度,红线代表机床的加速
能力,每张图最下面的水平线代表规划的运动路线(可以看出上图的规划路线分成了几段,由不同颜色区分)。
上图显示的情况是:在小运动段的情况下,为了能在每个运动段的终点停下来,轨迹规划器会根据机床加速度
参数的限制情况给机床减速直至停止;下图显示的是采用“Naive Cam Detector”算法的效果,重组了运动并
较好的保持了期望速度。
3.1.4  规划“移动”(最小运动段距离计算)    Planning Moves
Make sure movesare "long enough" to suit your machine/material. Principally becauseof the rule
that "the machine will never move at such a speed that it cannot come to acomplete stop at the
end of the current movement", there is a minimum movement length that willallow the machine to
keep up a requested feed rate with a given acceleration setting.
The accelerationand deceleration phase each use half the ini file MAX_ACCELERATION. In a blend
that is an exact reversal, this causes the total axis acceleration to equal theini file MAX_ACCELERATION.
In other cases, the actual machine acceleration is somewhat less than the inifile acceleration
To keep up feedrate, the move must be longer than the distance it takes to accelerate from 0to the
desired feed rate and then stop again. Using A as 1/2 the ini fileMAX_ACCELERATION and F as
the feed rate *in units per second*, the acceleration time is ta = F/A and theacceleration distance
is da = 1/2*F*ta the deceleration time and distance are the same, making thecritical distance d
= da + dd = 2*da = F^2 / A.
For example, for a feed rate of 1 inch per second and an acceleration of 10inch/sec^2, the critical
distance is 1^2 / 10 = .1 inch. For a feed rate of .5 inch per second, thecritical distance is .5^2 /
10 = .025 inch.
    用某个机床切削某种物质时,要确保一次移动足够长的距离。理由仍然是“机床不会加速到一个它想停都
停不下来的速度”。在给定加速度的情况下,要达到某个速度,可以算出一个必须满足的最小移动距离。
    INI文件中有一个参数叫“MAX_ACCELERATION”,加速阶段和减速阶段各分一半“MAX_ACCELERATION”。在
混合模式情况下,加速阶段使用全部的“MAX_ACCELERATION”,其它情况下机床实际的加速性能要比ini文件里
面的“MAX_ACCELERATION”小一些。
    要保持进给速度,运动段的长度必须大于机床加速到该速度并重新停止所需要的路程。设:
    A = 1/2*MAX_ACCELERATION
    F为需要达到的速度,单位是 units每秒(“units per second”),units是英寸或毫米。
    则加速时间 ta = F/A ,加速距离是 da = 1/2*F*ta ,减速时间和距离同加速时间和距离相同,则总距离为:
    d = da + dd = 2 * da = F * F / A
    例如,进给速度是1英寸每秒,加速度是10英寸每平方秒,则最小距离为1*1/10=0.1英寸。同样加速度如果加
速到0.5英寸每秒,则最小距离为0.5*0.5/10=0.25英寸。
3.2  G代码
3.2.1  默认配置
When EMC firststarts up many G and M codes are loaded by default. The current active G and M
codes can be viewed on the MDI tab in the "Active G-Codes:" window inthe AXIS interface. These
G and M codes define the behavior of EMC and it is important that youunderstand what each one
does before running EMC. The defaults can be changed when running a G-Code fileand left in a
different state than when you started your EMC session. The best practice is toset the defaults
needed for the job in the preamble of your G-Code file and not assume that thedefaults have not
changed. Printing out the G-Code Quick Reference (15.2) page can help youremember what each
one is.
    EMC2启动时,一些G代码和M代码会默认启动。在“AXIS”界面的MDI页的“Active G-Codes:”窗口里可以
看到这些默认启动的代码。这些代码定义了EMC2的默认行为,在运行EMC2之前理解它们的含义非常重要。在执
行G代码文件时,可以在G代码文件中改变这些默认设置,从而改变EMC2的行为。在进行具体的加工工作时,要
在相应的G代码文件中设定你想要的任何默认设置,不要指望EMC2默认启动的设置(它们随时可能会变的)。
在15.2节的“G代码快速参考”非常有用,打印一份在手边以备随时参考。
3.2.2  进给速度 Feed Rate
How the feedrate is applied depends on if an axis involved with the move is a rotary axis.Read and
understand the Feed Rate section (9.2.5) if you have a rotary axis or a lathe.
    进给速度的确定和相关轴是否是旋转轴有关。如果你的系统是一个车床或者有一个旋转轴,一定要阅读一
下9.2.5节的内容。
3.2.3  刀具半径补偿
Tool RadiusOffset (G41/42) requires that the tool be able to touch somewhere along eachprogrammed
move without gouging the two adjacent moves. If that is not possible with thecurrent tool
diameter you will get an error. A smaller diameter tool may run without anerror on the same path.
This means you can program a cutter to pass down a path that is narrower thanthe cutter without
any errors. See the Tool Compensation Section (11.3) for more information.
    刀具半径补偿(G41、G42)以后,刀具要能够沿着编程的运动路线运动而不会干涉到两边相邻的运动路线,
如果用当前的刀具半径不能满足这个条件,可能会产生一个错误。尝试用小一点半径的刀具走相同的路线可能
会消除这个错误。同样道理,如果一个刀具走某个路线没有错误,那么用比它细一些的刀具肯定也不会有错误。
关于刀具补偿的信息还可参见11.3节。
3.3  原点复归 Homing
After startingEMC2 each axis must be homed prior to running a program or running a MDIcommand.
If you want to deviate from the default behavior, or want to use the Miniinterface you will need to
set the option NO_FORCE_HOMING = 1 in the [TRAJ] section of your ini file. Moreinformation on
homing can be found in the Integrators Manual.
    启动EMC2以后,要想运行程序或MDI命令,还必须先给每个轴执行原点复归操作。要避免这样做,或者要使
用Mini界面,可以在ini文件的“TRAJ”参数段设置“NO_FORCE_HOMING = 1”达到目的。关于原点复归的详细
信息参见综合手册“Integrators Manual”。
3.4  刀具更换 Tool Changes
There areseveral options when doing manual tool changes. See the [EMCIO] section of theIntegrators
Manual for information on configuration of these options. Also see the G28 andG30 section of
the User Manual.
    有几个关于手动换刀的选项。关于它们的配置信息请参考综合手册“Integrators Manual”中“EMCIO”部
分。同时也参考一下本手册的G28和G30部分。
3.5  坐标系统
The CoordinateSystems can be confusing at first. Before running a CNC machine you mustunderstand
the basics of the coordinate systems used by EMC. In depth information on theEMC
Coordinate Systems is in the coordinate section 10 of this manual.
    刚开始学EMC2时可能会觉得坐标系统有点难学。但是在实际运行一个机床以前,还是必须先搞清楚EMC2使用
的坐标系统的一些基本概念。关于EMC2坐标系统更深的知识在本手册第 10 章可以找到。
3.5.1  G53 机床坐标系统
When you homeEMC you set the G53 Machine Coordinate System to 0 for each axis homed.
No other coordinate systems or tool offsets are changed by homing.
The only time you move in the G53 machine coordinate system is when you programa G53 on the
same line as a move. Normally you are in the G54 coordinate system.
    当你执行EMC2原点复归命令时,就相当于设定了G53机床坐标系统各个轴的原点。
    原点复归操作不改变其它坐标系统或刀具补偿的设置。
    只有你在代码行里面指定G53代码,你才在G53机床坐标系里移动。其它情况下你处在G54坐标系里面。
3.5.2  G54---G59.3 用户坐标系统
Normally you usethe G54 Coordinate System. When an offset is applied to a current usercoordinate
system a small blue ball with lines will be at the machine origin when your DROis displaying
"Position: Relative Actual" in Axis. If your offsets are temporaryuse the Zero Coordinate System
from the Machine menu or program G10 L2 P1 X0 Y0 Z0 at the end of your G Codefile. Change the
"P" number to suit the coordinate system you wish to clear the offsetin.
Offsets stored in a user coordinate system are retained when EMC is shut down.
Using the "Touch Off" button in Axis sets an offset for the chosenUser Coordinate System.
    通常情况下你会使用G54坐标系统。当对一个用户坐标系统设置了偏移并且DRO页面里轴坐标显示格式
是“ Position: Relative Actual”时,一个被线穿过的小的蓝色球将出现在机床原点位置。如果你的偏
移是临时的,可以用“Machine->Zero Coordinate System”菜单命令删除偏移,也可以在程序尾部用“
G10 L2 P1 X0 Y0Z0”代码删除偏移。“P”后面的数字是想要删除偏移的用户坐标系统编号。
    EMC2关闭时,保存在用户坐标系统的偏移值不会丢失。
    在AXIS用户界面中使用“Touch Off”按钮为选定的用户坐标系统设置偏移值。
3.5.3  失位后怎么办
If you’re havingtrouble getting 0,0,0 on the DRO when you think you should, you may have some
offsets programmed in and need to remove them.
Move to the Machine origin with
G53 G0 X0 Y0 Z0
Clear any G92 offset with
G92.1
Use the G54 coordinate system with
G54
Set the G54 coordinate system to be the same as the machine coordinate systemwith
G10 L2 P1 X0 Y0 Z0
Turn off tool offsets with
G49
Turn on the Relative Coordinate Display from the menu
Now you should be at the machine origin X0 Y0 Z0 and the relative coordinatesystem should be
the same as the machine coordinate system.
    当你认为回到了机床原点,但DRO页面的坐标值却没有显示0,0,0时,可能是由于编程设置了一些偏
移导致的。现在需要移除它们:
    要移动到机床原点,使用
    G53 G0 X0 Y0 Z0
    用下面命令清除任何G92偏移
    G92.1
    用下面命令启用G54坐标系统
    G54
    用下面命令设置G54坐标系统为和机床坐标系统一样的坐标系统
    G10 L2 P1 X0 Y0 Z0
    用下面命令关闭刀具补偿
    G49
    从菜单打开相对坐标显示
    现在你应该在机床原点X0 Y0 Z0了,相对坐标系也和机床坐标系一致了。
EMC2_User_Manual_翻译4-5678章
第 4 章  Axis图形用户界面
4.1  简介
AXIS is agraphical front-end for EMC2 which features a live preview and backplot. It iswritten in
Python and uses Tk and OpenGL to display its user interface.
    AXIS是EMC2的一个图形前端,有实时预览功能和轨迹模拟功能“backplot”。它用Python语言编
写,用Tk和OpenGL显示用户接口。
4.2  启动
To select AXISas the front-end for EMC2, edit the .ini file. In the section [DISPLAY] changethe
DISPLAY line to read
DISPLAY = axis
Then, start EMC2 and select that ini file. The sample configurationsim/axis.ini is already configured
to use AXIS as its front-end.
When you start AXIS, a window like the one in Figure 4.1 is shown.
    要选择AXIS作为EMC2的前端,就编辑ini文件,在“DISPLAY”段把“DISPLAY”参数改成下面的样子:
    DISPLAY = axis
    然后启动EMC2,并选择刚刚编辑的ini文件,就启动了AXIS前端。“sim/axis.ini”文件中已经配置
了AXIS前端,可以参考一下。
    AXIS前端的窗口看起来是图4.1(参见英文原版图片)的样子。
4.2.1  一个典型的任务执行过程 A Typical Session
1. Start EMC.
2. Clear the E-STOP (F1) and turn the Machine Power (F2) on.
3. Home all axes.
4. Load the g-code file.
5. Use the preview plot to verify that the program is correct.
6. Set the proper offsets for each axis by jogging and using the Touch Offbutton.
7. Run the program.
8. To run the same file again, return to step 6. To run a different file, returnto step 4. When
you’re done, exit AXIS.
    1. 启动EMC2。
    2. 清除“E-STOP”或按F1 ,然后打开机床电源,或按F2 。
    3. 原点复归所有的轴。
    4. 加载G代码文件。
    5. 使用预览功能,验证程序是否正确。
    6. 使用“jogging”功能或“Touch Off”按钮为各轴设定适当的偏移。
    7. 运行程序。
    8. 要再次运行同一程序,返回第 6 步;要运行不同的程序,返回第 4 步;如果已完成任务,退出AXIS。
4.3  AXIS界面
The AXIS windowcontains the following elements:
A display area that shows a preview of the loaded file (in this case,"axis.ngc"), as well as the
current location of the CNC machine’s "controlled point". Later, thisarea will display the path
the CNC machine has moved through, called the "backplot"
A menu bar and toolbar that allow you to perform various actions
"Manual Control Tab" , which allows you to make the machine move,turn the spindle on or
off, and turn the coolant on or off if included in the ini file.
"MDI Tab” , where G-code programs can be entered manually, one line at atime. This also
shows the "Active G Codes" which shows which modal G Codes are ineffect.
"Feed Override" , which allows you to increase or decrease the speedat which EMC executes
Feed Moves the selected program. The default maximum is 120% and can be set toa different
value in the ini file. See the Integrators Manual for more information on thissetting.
"Spindle Override" , which allows you to increase or decrease thespeed at which EMC commands
the spindle to run if spindle control is configured.
"Jog Speed" , which allows you to set the jog speed within the limitsset in the ini file. See the
Integrators Manual for more information on the ini file.
"Max Velocity", which allows you to set the maximum velocity forrapids and cap feed rates
(except spindle synchronized motion) for dry runs. Currently only AXIS andHalui allow you to
set it.
A text display area that shows the G-code source of the loaded file.
A status bar which shows the state of the machine. In this screen shot, themachine is turned
on, does not have a tool inserted, and the displayed position is"Relative” to the machine offset
(as opposed to “Absolute”), and the “Actual” (as opposed to “Commanded”position)
    AXIS界面包括以下部分:
    一个显示区域,提供了被加载文件(在图4.1(参见英文原版图片)中是“axis.ngc”)的预览
以及机床控制点(参见9.2.3节)的当前位置。稍后这个区域还将显示机床行走的路径,这个功能称为
轨迹模拟“backplot”功能。
    一个菜单栏和一个工具栏,通过它们可以执行各种操作。
    “手动控制”页面,在这里你可以使机床移动,启动或停止主轴旋转。如果在ini文件里面有相
关设置,你还可以在这里打开或关闭冷却系统。
    “MDI”页面,在这里你可以输入G代码程序,一次一行。这个页面里还有一个“Active G Codes”
区域,里面显示了当前有效的模态G代码。
    进给微调“Feed Override”。该参数允许对EMC2正在执行的程序规定的进给速度进行增速或减
速操作。默认的最大调节范围是120%,但是这个值可以在ini文件里修改为别的值。详细信息可参见综
合手册Integrators Manual。
    主轴微调“ Spindle Override”。如果EMC2配置了主轴控制功能,则使用这个参数可以对已经
设定的主轴速度进行微调。
    手动进给速度“Jog Speed”。允许在ini文件设定的速度限值内任意设定手动进给速度。更多信
息请参见综合手册“Integrators Manual”。
    最大速度“Max Velocity”。为试运行设定快速进给的最大速度(不包括主轴同步运动)。目前
只有AXIS和HALUI这两种用户接口支持这么做。
    一个文字显示区域,用于显示被加载文件的G代码源码。
    一个状态栏,用于显示机床的状态,比如机床是否上电、是否锁定、是否选择刀具、位置坐标显
示的方式等等。比如图 4.1中状态栏显示的内容为:机床处于急停状态(译者注:此处和原文不同,和
图4.1相同),没有选择刀具,位置显示方式是相对于(Relative,是和 Absolute相对的概念)机床原
点坐标的偏移,并且是实际的(Actual,是和Commanded(命令的,编程的)相对的概念)位置。
4.3.1  菜单命令介绍
Some menu itemsmight be grayed out depending on how you have your .ini file configured. For
more information on configuration see the Integrators Manual.
    根据ini文件的配置,有些菜单命令是灰的,不可用的。关于ini文件的配置,参见综合手册。
4.3.1.1  文件菜单 File Menu
Open... Opens astandard dialog box to open a g code file to load in AXIS. If you haveconfigured
EMC to use a filter program you can also open it up. See the Integrators manualfor more
information on filter programs.
Recent FilesDisplays a list of recently opened files.
Edit... Open thecurrent g code file for editing if you have an editor configured in your inifile. See
the Integrators Manual for more information on specifying an editor to use.
Reload reloadthe current g code file. If you edited it you must reload it for the changes totake
affect. If you stop a file and want to start from the beginning then reload thefile. The toolbar
reload is the same as the menu.
Save gcode as...Save the current file with a new name.
PropertiesProperties of the current loaded g code file.
Edit tooltable... Same as Edit if you have defined an editor you can open the tool tableand edit it.
Reload tooltable After editing the tool table you must reload it.
Ladder editor Ifyou have loaded Classic Ladder you can edit it from here. See the Integrators
Manual on setting up Classic Ladder
Quit Terminatesthe current EMC session.
    Open...:启动一个标准的“打开文件”对话框,从里面浏览并找到你想要加载的G代码文件并打开
它。如果你为EMC2配置了某个过滤程序,你也可以在这儿打开它。关于过滤程序参见综合手册。
    Recent Files :显示一列最近打开的文件。
    Edit... :如果在 ini文件里面配置了编辑器,就可以在这儿用它打开当前G代码文件。关于如何
设置编辑器,参见综合手册。
    Reload :重新加载当前G代码文件。如果你编辑了当前G代码文件,你必须重新加载它才能让修改
生效。如果你中途停止了文件执行,又想从头开始,也用这个命令。工具栏上面的快捷按钮“reopen”
的功能和这个命令一样。
    Save gcode as... :用一个新名字存储当前文件。
    Properties :当前加载G代码文件的属性。
    Edit tool table... :如果在 ini文件里面配置了编辑器,就可以在这儿用它打开“tool table”
并编辑它。
    Reload tool table :编辑刀具列表“tool table”以后,必须用这个命令重新加载。
    Ladder editor :如果你加载了“Classic Ladder”,你可以在这儿编辑它了。关于设置
“Classic Ladder”的信息,请参见综合手册。
    Quit :终止当前EMC任务,退出。
4.3.1.2  机床菜单
Toggle EmergencyStop F1
Toggle Machine Power F2
Run Program
Run From Selected Line Select the line you want to start from first. Use withcaution as this will
move the tool to the expected position before the line first then it willexecute the rest of the
code.
Step Single stepthrough a program.
Pause Pause a program.
Resume Resume running from a pause.
Stop Stop a running program.
Stop at M1 If you have a M1 in your g code and this is checked programexecution will stop on the
M1 line. Press Resume to continue.
Skip lines with"/" If a line begins with / and this is checked it will skip thatline.
Clear MDI history Clears the MDI history window.
Copy from MDI history Copies the MDI history to the clipboard
Paste to MDI history Paste from the clipboard to the MDI history window
Calibration This is a servo testing pop up widow for each axis. After makingchanges and testing
them it can save them to your .ini file.
Show HALConfiguration Opens up the HAL Configuration widow where you can monitor HAL
Components, Pins, Parameters, Signals, Functions, and Threads.
HAL Meter Opensup a window where you can monitor a single HAL Pin, Signal, or Parameter.
HAL Scope Opens up a Scope window where you can set up and monitor Pins andSignals.
Show EMC Status Opens up a window showing EMC’s status.
Set Debug Level Opens a window where debug levels can be viewed and some can beset.
Homing Home any or all axis.
Unhoming Unhome any or all axis.
Zero Coordinate System Zero work offsets.
    Toggle Emergency Stop F1 :
    Toggle Machine Power F2 :
    Run Program :
    Run From Selected Line :首先选择你想从它开始执行的行,然后用这个命令使EMC2执行该行以后
的剩余代码。要小心使用,因为刀具将移动到你指定行之前的位置,然后再开始执行。
    Step :单步运行程序。
    Pause :暂停程序运行。
    Resume :使暂停的程序恢复运行。
    Stop :停止程序运行。
    Stop at M1 :如果你的G代码程序里有一个M1指令,而且选择了这个选项,程序将运行然后暂停在
M1那一行。使用Resume命令可以恢复运行。
    Skip lines with "/" :如果选择了这个选项,程序运行时将忽略以“”开头的行。
    Clear MDI history :清除MDI历史窗口。
    Copy from MDI history :把MDI历史窗口的内容拷贝到剪贴板。
    Paste to MDI history :把剪贴板的内容拷贝到MDI历史窗口。
    Calibration :将弹出一个伺服校准窗口,可以对每个轴进行校准,经过修改并测试通过的参数可
以被保存回ini文件中。
    Show HAL Configuration :打开HAL配置窗口,在该窗口中可以监测HAL的组件、引脚、参数、信
号、函数、线程。
    HAL Meter :打开一个窗口,在该窗口中可以监测一个单个的HAL引脚、信号、参数。
    HAL Scope :打开一个示波器窗口用于建立并监测引脚、信号的波形变化。
    Show EMC Status :打开一个窗口显示EMC的状态。
    Set Debug Level :打开一个窗口显示调试级别,其中一些参数也可以在该窗口中调整。
    Homing :Home任意或所有的轴。
    Unhoming :Unhome任意或所有的轴。
    Zero Coordinate System :清零工件坐标系偏移。
4.3.1.3 视图菜单
    (译者注:这一段不必翻译)
4.3.1.4  帮助菜单 (在窗口的右上角)
About Axis
Quick Reference Shows the keyboard shortcut keys.
    About Axis :
    Quick Reference :显示EMC2的快捷键列表。
4.3.2  工具栏按钮
    (译者注:这一段不必翻译)
4.3.3  图形显示区域
4.3.3.1  坐标显示
In theupper-left corner of the program display is the coordinate display. It showsthe position of the
machine. To the left of the axis name, an origin symbol ( ) is shown if theaxis has been properly
homed. To the right of the axis name, a limit symbol ( ) is shown if the axisis on one of its limit
switches.
    在程序显示区域的左上角显示的是坐标值,代表了机床的位置。如果某个轴旁边出现了原点符号( ),
说明该轴已经成功执行原点复归操作了。如果某个轴出现了限位符号( ),说明该轴处于限位开关的位置。
To properlyinterpret these numbers, refer to the "Position:" indicator in thestatus bar. If the
position is "Absolute", then the displayed number is in the machinecoordinate system. If it is
"Relative", then the displayed number is in the offset coordinatesystem. When the coordinates
displayed are relative and an offset has been set, the display will include acyan "machine origin"
marker ( ). If the position is "Commanded", then it is the idealposition–for instance, the exact
coordinate given in a G0 command. If it is "Actual", then it is theposition the machine has actually
been moved to. These values can differ for several reasons: Following error,dead band, encoder
resolution, or step size. For instance, if you command a movement to X 0.0033on your mill, but
one step of your stepper motor is 0.00125, then the "Commanded"position will be 0.0033 but the
"Actual" position will be 0.0025 (2 steps) or 0.00375 (3 steps).
    要正确理解这些数字,还要参考状态栏上的“Position:”指示器。如果该指示器显示“Absolute”,
则这些数字代表机床坐标系统的绝对坐标值。如果该指示器显示“Relative”,则这些数字代表偏移坐标
系统的坐标值。如果该指示器显示“Relative”且指定了偏移,则显示区域中会有一个青绿色的机床原点
标志( )。如果该指示器显示“Commanded”,则这些数字代表理想的坐标值(命令中的坐标值),比如
在G0命令中给定的坐标值。如果该指示器显示“Actual”,则这些数字代表机床的实际位置的坐标。实际
位置和理想位置可能会有差异,差异的原因包括:跟随误差、死区、编码器分辨率、步进距离等。例如,
你让铣床的X轴移动到0.0033的位置,而步进电机的步进距离是0.00125,那么理想的坐标位置是0.0033,
但是实际的坐标将是0.0025(走两步)或者0.00375(走3步)。
4.3.3.2  预览图 Preview Plot
When a file isloaded, a preview of it is shown in the display area. Fast moves (such as those
produced by the G0 command) are shown as green lines. Moves at a feed rate(such as those
produced by the G1 command) are shown as solid white lines. Dwells (such asthose produced by
the G4 command) are shown as small "X" marks.
G0 (Rapid) moves prior to a feed move will not show up on the preview plot.Rapid moves after a
T<n> (Tool Change) will not show on the AXIS preview until after a feedmove. To turn either of
these features off program a G1 without any moves prior to the G0 moves.
    当一个文件被加载时,显示区域会显示它的一个预览。快速移动(例如用G0命令产生的移动)用绿线
表示,进给移动(例如用G1命令产生的移动)用实白线表示,延时(例如用G4命令产生的延时)用小“x”
标记。
    进给移动之前的快速移动(G0)不会显示在预览窗口;换刀(T<n>)之后的快速移动不会显示在预览
窗口,除非发生在进给移动之后的换刀。要规避这两个特性,可以在G0之前加上一个没有实际移动的G1命
令即可。
4.3.3.3  程序范围 Program Extents
The"extents" of the program in each axis are shown. At each end, theleast or greatest coordinate
value is indicated. In the middle, the difference between the coordinates isshown. In Figure (4.1),
the X extent of the file is from 0.00 to 6.92 inches, a total of 6.92 inches.
When some coordinates exceed the "soft limits" in the .ini file, therelevant dimension is shown in a
different color and enclosed by a box. In Figure (4.2) the maximum soft limitis exceeded on the X
axis as indicated by the box surrounding the coordinate value.
    程序中每个轴的运行范围也被显示出来。每个轴运行范围的最小最大坐标值被标示出来。而且,在坐
标之间的尺寸差(即距离)标在了中间位置。如在图4.1(参见英文原版图片)中,X的范围是0.45到6.92
英寸,尺寸差则是6.47英寸。
    如果此处的坐标值超出了ini文件中“soft limits”参数的规定,则超出的那个值会用不同的颜色显
示为相对尺寸并且被包在一个框里。如图4.2(参见英文原版图片)中,X轴范围超出了最大软限位
“maximum softlimit”,所以该坐标值被框包围并且用不同的颜色显示。
4.3.3.4  刀具椎体 Tool Cone
The location ofthe tip of the tool is indicated by the "tool cone". The cone doesnot indicate anything
about the shape, length, or radius of the tool.
When a tool is loaded (for instance, with the MDI command T1M6), the conechanges to a cylinder
which shows the diameter of the tool given in the tool table file.
    刀具尖部的位置由刀具椎体指示出来。注意这个椎体不表示刀具的形状、长度、半径。
    如果装了一把刀具(比如在MDI页面用T1M6指令把一号刀具装上),这个圆锥就变成了一个圆柱体,
圆柱体的直径就是刀具文件中指定的直径。
4.3.3.5  轨迹模拟  Backplot
When the machinemoves, it leaves a trail called the backplot. The color of the line indicatesthe
type of motion: Yellow for jogs, faint green for rapid movements, red forstraight moves at a feed
rate, and magenta for circular moves at a feed rate.
    机床移动时,刀具在图形预览区留下一个轨迹,这被称为轨迹模拟“backplot”。轨迹模拟时,线
的颜色代表了运动的类型:手动进给是黄色,快速移动是淡绿色,直线进给移动是红色,圆弧进给移动
是紫红色。
4.3.3.6  交互 Interacting
By left-clickingon a portion of the preview plot, the line will be highlighted in both thegraphical
and text displays. By left-clicking on an empty area, the highlighting will beremoved.
By dragging with the left mouse button pressed, the preview plot will beshifted (panned).
By dragging with shift and the left mouse button pressed, or by dragging withthe mouse wheel
pressed, the preview plot will be rotated. When a line is highlighted, thecenter of rotation is the
center of the line. Otherwise, the center of rotation is the center of the fileas a whole.
By rotating the mouse wheel, or by dragging with the right mouse buttonpressed, or by dragging
with control and the left mouse button pressed, the preview plot will be zoomedin or out.
By clicking one of the "Preset View" icons, or by pressing"V", several preset views may be selected.
    左键单击预览图的某个部分(某个运动线段),该部分将高亮显示,同时文字区域相应的代码行也
高亮显示,左键单击空白区域,取消高亮显示。按住鼠标左键拖动,预览图将会移动(摇摄效果)。按
住键盘“ shift”键,同时按住鼠标左键,拖动预览图会旋转;按住鼠标滚轮同时拖动鼠标也会让预览
图旋转,旋转时,如果某个运动线段高亮,则以该线段中点为旋转中心,否则,以程序文件中点(所有
运动线段组成了这个程序文件)为旋转中心。要放大、缩小预览图,可采用如下方法:滚动鼠标滚轮、
按住鼠标右键拖动鼠标、按住鼠标左键同时按住键盘“ctrl”键拖动鼠标。有几个预设的视图,可以通
过工具栏的按钮或按键盘的“V”键快速切换它们。
4.3.4  文本显示区域
By left-clickinga line of the program, the line will be highlighted in both the graphical andtext
displays in blue.
When the program is running, the line currently being executed is highlightedin red. If no line has
been selected by the user, the text display will automatically scroll to showthe current line.
    左键单击程序的某一行,改行将高亮显示,同时高亮显示的还有该行代码对应的图形预览区的线段,
高亮显示的颜色是蓝色。程序运行时,当前执行的行用红色高亮显示,如果用户没有选中某个线段或代
码行,则文本显示区域自动滚动,使当前被执行的代码行始终都能被显示。
4.3.5  手动控制
While themachine is turned on but not running a program, the items in the "ManualControl" tab
can be used to move the machining center or turn different parts of it on andoff.
When the machine is not turned on, or when a program is running, the manualcontrols are unavailable.
Many of the items described below are not useful on all machines. When AXISdetects that a particular
pin is not connected in HAL, the corresponding item in the Manual Control tabis removed. For
instance, if the HAL pin motion.spindle-brake is not connected, then the"Brake" button will not
appear on the screen. If the environment variable AXIS_NO_AUTOCONFIGURE is set,this behavior is
disabled and all the items will appear.
    如果机床被打开并且当前没有运行一个程序,则可以用“Manual Control”页面上提供的各种功能
移动机床,或者打开、关闭主轴、冷却等部件,机床没有打开或者当前有程序在运行,则这些功能都不
可用。下面描述的许多条目不是在所有机床上都可用的,如果AXIS探测到某个特定的引脚pin没有连接
到HAL,那么相对应的条目将从“Manual Control”移除。例如,如果没有连接“motion.spindle-brake”
引脚,则“Brake”按钮将不会出现在屏幕上。如果环境变量“AXIS_NO_AUTOCONFIGURE”被设置,这个
功能就被屏蔽了,所有的条目都会显示出来。
4.3.5.1  Axis 组
"Axis"allows you to manually move the machine. This action is known as"jogging". First, select the
axis to be moved by clicking it. Then, click and hold the "+" or"-" button depending on the desired
direction of motion. The first four axes can also be moved by the arrow keys (Xand Y), PAGE UP
and PAGE DOWN keys (Z) and the [ and ] keys (A).
If "Continuous" is selected, the motion will continue as long as thebutton or key is pressed. If
another value is selected, the machine will move exactly the displayed distanceeach time the button
is clicked or the key is pressed. By default, the available values are:
0.1000, 0.0100, 0.0010, 0.0001
See the Configure section of the Integrators Manual for more information onsetting the increments.
    Axis组允许你手工移动机床,该功能也称“手动进给”。首先通过鼠标单击选定要移动的轴,然后
根据移动的方向单击并按住“+”或“-”按钮即可移动该轴。前四个轴也可通过键盘操作移动:四个箭
头方向键对应移动X、Y轴,“PAGE UP”和“PAGE DOWN”键移动Z轴,“[”和“]”键移动A轴。
    如果选择了“Continuous”,运动将持续,只要鼠标按钮或键盘按键被按住。如果选择了一个值,
则每次按键按下释放一次,机床将刚好移动被选择值的距离。默认情况下,可选值包括:
    0.1000, 0.0100, 0.0010, 0.0001
    如何设置这些值,请参见综合手册关于配置的部分。
4.3.5.2  原点复归 Homing
If your machinehas home switches and a homing sequence defined for all axes the button will
read "Home All". The "Home All" button or the Ctrl-HOME keywill home all axes using the homing
sequence. Pressing the HOME key will home the current axis, even if a homingsequence is defined.
If your machine has home switches and no homing sequence is defined or not allaxes have a
homing sequence the button will read "Home" and will home the selectedaxis only. Each axis must
be selected and homed separately.
If your machine does not have home switches defined in the configuration the"Home" button will
set the current selected axis current position to be the absolute position 0for that axis and will set
the "is-homed" bit for that axis.
See the Integrators Manual for more information on homing.
    如果机床所有轴都有原点开关并且为每个轴定义了原点复归的顺序,则按钮显示为“Home All”,
单击“Home All”按钮或按键盘组合“Ctrl-HOME”将按照原点复归顺序对所有轴执行原点复归操作。
只按键盘的“HOME”按键将只对当前轴执行原点复归操作,即使该轴定义了原点复归顺序。如果机床
有原点开关但没有定义原点复归顺序,或者不是所有的轴都有原点复归顺序,则按钮显示为“Home”
并且只能对所选轴进行原点复归操作,各轴必须被单独选中才能进行原点复归操作。
    如果在机床配置里没有定义原点开关,按“Home”按钮会把当前轴的当前位置设为该轴的绝对0
位置,同时为该轴添加已经原点复归“is-homed”标志。
    关于原点复归的更多信息,参见综合手册“Integrators Manual”。
4.3.5.3  “Touch Off”按钮
By pressing"Touch Off" or the END key, the "G54 offset" for thecurrent axis is changed so that
the current axis value will be the specified value. Expressions may be enteredusing the rules for
rs274ngc programs, except that variables may not be referred to. The resultingvalue is shown as a
number.
    按“Touch Off”按钮或键盘的“END”按键,打开“Touch Off”对话框,在里面可以修改工件坐
标系(G54---G59.3)中当前轴的偏移值。偏移值也可以用表达式(符合rs274ngc编程规则)指定,只
要表达式中的变量可被引用,表达式的结果是一个数值即可。参见图4.4(英文原版图片)。
4.3.5.4  超越行程 Override Limits
By pressing"Override Limits", the machine will temporarily be allowed to jog offof a physical limit
switch. This check box is only available if a limit switch is tripped.
    勾选“Override Limits”选项,将临时允许机床用手动进给的方式超越物理行程开关。这个选项
只有在行程开关被压下时才可用。

4.3.5.5  主轴组 The “Spindle” group
The buttons onthe first row select the direction for the spindle to rotate: Counterclockwise,Stopped,
Clockwise. Counterclockwise will only show up if the pin motion.spindle-reverseis in the hal file
(it can be net trick-axis motion.spindle-reverse). The buttons on the next row increaseor
decrease the rotation speed. The checkbox on the third row allows the spindlebrake to be engaged
or released. Depending on your machine configuration, not all the items in thisgroup may appear.
Pressing the spindle start button sets the "S" speed to 1.
    第一行按钮可以选择主轴旋转的方向:Counterclockwise(逆时针), Stopped(停止),
Clockwise(顺时针)。Counterclockwise(逆时针)按钮只有在“motion.spindle-reverse引脚出现在
hal文件中”的情况下才会出现(在你的hal文件中加入“net trick-axis motion.spindle-reverse”一
行即可)。下一行的按钮用于增加或降低主轴的转速。第三行的选择框决定是否选择主轴刹车功能。并非
本组的所有条目都一定出现在界面上,这取决于你的机床配置。按主轴启动按钮启动主轴旋转,同时设置
主轴速度为“S1”。
4.3.5.6  冷却组 The “Coolant” Group
The two buttonsallow the "Mist" and "Flood" coolants to be turned on andoff. Depending on your
machine configuration, not all the items in this group may appear.
    有两个按钮,分别用于打开和关闭气冷“Mist”和水冷“Flood”。并非本组的所有条目都一定出现
在界面上,这取决于你的机床配置。
4.3.6  MDI页面
MDI, allowsG-code programs can be entered manually, one line at a time. When the machineis
not turned on, or when a program is running, the MDI controls are unavailable.
    在MDI页面,允许手工输入G代码程序,一次一行。当起床没有打开,或有一个程序正在运行时,MDI
页面的功能不可用。
History: Thisshows MDI commands that have been typed earlier in this session.
MDI Command:This allows you to enter a g-code command to be executed. Execute the command
by pressing Enter or by clicking "Go".
Active G-Codes:This shows the "modal codes" that are active in the interpreter. Forinstance,
"G54" indicates that the "G54 offset" is applied to allcoordinates that are entered. When in
Auto the Active G-Codes represent the codes after any read ahead by theinterpreter.
    History: 显示本次任务期间,前面曾经键入过的MDI命令。
    MDI Command: 在此处键入G代码命令并执行。可以按键盘“Enter”键执行或用鼠标单击“Go”按钮
执行。
    Active G-Codes: 此处显示对解释器生效的模态代码。比如如果出现“G54”,就表示将对键入的所
有坐标进行G54偏移。当工作在Auto模式时,这个区域显示经过解释器预读的G代码。

4.3.7  进给覆盖 Feed Override
By moving thisslider, the programmed feed rate can be modified. For instance, if a programrequests
F60 and the slider is set to 120%, then the resulting feed rate will be 72.
    移动滑块,可以修改编程进给速度。例如,一段程序中明确了F60的进给速度,但进给覆盖滑块被设
为120%,则实际的进给速度是72 。
4.3.8  主轴速度覆盖 Spindle Speed Override
By moving thisslider, the programmed spindle feed rate can be modified. For instance, if aprogram
requests F8000 and the slider is set to 80%, then the resulting spindle speedwill be 6400. This
item only appears when the HAL pin motion.spindle-speed-out is connected.
    移动滑块,可以修改编程主轴速度。例如,一段程序中明确了F8000的主轴速度,但主轴覆盖滑块被
设为80%,则实际的主轴速度是6400 。此选项只有在HAL引脚“motion.spindle-speed-out”被连接时才
能显示在界面上。
4.3.9  手动进给速度 Jog Speed
By moving thisslider, the speed of jogs can be modified. For instance, if the slider is setto 1 in/min,
then a .01 inch jog will complete in about .6 seconds, or 1/100 of a minute.Near the left side (slow
jogs) the values are spaced closely together, while near the right side (fastjogs) they are spaced
much further apart, allowing a wide range of jog speeds with fine control whenit is most important.
On machines with a rotary axis, a second jog speed slider is shown. This slidersets the jog rate for
the rotary axes (A, B and C).
    移动滑块,可以修改手动进给速度。例如,设定滑块到1 in/min,则手动进给0.01 in将花费0.6秒或
1/100 分钟。在滑动条左端(低速进给段)的值分布的密一些,而右端的值分布的稀疏一些,这样就有一
个很宽的手动进给速度调节范围,某些情况下这是一个很重要的特点。如果机床有一个旋转轴,会显示另
一个进给速度滑动条,可以为旋转轴(A, B and C)设定进给速度。
4.3.10  最大速度 Max Velocity
By moving thisslider, the maximum velocity can be set. This caps the maximum velocity of axisno
matter what is programed in the g code file.
    移动滑块可以设定最大速度。无论G代码程序中是如何设定的,这个值都将覆盖它。
4.4  键盘控制 Keyboard Controls
Almost allactions in AXIS can be accomplished with the keyboard. A full list of keyboardshortcuts
can be found in the AXIS Quick Reference, which can be displayed by choosingHELP > QUICK
REFERENCE. Many of the shortcuts are unavailable when in MDI mode.
    几乎对轴的所有操作都能用键盘完成。菜单命令“HELP > QUICK REFERENCE”可以打开“AXIS Quick
Reference”窗口,里面有键盘快捷键的完整列表。注意有些快捷键在MDI模式中无效。
Feed OverrideKeys
The Feed Override keys behave differently when in Manual Mode. The keys‘12345678 will select
an axis if it is programed. If you have 3 axis then ‘ will select axis 0, 1will select axis 1 and 2 will
select axis 2. The remainder of the number keys will still set the FeedOverride. When running a
program ‘1234567890 will set the Feed Override to 0% - 100%.
The most frequently used keyboard shortcuts are shown in Table 6.1.
    进给覆盖快捷键:在手动模式中进给覆盖快捷键用法有些不同,快捷键“`1234567890”将选择相应
的轴(如果有的话),比如你的机床有3个轴,“`”将选择轴0,“1”将选择轴1,“2”将选择轴2,其
它不用的数字键仍将设定进给覆盖速度。
    在运行程序时,快捷键“`1234567890”全部用于设定进给覆盖速度:从0%---100% 。
    最常用的键盘快捷键列于表6.1(参见英文原版表6.1)。
4.5  显示EMC状态 Show EMC Status
AXIS includes aprogram called "emctop" which shows some of the details of EMC’sstate. You can
run this program by invoking MACHINE > SHOW EMC STATUS
    AXIS界面包含了一个叫“emctop”的程序,该程序用于显示EMC状态的一些细节。可以运行菜单命令
“MACHINE >SHOW EMC STATUS”启动这个程序。
The name of eachitem is shown in the left column. The current value is shown in the rightcolumn.
If the value has recently changed, it is shown on a red background.
    图4.6(参见英文原版图片)中,项目的名称显示在左栏里,该项目的当前值显示在右栏里,如果该
值最近被更改过,将显示一个红色的背景。
4.6 MDI页面 MDI interface
AXIS includes aprogram called "MDI" which allows text-mode entry of MDI commands toa running
EMC session. You can run this program by opening a terminal and typing
mdi /path/to/emc.nml
Once it is running, it displays the prompt MDI>. When a blank line isentered, the machine’s current
position is shown. When a command is entered, it is sent to EMC to be executed.
This is a sample session of mdi.
$ mdi ~/emc2/configs/sim/emc.nml
MDI>
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
MDI> G1 F5 X1
MDI>
(0.5928500000000374, 0.0, 0.0, 0.0, 0.0, 0.0)
MDI>
(1.0000000000000639, 0.0, 0.0, 0.0, 0.0, 0.0)
    AXIS界面包含一个叫“MDI”的程序,该程序允许以文本方式输入MDI命令给正在运行的EMC任务。打
开一个终端窗口,键入下面命令即可运行这个程序:
    mdi /path/to/emc.nml (译者注:在我的版本上只需键入mdi就可以了,而且找不到emc.nml文件。)
    当程序运行时,显示提示符“MDI>”,输入空行,将显示机床当前坐标;输入一个命令,给命令将被
发给EMC执行。
    下面是一个运行的例子:
    $ mdi ~/emc2/configs/sim/emc.nml  (译者注:在我的版本上只需键入mdi就可以了。)
    MDI>
    (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
    MDI> G1 F5 X1
    MDI>
    (0.5928500000000374, 0.0, 0.0, 0.0, 0.0, 0.0)
    MDI>
    (1.0000000000000639, 0.0, 0.0, 0.0, 0.0, 0.0)
4.7  axis-remote 程序
AXIS includes aprogram called "axis-remote" which can send certain commands to arunning
AXIS. The available commands are shown by running axis-remote --help andinclude checking
whether AXIS is running (--ping), loading a file by name, reloading thecurrently loaded file
(--reload), and making AXIS exit (--quit).
    AXIS界面包含一个叫“axis-remote”的程序,该程序可以给正在运行的AXIS界面发送特定的命令,
可以用“axis-remote --help”查看可用的命令。可用的命令包括:检查AXIS界面是否运行(--ping)、
根据名字加载一个文件(--load)、重新加载当前文件(--reload)、退出AXIS界面(--quit)。
4.8  手动换刀 Manual Tool Change
EMC2 includes auserspace hal component called "hal_manualtoolchange", which shows awindow
(Figure 4.7) when a M6 command is issued. After the OK button is pressed,execution of the program
will continue.
The HAL configuration file configs/sim/axis_manualtoolchange.hal shows the HALcommands
necessary to use this component.
hal_manualtoolchange can be used even when AXIS is not used as the GUI. Thiscomponent is most
useful if you have presettable tools and you use the tool table.
Important Note: Rapids will not show on the preview after a T<n> isissued until the next feed move
after the M6. This can be very confusing to most users. To turn this featureoff for the current tool
change program a G1 with no move after the T<n>.
    EMC2包含了一个用户空间HAL组件叫“hal_manualtoolchange”,在遇到M6命令时该组件显示一个
窗口(图4.7(参见英文原版图片)),在按下OK按钮后,程序继续执行。
    HAL配置文件“configs/sim/axis_manualtoolchange.hal”演示了使用这个组件所必须的HAL命令。
    即使不用AXIS做界面,这个组件也可以被使用。当你有预设的刀具并使用刀库(tool table)时这
个组件最有用。
    重要提示:应用T<n>命令后,快速移动的轨迹不会在预览图里显示出来,直到遇到M6指令后的进给
移动命令时才会重新显示。这对大多数用户可能难以理解,要避免这种情况,在T<n>指令后加一条不移
动距离的G1指令即可。
4.9  Python模块 Python Modules
AXIS includesseveral Python modules which may be useful to others. For more information onone
of these modules, use "pydoc <module name>" or read the sourcecode. These modules include:
emc provides access to the emc command, status, and error channels
gcode provides access to the rs274ngc interpreter
rs274 provides additional tools for working with rs274ngc files
hal allows the creation of userspace HAL components written in Python
_togl provides an OpenGL widget that can be used in Tkinter applications
minigl provides access to the subset of OpenGL used by AXIS
To use these modules in your own scripts, you must ensure that the directorywhere they reside
is on Python’s module path. When running an installed version of EMC2, thisshould happen
automatically. When running "in-place", this can be done by usingscripts/emc-environment.
    AXIS包含了几个Python模块可被其它程序使用。使用“pydoc <module name>”命令或者阅读源代码
可以了解这些模块的更多信息。这些模块包括:
    emc :提供emc命令、状态、错误通道的接口。
    gcode :提供rs274ngc G代码解释器的接口。
    rs274 :提供处理rs274ngc文件的额外工具。
    hal :允许创建Python语言编写的用户空间HAL组件。
    _togl :提供用于Tkinter应用程序的OpenGL小零件。
    minigl :提供用于AXIS的OpenGL的子集的接口。
    要在你的脚本中使用这些模块,必须确保它们所在的目录出现在Python的模块路径中,如果运行的是
安装版的EMC2,这个问题在安装EMC2时被自动解决了,否则,可以运行“ scripts/emc-environment”脚
本以保证“in-place”运行。
4.10  车床模式 Lathe Mode
By including theline
LATHE=1
in the [DISPLAY] section of the ini file, AXIS selects lathe mode. The"Y" axis is not shown in
coordinate readouts, the view is changed to show the Z axis extending to theright and the X axis
extending towards the bottom of the screen, and several controls (such as thosefor preset views)
are removed.
Pressing "V" zooms out to show the entire file, if one is loaded.
When in lathe mode, the shape of the loaded tool (if any) is shown.
    在ini文件的DISPLAY段包含下面一行将使AXIS选择车床模式运行:
    LATHE=1
    车床模式下,Y轴不会显示在坐标显示区,视图中Z轴向右伸展,X轴向屏幕下方伸展,某些控制功能
(如几个预设的预览方式)被移除了。
    如果加载了一个文件,按“V”键将显示整个文件。
    车床模式下,刀具的形状看起来也不一样了(参见英文原版图4.8)。
4.11  高级配置
For moreinformation on ini file settings that can change how AXIS works see the INIFile/Sections/[DISPLAY]
Section of Configuration chapter in the Integrators manual.
    关于如何设置ini文件从而改变AXIS工作方式的更多信息,参见综合手册Integrators manual的
“INIFile/Sections/[DISPLAY]”部分。
4.11.1  程序过滤器 Program Filters
AXIS has theability to send loaded files through a "filter program". This filtercan do any desired
task: Something as simple as making sure the file ends with ’M2’, or somethingas complicated as
detecting whether the input is a depth image, and generating g-code to mill theshape it defines.
The [FILTER] section of the ini file controls how filters work. First, for eachtype of file, write a
PROGRAM_EXTENSION line. Then, specify the program to execute for each type offile. This program
is given the name of the input file as its first argument, and must writers274ngc code to standard
output. This output is what will be displayed in the text area, previewed inthe display area, and
executed by EMC when "Run". The following lines add support for the"image-to-gcode" converter
included with EMC2:
[FILTER]
PROGRAM_EXTENSION = .png,.gif Greyscale Depth Image
png = image-to-gcode
gif = image-to-gcode
    AXIS用户界面有能力把被加载文件发给一个过滤程序,这个过滤程序可以对该文件做任何事情:简单
工作如“判断该文件是否以M2结尾”,或者复杂工作如“判断该文件是否是深度图像,生成 G代码并按照
形状把它加工出来”都可以做。ini 文件的“FILTER”段就是控制过滤程序工作的段。首先,对每个类型
的文件都要写一个“PROGRAM_EXTENSION ”行,然后指定处理每一类文件的处理程序(过滤程序),该处
理程序把被加载文件名作为第一个参数,并且产生rs274ngc代码作为标准输出,这些rs274ngc代码将会显
示在AXIS用户界面的文本区、预览区且可以被EMC2执行以加工出相应的产品。以下的行添加了EMC2自带的
“image-to-gcode”转换器的支持:
    [FILTER]
    PROGRAM_EXTENSION = .png,.gif Greyscale Depth Image
    png = image-to-gcode
    gif = image-to-gcode
It is alsopossible to specify an interpreter:
PROGRAM_EXTENSION = .py Python Script
py = python
In this way, any Python script can be opened, and its output is treated as g-code.One such example
script is available at nc_files/holecircle.py. This script creates g-code fordrilling a series of
holes along the circumference of a circle.
    也可以指定一个解释器:
    PROGRAM_EXTENSION = .py Python Script
    py = python
    这样就可以打开Python脚本了,这个脚本的输出被当作G代码程序看待。“nc_files/holecircle.py”
就是这样的一个例子脚本,这个脚本产生一段沿圆周钻一系列孔的G代码程序(参见英文原版图4.9)。
If theenvironment variable AXIS_PROGRESS_BAR is set, then lines written to stderr ofthe form
FILTER_PROGRESS=%d
will set the AXIS progress bar to the given percentage. This feature should beused by any filter that
runs for a long time.
    如果环境变量“AXIS_PROGRESS_BAR”被设置,则(过滤器程序)用以下格式写“stderr”会设置 AXIS进
度条到相应的百分比。
    FILTER_PROGRESS=%d
    任何运行时间长的过滤器程序都应该使用此功能。
4.11.2  X 资源数据库 The X Resource Database
The colors ofmost elements of the AXIS user interface can be customized through the XResource
Database. The sample file axis_light_background changes the colors of thebackplot window to a
"dark lines on white background" scheme, and also serves as a referencefor the configurable items
in the display area. The sample file axis_big_dro changes the position readoutto a larger size
font. To use these files:
xrdb -merge /usr/share/doc/emc2/axis_light_background
xrdb -merge /usr/share/doc/emc2/axis_big_dro
    AXIS用户接口的大多数要素的颜色可以通过X资源数据库“X Resource Database”修改。例子文件
“axis_light_background”修改轨迹模拟窗口的配色方案为“黑线条白背景”,这个例子可同时作为
显示区域可配置项目的参考文件。例子文件“axis_big_dro”把坐标位置读数显示为大字体。要使用这
两个文件,用下面的命令:
    xrdb -merge/usr/share/doc/emc2/axis_light_background
    xrdb -merge /usr/share/doc/emc2/axis_big_dro
For informationabout the other items which can be configured in Tk applications, see the Tkman
pages.
Because modern desktop environments automatically make some settings in the XResource Database
that adversely affect AXIS, by default these settings are ignored. To make theX Resource Database
items override AXIS defaults, include the following line in your X Resources:
*Axis*optionLevel: widgetDefault
this causes the built-in options to be created at the option level"widgetDefault", so that X Resources
(which are level "userDefault") can override them.
    关于Tk应用程序能够配置的其它项目的更多信息,参见Tk的“man page”。
    因为现代的桌面系统环境自动设置几个会反向影响AXIS的“X Resource Database”参数,所以AXIS
默认会忽略掉这些设置,要让这些设置生效并覆盖AXIS的默认设置,在“X Resources”中包含下面的行:
    *Axis*optionLevel: widgetDefault
    这将使AXIS的内建选项被创建为“widgetDefault”级别,于是“X Resources”选项(级别是
“userDefault”)就能够覆盖AXIS的内建选项了。
4.11.3   外部进给轮 Physical jog wheels
To improve theinteraction of AXIS with physical jog wheels, the axis currently selected inthe GUI
is also reported on a pin with a name like axisui.jog.x. Except for a shorttime when the active
axis has just been changed, exactly one of these pins is TRUE at one time, andthe rest are FALSE.
After AXIS has created these HAL pins, it executes the halfile named in[HAL]POSTGUI_HALFILE.
Unlike [HAL]HALFILE, only one such file may be used.
    为了提高AXIS界面和外部进给轮的交互性能,在界面里的“当前选定轴”也通过一个名字类似于
“axisui.jog.x”的引脚把信息发出去。除了切换当前选定轴的那一瞬间,在同一时间这些引脚里只
有一个引脚是TRUE状态,其它引脚都是FALSE状态。
    AXIS在创建这些HAL引脚以后它执行由“[HAL]POSTGUI_HALFILE”指定名字的hal文件,不像
“[HAL]HALFILE”可以指定多个hal文件名字,“[HAL]POSTGUI_HALFILE”只能指定一个hal文件名字。
4.11.4  axisrc 文件
If it exists,the contents of ~/.axisrc are executed as Python source code just before theAXIS gui
is displayed. The details of what may be written in the axisrc are subject tochange during the
development cycle.
The following adds Control-Q as a keyboard shortcut for Quit and turns on"Distance to go" by
default.
root_window.bind("<Control-q>", "destroy .")
help2.append(("Control-Q", "Quit"))
vars.show_distance_to_go.set(1)
    如果“~/.axisrc”文件存在,该文件的内容将在AXIS图形用户界面显示之前被当作Python源代
码执行。该文件的内容随着开发进度可能被随时改变。在该文件中添加以下内容将为AXIS增加一个
退出AXIS程序的键盘快捷键“Control-Q”,该段代码还默认打开了轨迹预览界面的“DTG”(即
“Distance to go”)坐标显示。
    root_window.bind("<Control-q>","destroy .")
    help2.append(("Control-Q", "Quit"))
    vars.show_distance_to_go.set(1)
4.11.5  外部编辑器 External Editor
The menu optionsFile > Edit... and File > Edit Tool Table... become available afterdefining
the editor in the ini section [DISPLAY]. Useful values include EDITOR=gedit and
EDITOR=gnome-terminal -e vim. For more information, see the DISPLAY section ofthe INI
Configuration Chapter in the Integrators Manual.
    菜单命令“File > Edit...”和“File > Edit Tool Table...”只有在ini文件的“DISPLAY”段
中定义了编辑器以后才可用,能够使用的编辑器包括“EDITOR=gedit”和“EDITOR=gnome-terminal -e vim”。
更多信息参见综合手册INI配置一章中关于DISPLAY段的描述。
4.11.6  虚拟控制面板 Virtual Control Panel
AXIS can displaya custom virtual control panel in the right-hand pane. You can program buttons,
indicators, data displays and more. For more information, see the IntegratorsManual.
    AXIS可以在界面右边显示一个用户定制的虚拟控制面板“virtual control panel”,可以在上面
放置按钮、指示器、数据显示等等。更多信息参见综合手册Integrators Manual 。
4.11.7  特殊注释 Special Comments
Special commentscan be inserted into the G Code file to control how the preview of AXIS behaves.In
the case where you want to limit the drawing of the preview use these specialcomments. Anything
between the (AXIS,hide) and (AXIS,show) will not be drawn during the preview.The (AXIS,hide) and
(AXIS,show) must be used in pairs with the (AXIS,hide) being first. Anythingafter a (AXIS,stop) will
not be drawn during the preview.
These comments are useful to unclutter the preview display (for instance whiledebugging a larger
g-code file, one can disable the preview on certain parts that are alreadyworking OK).
(AXIS,hide) Stops the preview (must be first)
(AXIS,show) Resumes the preview (must follow a hide)
(AXIS, stop) Stops the preview from here to the end of the file.
    可以在G代码文件中插入特殊注释来控制AXIS预览功能的行为方式。如果你想限制轨迹预览绘图,
可以使用这些特殊注释。在轨迹预览过程中,任何处于“(AXIS,hide)”和“ (AXIS,show)”之间的
G代码轨迹不会被画出来,“(AXIS,hide)”和“ (AXIS,show)”必须成对使用且“(AXIS,hide)”在
前,任何处于“(AXIS,stop)”之后的G代码轨迹不会被画出来。
    (AXIS,hide) :停止轨迹预览(必须在前)。
   
    (AXIS,show) :恢复轨迹预览(必须跟在hide后面)。
    (AXIS,stop) :从当前位置直到文件结束都禁止轨迹预览。

(译者注:5、6、7、8 章暂不翻译,下面翻译第 9 章)。。。。。。。。。。。。。。。。。。。
(译者注:未完待续。。。。)






欢迎光临 中华DIY论坛 (http://wap.eric1819.com/) Powered by Discuz! X3.2