Skip to content
......@@ -21,6 +21,9 @@
.. |LinuxCNC| replace:: Linux CNC
.. _LinuxCNC: http://linuxcnc.org/docs/2.7/html/gcode/overview.html
.. |NIST| replace:: NIST
.. _NIST: https://www.nist.gov
.. |Machinekit| replace:: Machinekit
.. _Machinekit: http://www.machinekit.io
......
......@@ -2,7 +2,7 @@
####################################################################################################
#
# PythonicGcodeMachine - @licence_header_description@
# PythonicGcodeMachine - A Python G-code Toolkit
# Copyright (C) 2018 Fabrice Salvaire
#
####################################################################################################
......@@ -313,4 +313,4 @@ intersphinx_mapping = {'http://docs.python.org/': None}
# https://github.com/jdillard/sphinx-sitemap
#
site_url = '@project_url@' # could use setup_dict
site_url = 'https://github.com/FabriceSalvaire/pythonic-gcode-machine' # could use setup_dict
......@@ -7,7 +7,7 @@
==============
G-Code Parser
-------------
=============
The RS-274 parser is generated automatically from the grammar defined in the paper |NIST-RS-274|_
(Appendix E) using the generator `PLY <https://www.dabeaz.com/ply/ply.html>`_ which implement a
......@@ -19,6 +19,92 @@ The parser construct an `abstract syntax tree (AST)
User can subclass this parser to support a derived G-code flavour.
G-code flavours
---------------
===============
The different flavours are partly handled in |YAML|_ files.
G-code Generation and Simulation
================================
Computational Geometry Engine
=============================
The computational geometry engine requires these features :
* import standard 2D object file, e.g. SVG and DXF
* import standard 3D object file, e.g. STL
* 2D path erosion and dilation, e.g. to compute cutter radius compensation
* 2D/3D Minkowski sum along a path
* 3D extrusion
* 3D Boolean operation : object - tool path
List of the Main Open Source Computational Geometry Algorithms Libraries
------------------------------------------------------------------------
The Computational Geometry Algorithms Library
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`CGAL <https://www.cgal.org>`_ is a software project that provides easy access to efficient and
reliable geometric algorithms in the form of a C++ library. CGAL is used in various areas needing
geometric computation, such as geographic information systems, computer aided design, molecular
biology, medical imaging, computer graphics, and robotics.
CGAL is used in:
* many academic projects
* `OpenSCAD <http://www.openscad.org>`_
Git repository and Python binding:
* https://github.com/CGAL/cgal
* https://github.com/CGAL/cgal-swig-bindings
* https://github.com/sciencectn/cgal-bindings
STL (STereoLithography) format support:
* https://en.wikipedia.org/wiki/STL_(file_format)
* https://doc.cgal.org/latest/Polyhedron/classCGAL_1_1Polyhedron__incremental__builder__3.html
* include/CGAL/IO/Polyhedron_builder_from_STL.h
* https://github.com/CGAL/cgal/blob/master/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp
* demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp
* https://github.com/CGAL/cgal/blob/master/Polyhedron_IO/include/CGAL/IO/STL_reader.h
* include/CGAL/IO/STL_reader.h
* include/CGAL/IO/STL_writer.h
Open CASCADE
~~~~~~~~~~~~
* https://www.opencascade.com
* `Open CASCADE Community Edition <https://github.com/tpaviot/oce>`_
* https://github.com/tpaviot/pythonocc-core — python wrapper
Open CASCADE is used in:
* `Salome <http://www.salome-platform.org>`_
* `FreeCAD <https://freecadweb.org>`_
.. `code_aster <https://www.code-aster.org>`_
G-code Visualisation
====================
The open source `Qt <https://www.qt.io>`_ framework provide a multi-platform User Interface framework with 3D support.
* `Qt 3D <https://doc.qt.io/qt-5/qt3d-index.html>`_
Qt 3D provides functionality for near-realtime simulation systems with support for 2D and 3D rendering in both Qt C++ and Qt Quick applications.
* `QMesh Class <https://doc.qt.io/qt-5/qt3drender-qmesh.html>`_
QMesh supports the following formats:
* Wavefront OBJ
* Stanford Triangle Format PLY
* STL (STereoLithography)
* Autodesk FBX if the SDK is installed
.. -*- mode: rst -*-
PythonicGcodeMachine features:
* a compliant RS-274 / ISO G-code parser which is automatically generated from grammar and easy to
derivate to support other flavours,
* an abstract syntax tree (AST) API,
* some G-code flavour aspects are handled by YAML files for maximum flexibility,
* tools to manipulate and validate G-code,
* and more ..
PythonicGcodeMachine supports these G-code flavours:
* RS-274 **(full support)**
* Fanuc *(partially)*
* Heidenhain *(partially)*
* LinuxCNC *(partially)*
.. include:: ../abbreviation.txt
.. _gcode-reference-page:
==================
G-code Reference
==================
.. toctree::
rs-274/index.rst
linuxcnc/index.rst
= Coordinate Systems
[[cha:coordinate-system]]
== Introduction
This chapter introduces you to offsets as they are used by the LinuxCNC.
These include:
* Machine Coordinates (G53)
* Nine Coordinate System Offsets (G54-G59.3)
* Global Offsets (G92) and Local Offsets (G52)
[[sec.machine-corrdinate-system]]
== Machine Coordinate System
When LinuxCNC is started the postions of each axis is the machine origin. Once
an axis homed the the machine orgin for that axis is set to the homed position.
The machine origin is the machine coordinate system which all other coordinate
systems are based. The <<gcode:g53,G53>> G code can be used to move in the
machine coordinate system.
== Coordinate Systems
.Example of Coordinate Systems
image::images/offsets.png[align="center", alt="Example of Coordinate Systems"]
.Coordinate System Offsets
* G54 - use coordinate system 1
* G55 - use coordinate system 2
* G56 - use coordinate system 3
* G57 - use coordinate system 4
* G58 - use coordinate system 5
* G59 - use coordinate system 6
* G59.1 - use coordinate system 7
* G59.2 - use coordinate system 8
* G59.3 - use coordinate system 9
Coordinate system offsets are used to shift the coordinate system from the
machine coordinate system. This allows the G code to be programmed for the
part without regard to the part location on the machine. Using coordinate
system offsets would allow you to machine parts in multiple locations with the
same G code.
The values for offsets are stored in the VAR file that is requested by the INI
file during the startup of an LinuxCNC.
In the VAR file scheme, the first variable number stores the X offset,
the second the Y offset and so on for all nine axes. There are numbered
sets like this for each of the coordinate system offsets.
Each of the graphical interfaces has a way to set values for these
offsets. You can also set these values by editing the VAR file itself
and then restart LinuxCNC so that the LinuxCNC reads the new values
however this is not the recommended way. Using G10, G52, G92, G28.1,
etc are better ways to set the variables.
.Example of G55 parameters
[width="40%",cols="^,^,^",options="header"]
|====
|Axis | Variable | Value
| X |5241 |2.000000
| Y |5242 |1.000000
| Z |5243 |-2.000000
| A |5244 |0.000000
| B |5245 |0.000000
| C |5246 |0.000000
| U |5247 |0.000000
| V |5248 |0.000000
| W |5249 |0.000000
|====
You should read this as moving the zero positions of G55 to X = 2
units, Y= 1 unit, and Z = -2 units away from the absolute zero position.
Once there are values assigned, a call to G55 in a program block would
shift the zero reference by the values stored. The following line would
then move each axis to the new zero position. Unlike G53, G54 through
G59.3 are modal commands. They will act on all blocks of code after one
of them has been set. The program that might be run using
fixture offsets would require only a single coordinate
reference for each of the locations and all of the work to be done
there. The following code is offered as an example of making a square
using the G55 offsets that we set above.
----
G55 ; use coordinate system 2
G0 X0 Y0 Z0
G1 F2 Z-0.2000
X1
Y1
X0
Y0
G0 Z0
G54 ; use coordinate system 1
G0 X0 Y0 Z0
M2
----
In this example the G54 near the end leaves the G54 coordinate system with all
zero offsets so that there is a modal code for the absolute machine based axis
positions. This program assumes that we have done that and use the ending
command as a command to machine zero. It would have been possible to use G53
and arrive at the same place but that command would not have been modal and
any commands issued after it would have returned to using the G55 offsets
because that coordinate system would still be in effect.
=== Default Coordinate System
One other variable in the VAR file becomes important when we think
about offset systems. This variable is named 5220. In the default files
its value is set to 1.00000. This means that when the LinuxCNC starts up it
should use the first coordinate system as its default. If you set this
to 9.00000 it would use the ninth offset system as its default for
start up and reset. Any value other than an integer (decimal really)
between 1 and 9, or a missing 5220 variable will cause the LinuxCNC to
revert to the default value of 1.00000 on start up.
=== Setting Coordinate System Offsets
The G10 L2x command can be used to set coordinate system offsets:
* 'G10 L2 P(1-9)' - Set offset(s) to a value. Current position irrelevant.
(see <<gcode:g10-l2,G10 L2>> for details)
* 'G10 L20 P(1-9)' - Set offset(s) so current position becomes a value.
(see <<gcode:g10-l20,G10 L20>> for details)
== Local and Global Offsets[[sec:g52-and-g92-offsets]]
=== The G52 command[[sec:g52]]
'G52' is used in a part program as a temporary "local coordinate
system offset" within the workpiece coordinate system. An example use
case is when machining several identical features at different
locations on a part. For each feature, 'G52' programs a local
reference point within workpiece coordinates, and a subprogram is
called to machine the feature relative to that point.
'G52' axis offsets are programmed relative to workpiece coordinate
offsets 'G54' through 'G59.3'. As a local offset, 'G52' is applied
after the workpiece offset, including rotation. Thus, a part feature
will be machined identically on each part regardless of the part's
orientation on the pallet.
[CAUTION]
As a temporary offset, set and unset within the localized scope of a
part program, in other g-code interpreters 'G52' does not persist
after machine reset, 'M02' or 'M30'. In LinuxCNC, 'G52' shares
parameters with 'G92', which, for historical reasons, *does* persist
these parameters. See <<sec:g92-persistence-cautions,G92 Persistence
Cautions>> below.
[CAUTION]
'G52' and 'G92' share the same offset registers. Therefore, setting
'G52' will override any earlier 'G92' setting, and 'G52' will persist
across machine reset when 'G92' persistence is enabled. These
interactions may result in unexpected offsets. See
<<sec:g92-g52-interaction-cautions,G92 and G52 Interaction Cautions>>
below.
Programming 'G52 X1 Y2' offsets the current workpiece coordinate
system X axis by 1 and Y axis by 2. Accordingly, on the DRO, the
current tool position's X and Y coordinates will be reduced by 1 and
2, respectively. Axes unset in the command, such as Z in the previous
example, will be unaffected: any previous 'G52' Z offset will remain
in effect, and otherwise the Z offset will be zero.
The temporary local offset may be canceled with 'G52 X0 Y0'. Any axes
not explicitly zeroed will retain the previous offset.
'G52' shares the same offset registers as 'G92', and thus
'G52' is visible on the DRO and preview labeled with 'G92'.
=== The G92 commands[[sec:g92-commands]]
'G92' is typically used in two conceptually different ways: as a
"global coordinate system offset" or as a "local coordinate system
offset". The 'G92' set of commands includes:
* 'G92' - This command, when used with axis names, sets values to offset
variables.
* 'G92.1' - This command sets zero values to the G92 variables.
* 'G92.2' - This command suspends but does not zero out the G92
variables.
* 'G92.3' - This command applies offset values that have been suspended.
As a global offset, 'G92' is used to shift all workpiece coordinate
systems 'G54' through 'G59.3'. An example use case is when machining
several identical parts in fixtures with known locations on a pallet,
but the pallet location may change between runs or between machines.
Each fixture location offset, relative to a reference point on the
pallet, is preset in one of the workpiece coordinate systems, 'G54'
through 'G59.3', and 'G92' is used to "touch off" on the pallet
reference point. Then, for each part, the corresponding workpiece
coordinate system is selected and the part program is executed.
[NOTE]
'G10 R-' workpiece coordinate system rotation is specific to the
'rs274ngc' interpreter, and the 'G92' offset is applied 'after'
rotation. When using 'G92' as a global offset, workpiece coordinate
system rotations may have unexpected results.
As a local coordinate system, 'G92' is used as a temporary offset
within the workpiece coordinate system. An example use case is when
machining a part with several identical features at different
locations. For each feature, 'G92' is used to set a local reference
point, and a subprogram is called to machine the feature starting at
that point.
[NOTE]
The use of 'G92' is discouraged for programming with local coordinate
systems in a part program. Instead, see <<sec:g52,'G52'>>, a local
coordinate system offset more intuitive when desired offset relative
to the workpiece is known but current tool location may not be known.
Programming 'G92 X0 Y0 Z0' sets the current tool location to the
coordinates X0, Y0, and Z0, without motion. G92 *does not* work from
absolute machine coordinates. It works from *current location*.
'G92' also works from current location as modified by any other
offsets that are in effect when the 'G92' command is invoked. While
testing for differences between work offsets and actual offsets it was
found that a 'G54' offset could cancel out a 'G92' and thus give the
appearance that no offsets were in effect. However, the 'G92' was
still in effect for all coordinates and did produce expected work
offsets for the other coordinate systems.
By default, 'G92' offsets are restored after the machine is started.
Programmers that wish for Fanuc behavior, where 'G92' offsets are
cleared at machine start and after a reset or program end, may disable
'G92' persistence by setting 'DISABLE_G92_PERSISTENCE = 1' in the
'[RS274NGC]' section of the '.ini' file.
[NOTE]
It is good practice to clear the 'G92' offsets at the end of their use
with 'G92.1' or 'G92.2'. When starting up LinuxCNC with 'G92'
persistence enabled (the default), any offsets in the 'G92' variables
will be applied when an axis is homed. See
<<sec:g92-persistence-cautions,G92 Persistence Cautions>> below.
=== Setting G92 Values
G92 commands work from current axis location and add and subtract
correctly to give the current axis position the value assigned by the
G92 command. The effects work even though previous offsets are in.
So if the X axis is currently showing 2.0000 as its position a 'G92 X0'
will set an offset of -2.0000 so that the current location of X becomes
zero. A 'G92 X2' will set an offset of 0.0000 and the displayed position
will not change. A 'G92 X5.0000' will set an offset of 3.0000 so that the
current displayed position becomes 5.0000.
=== G92 Persistence Cautions[[sec:g92-persistence-cautions]]
By default, the values of a 'G92' offset will be saved in the VAR file
and be restored after a machine reset or startup.
The G92 parameters are:
* 5210 - Enable/disable flag (1.0/0.0)
* 5211 - X Axis Offset
* 5212 - Y Axis Offset
* 5213 - Z Axis Offset
* 5214 - A Axis Offset
* 5215 - B Axis Offset
* 5216 - C Axis Offset
* 5217 - U Axis Offset
* 5218 - V Axis Offset
* 5219 - W Axis Offset
where 5210 is the 'G92' enable flag (1 for enabled, 0 for disabled)
and 5211 to 5219 are the axis offsets. If you are seeing unexpected
positions as the result of a commanded move, as a result of storing an
offset in a previous program and not clearing them at the end then
issue a G92.1 in the MDI window to clear the stored offsets.
If G92 values exist in the VAR file when LinuxCNC starts up, the G92
values in the var file will be applied to the values of the current
location of each axis. If this is home position and home position is
set as machine zero everything will be correct. Once home has been
established using real machine switches, or by moving each axis to a known
home position and issuing an axis home command, any G92 offsets will be
applied. If you have a G92 X1 in effect when you home the X axis the
DRO will read 'X: 1.000' instead of the expected 'X: 0.000' because the
G92 was applied to the machine origin. If you issue a G92.1 and the DRO
now reads all zeros then you had a G92 offset in effect when you last
ran LinuxCNC.
Unless your intention is to use the same G92 offsets in the next
program, the best practice is to issue a G92.1 at the end of any G
code files where you use G92 offsets.
When a program is aborted during processing that has 'G92' offsets in
effect a startup will cause them to become active again. As a
safeguard, always have your preamble to set the environment as you
expect it. Additionally, 'G92' persistence may be disabled by setting
'DISABLE_G92_PERSISTENCE = 1' in the '[RS274NGC]' section of the
'.ini' file.
=== G92 and G52 Interaction Cautions[[sec:g92-g52-interaction-cautions]]
'G52' and 'G92' share the same offset registers. Unless 'G92'
persistence is disabled in the '.ini' file (see <<sec:g92-commands,G92
Commands>>), 'G52' offsets will also persist after machine reset,
'M02' or 'M30'. Beware that a 'G52' offset in effect during a program
abort may result in unintended offsets when the next program is run.
See <<sec:g92-persistence-cautions,G92 Persistence Cautions>> above.
== Sample Programs Using Offsets
=== Sample Program Using Workpiece Coordinate Offsets
This sample engraving project mills a set of four .1 radius circles in
roughly a star shape around a center circle. We can setup the
individual circle pattern like this.
---------------------------------------------------------------------
G10 L2 P1 X0 Y0 Z0 (ensure that G54 is set to machine zero)
G0 X-0.1 Y0 Z0
G1 F1 Z-0.25
G3 X-0.1 Y0 I0.1 J0
G0 Z0
M2
---------------------------------------------------------------------
We can issue a set of commands to create offsets for the four other
circles like this.
-----------------------------------------------------------
G10 L2 P2 X0.5 (offsets G55 X value by 0.5 inch)
G10 L2 P3 X-0.5 (offsets G56 X value by -0.5 inch)
G10 L2 P4 Y0.5 (offsets G57 Y value by 0.5 inch)
G10 L2 P5 Y-0.5 (offsets G58 Y value by -0.5 inch)
-----------------------------------------------------------
We put these together in the following program:
---------------------------------------------------------------------
(a program for milling five small circles in a diamond shape)
G10 L2 P1 X0 Y0 Z0 (ensure that G54 is machine zero)
G10 L2 P2 X0.5 (offsets G55 X value by 0.5 inch)
G10 L2 P3 X-0.5 (offsets G56 X value by -0.5 inch)
G10 L2 P4 Y0.5 (offsets G57 Y value by 0.5 inch)
G10 L2 P5 Y-0.5 (offsets G58 Y value by -0.5 inch)
G54 G0 X-0.1 Y0 Z0 (center circle)
G1 F1 Z-0.25
G3 X-0.1 Y0 I0.1 J0
G0 Z0
G55 G0 X-0.1 Y0 Z0 (first offset circle)
G1 F1 Z-0.25
G3 X-0.1 Y0 I0.1 J0
G0 Z0
G56 G0 X-0.1 Y0 Z0 (second offset circle)
G1 F1 Z-0.25
G3 X-0.1 Y0 I0.1 J0
G0 Z0
G57 G0 X-0.1 Y0 Z0 (third offset circle)
G1 F1 Z-0.25
G3 X-0.1 Y0 I0.1 J0
G0 Z0
G58 G0 X-0.1 Y0 Z0 (fourth offset circle)
G1 F1 Z-0.25
G3 X-0.1 Y0 I0.1 J0
G54 G0 X0 Y0 Z0
M2
---------------------------------------------------------------------
Now comes the time when we might apply a set of G92 offsets to this
program. You'll see that it is running in each case at Z0. If the mill
were at the zero position, a G92 Z1.0000 issued at the head of the
program would shift everything an inch. You might also shift the
whole pattern around in the XY plane by adding some X and Y offsets
with G92. If you do this you should add a G92.1 command just before the
M2 that ends the program. If you do not, other programs that you might
run after this one will also use that G92 offset. Furthermore it would
save the G92 values when you shut down the LinuxCNC and they will be
recalled when you start up again.
=== Sample Program Using G52 Offsets
(To be written)
[[cha:cnc-machine-overview]]
= CNC Machine Overview
This section gives a brief description of how a CNC machine is viewed
from the input and output ends of the Interpreter.
== Mechanical Components
A CNC machine has many mechanical components that may be controlled or
may affect the way in which control is exercised. This section
describes the subset of those components that interact with the
Interpreter. Mechanical components that do not interact directly with
the Interpreter, such as the jog buttons, are not described here, even
if they affect control.
=== Axes
Any CNC machine has one or more Axes. Different types of CNC machines
have different combinations. For instance, a '4-axis milling machine'
may have XYZA or XYZB axes. A lathe typically has XZ axes. A
foam-cutting machine may have XYUV axes. In LinuxCNC, the case of a XYYZ
'gantry' machine with two motors for one axis is better handled by
kinematics rather than by a second linear axis. footnote:[If the
motion of mechanical components is not independent, as with
hexapod machines, the RS274/NGC language and the canonical machining
functions will still be usable, as long as the lower levels of control
know how to control the actual mechanisms to produce the same relative
motion of tool and workpiece as would be produced by independent axes.
This is called 'kinematics'.]
.Primary Linear Axes (((axes, primary linear)))
The X, Y, and Z axes produce linear motion in three mutually
orthogonal directions.
.Secondary Linear Axes (((axes, secondary linear)))
The U, V, and W axes produce linear motion in three mutually
orthogonal directions. Typically, X and U are parallel, Y and V are
parallel, and Z and W are parallel.
.Rotational Axes (((axes, rotational)))
The A, B and C axes produce angular motion (rotation). Typically, A
rotates around a line parallel to X, B rotates around a line parallel
to Y, and C rotates around a line parallel to Z.
=== Spindle (((spindle)))
A CNC machine typically has a spindle which holds one cutting tool,
probe, or the material in the case of a lathe. The spindle may or may
not be controlled by the CNC software.
LinuxCNC offers suport for up to 8 spindles, which can be individually
controlled and can run simultaneously at different speeds and in different
directions.
=== Coolant (((coolant)))
If a CNC machine has components to provide mist coolant and/or flood
coolant they can be controlled by G codes.
=== Feed and Speed Override
A CNC machine can have separate feed and speed override controls,
which let the operator specify that the actual feed rate or spindle
speed used in machining at some percentage of the programmed rate.
=== Block Delete Switch
A CNC machine can have a block delete switch. See the
<<sub:block-delete-switch,Block Delete>> Section.
=== Optional Program Stop Switch
A CNC machine can have an optional program stop switch. See the
<<sub:optional-program-stop,Optional Program Stop>> Section.
== Control and Data Components
=== Linear Axes
The X, Y, and Z axes form a standard right-handed coordinate system of
orthogonal linear axes. Positions of the three linear motion mechanisms
are expressed using coordinates on these axes.
The U, V and W axes also form a standard right-handed coordinate
system. X and U are parallel, Y and V are parallel, and Z and W are
parallel (when A, B, and C are rotated to zero).
=== Rotational Axes
The rotational axes are measured in degrees as wrapped linear axes in
which the direction of positive rotation is counterclockwise when
viewed from the positive end of the corresponding X, Y, or Z-axis. By
'wrapped linear axis', we mean one on which the angular position
increases without limit (goes towards plus infinity) as the axis turns
counterclockwise and deceases without limit (goes towards minus
infinity) as the axis turns clockwise. Wrapped linear axes are used
regardless of whether or not there is a mechanical limit on rotation.
Clockwise or counterclockwise is from the point of view of the
workpiece. If the workpiece is fastened to a turntable which turns on a
rotational axis, a counterclockwise turn from the point of view of the
workpiece is accomplished by turning the turntable in a direction that
(for most common machine configurations) looks clockwise from the point
of view of someone standing next to the machine. footnote:[If the
parallelism requirement is violated, the system builder will
have to say how to distinguish clockwise from counterclockwise.]
=== Controlled Point
The controlled point is the point whose position and rate of motion
are controlled. When the tool length offset is zero (the default
value), this is a point on the spindle axis (often called the gauge
point) that is some fixed distance beyond the end of the spindle,
usually near the end of a tool holder that fits into the spindle. The
location of the controlled point can be moved out along the spindle
axis by specifying some positive amount for the tool length offset.
This amount is normally the length of the cutting tool in use, so that
the controlled point is at the end of the cutting tool. On a lathe,
tool length offsets can be specified for X and Z axes, and the
controlled point is either at the tool tip or slightly outside it
(where the perpendicular, axis-aligned lines touched by the 'front' and
'side' of the tool intersect).
=== Coordinated Linear Motion
To drive a tool along a specified path, a machining center must often
coordinate the motion of several axes. We use the term 'coordinated
linear motion' to describe the situation in which, nominally, each axis
moves at constant speed and all axes move from their starting positions
to their end positions at the same time. If only the X, Y, and Z axes
(or any one or two of them) move, this produces motion in a straight
line, hence the word 'linear' in the term. In actual motions, it is
often not possible to maintain constant speed because acceleration or
deceleration is required at the beginning and/or end of the motion. It
is feasible, however, to control the axes so that, at all times, each
axis has completed the same fraction of its required motion as the
other axes. This moves the tool along same path, and we also call this
kind of motion coordinated linear motion.
Coordinated linear motion can be performed either at the prevailing
feed rate, or at traverse rate, or it may be synchronized to the
spindle rotation. If physical limits on axis speed make the desired
rate unobtainable, all axes are slowed to maintain the desired path.
[[sub:feed-rate]](((Feed Rate)))
=== Feed Rate
The rate at which the controlled point moves is nominally a steady
rate which may be set by the user. In the Interpreter, the feed
rate is interpreted as follows (unless 'inverse time feed' or 'feed
per revolution' modes are being used, in which case see Section
<<gcode:g93-g94-g95,G93-G94-G95-Mode,G93 G94 G95>>).
. If any of XYZ are moving, F is in units per minute in the XYZ
cartesian system, and all other axes (ABCUVW) move so as to start and
stop in coordinated fashion.
. Otherwise, if any of UVW are moving, F is in units per minute in the
UVW cartesian system, and all other axes (ABC) move so as to start and
stop in coordinated fashion.
. Otherwise, the move is pure rotary motion and the F word is in rotary
units in the ABC 'pseudo-cartesian' system.
=== Coolant (((coolant)))
Flood coolant and mist coolant may each be turned on independently.
The RS274/NGC language turns them off together see Section
<<mcode:m7-m8-m9,M7 M8 M9>>.
=== Dwell (((dwell)))
A machining center may be commanded to dwell (i.e., keep all axes
unmoving) for a specific amount of time. The most common use of dwell
is to break and clear chips, so the spindle is usually turning during a
dwell. Regardless of the Path Control Mode (see Section
<<sec:path-control-mode,Path Control>>) the machine will stop exactly at the end of
the previous programmed move, as though it was in exact path mode.
=== Units (((units)))
Units used for distances along the X, Y, and Z axes may be measured in
millimeters or inches. Units for all other quantities involved in
machine control cannot be changed. Different quantities use different
specific units. Spindle speed is measured in revolutions per minute.
The positions of rotational axes are measured in degrees. Feed rates
are expressed in current length units per minute, or degrees per
minute, or length units per spindle revolution, as described in Section
<<gcode:g93-g94-g95,G93 G94 G95>>.
=== Current Position
The controlled point is always at some location called the 'current
position', and the controller always knows where that is. The numbers
representing the current position must be adjusted in the absence of
any axis motion if any of several events take place:
. Length units are changed.
. Tool length offset is changed.
. Coordinate system offsets are changed.
=== Selected Plane
There is always a 'selected plane', which must be the XY-plane, the
YZ-plane, or the XZ-plane of the machining center. The Z-axis is, of
course, perpendicular to the XY-plane, the X-axis to the YZ-plane, and
the Y-axis to the XZ-plane.
=== Tool Carousel
Zero or one tool is assigned to each slot in the tool carousel.
=== Tool Change
A machining center may be commanded to change tools.
=== Pallet Shuttle
The two pallets may be exchanged by command.
[[sec:path-control-mode]](((Path Control Mode)))
=== Path Control Mode
The machining center may be put into any one of three path control
modes: (1) exact stop mode, (2) exact path mode, or (3) continuous mode
with optional tolerance. In exact stop mode, the machine stops briefly
at the end of each programmed move. In exact path mode, the machine
follows the programmed path as exactly as possible, slowing or stopping
if necessary at sharp corners of the path. In continuous mode, sharp
corners of the path may be rounded slightly so that the feed rate may
be kept up (but by no more than the tolerance, if specified). See
Sections <<gcode:g61-g61.1,G61/G61.1>> and <<gcode:g64,G64>>.
== Interpreter Interaction with Switches
The Interpreter interacts with several switches. This section
describes the interactions in more detail. In no case does the
Interpreter know what the setting of any of these switches is.
=== Feed and Speed Override Switches
The Interpreter will interpret RS274/NGC commands which enable 'M48'
or disable 'M49' the feed and speed override switches. For certain
moves, such as the
traverse out of the end of a thread during a threading cycle, the
switches are disabled automatically.
LinuxCNC reacts to the speed and feed override settings when these
switches are enabled.
See the <<mcode:m48-m49,M48 M49 Override>> section for more
information.
[[sub:block-delete-switch]]
=== Block Delete Switch
If the block delete switch is on, lines of G code which start
with a slash (the block delete character) are not interpreted. If the
switch is off, such lines are interpreted. Normally the block delete
switch should be set before starting the NGC program.
[[sub:optional-program-stop]]
=== Optional Program Stop Switch
If this switch is on and an M1 code is encountered, program execution
is paused.
== Tool Table
A tool table is required to use the Interpreter. The file tells which
tools are in which tool changer slots and what the size and type of
each tool is. The name of the tool table is defined in the ini file:
----
[EMCIO]
# tool table file
TOOL_TABLE = tooltable.tbl
----
The default filename probably looks something like the above, but
you may prefer to give your machine its own tool table, using the
same name as your ini file, but with a tbl extension:
----
TOOL_TABLE = acme_300.tbl
----
or
----
TOOL_TABLE = EMC-AXIS-SIM.tbl
----
For more information on the specifics of the tool table format,
see the <<sec:tool-table,Tool Table Format>> Section.
== Parameters
In the RS274/NGC language view, a machining center maintains an array
of numerical parameters defined by a system definition
(RS274NGC_MAX_PARAMETERS). Many of them have specific uses especially
in defining coordinate systems. The number of numerical parameters can
increase as development adds support for new parameters. The parameter
array persists over time, even if the machining center is powered down.
LinuxCNC uses a parameter file to ensure persistence and gives the
Interpreter the responsibility for maintaining the file. The
Interpreter reads the file when it starts up, and writes the file when
it exits.
All parameters are available for use in G code programs.
The format of a parameter file is shown in the following table.
The file consists of any number of
header lines, followed by one blank line, followed by any number of
lines of data. The Interpreter skips over the header lines. It is
important that there be exactly one blank line (with no spaces or tabs,
even) before the data. The header line shown in the following table
describes the data columns, so it is
suggested (but not required) that that line always be included in the
header.
The Interpreter reads only the first two columns of the table. The
third column, 'Comment', is not read by the Interpreter.
Each line of the file contains the index number of a parameter in the
first column and the value to which that parameter should be set in the
second column. The value is represented as a double-precision floating
point number inside the Interpreter, but a decimal point is not
required in the file. All of the parameters shown in the following table
are required parameters and must be
included in any parameter file, except that any parameter representing
a rotational axis value for an unused axis may be omitted. An error
will be signaled if any required parameter is missing. A parameter
file may include any other parameter, as long as its number is in the
range 1 to 5400. The parameter numbers must be arranged in ascending
order. An error will be signaled if not. Any parameter included in the
file read by the Interpreter will be included in the file it writes as
it exits. The original file is saved as a backup file when the new file
is written. Comments are not preserved when the file is written.
.Parameter File Format
[width="75%", options="header", cols="^,^,<"]
|========================================
|Parameter Number | Parameter Value | Comment
|5161 | 0.0 | G28 Home X
|5162 | 0.0 | G28 Home Y
|========================================
See the <<gcode:parameters,Parameters>> section for more information.
This diff is collapsed.
This diff is collapsed.