diff --git a/doc/sphinx/source/gcode-reference/linuxcnc/g-code.rst b/doc/sphinx/source/gcode-reference/linuxcnc/g-code.rst index 19e6c2811d303beecf24e533c1701788a912455b..cd34dfbe43495f3cf7701e1823ad219dcd44a9d0 100644 --- a/doc/sphinx/source/gcode-reference/linuxcnc/g-code.rst +++ b/doc/sphinx/source/gcode-reference/linuxcnc/g-code.rst @@ -6,24 +6,24 @@ Conventions Conventions used in this section -In the G code prototypes the hyphen ('-') stands for a real value and ('<>') denotes an optional +In the G code prototypes the hyphen (``-``) stands for a real value and (``<>``) denotes an optional item. -If 'L-' is written in a prototype the '-' will often be referred to as the 'L number', and so on for +If ``L-`` is written in a prototype the ``-`` will often be referred to as the ``L number``, and so on for any other letter. -In the G code prototypes the word 'axes' stands for any axis as defined in your configuration. +In the G code prototypes the word ``axes`` stands for any axis as defined in your configuration. -An optional value will be written like this '`__ Section. -If 'G53' is programmed on the same line, the motion will also differ; see the `G53 <#gcode:g53>`__ +If ``G53`` is programmed on the same line, the motion will also differ; see the `G53 <#gcode:g53>`__ Section for more information. The path of a G0 rapid motion can be rounded at direction changes and depends on the `trajectory @@ -150,8 +150,8 @@ G1 Linear Move G1 axes For linear (straight line) motion at programed `feed rate <#sec:set-feed-rate>`__ (for cutting or -not), program 'G1 'axes'', where all the axis words are optional. The 'G1' is optional if the -current motion mode is 'G1'. This will produce coordinated motion to the destination point at the +not), program ``G1 ``axes````, where all the axis words are optional. The ``G1`` is optional if the +current motion mode is ``G1``. This will produce coordinated motion to the destination point at the current feed rate (or slower). G1 Example @@ -170,7 +170,7 @@ G1 Example If cutter compensation is active, the motion will differ from the above; see the `Cutter Compensation <#sec:cutter-compensation>`__ Section. -If 'G53' is programmed on the same line, the motion will also differ; see the `G53 <#gcode:g53>`__ +If ``G53`` is programmed on the same line, the motion will also differ; see the `G53 <#gcode:g53>`__ Section for more information. **It is an error if:** @@ -188,23 +188,23 @@ G2, G3 Arc Move G2 or G3 axes R- (radius format) G2 or G3 offsets|R- (full circles) -A circular or helical arc is specified using either 'G2' (clockwise arc) or 'G3' (counterclockwise +A circular or helical arc is specified using either ``G2`` (clockwise arc) or ``G3`` (counterclockwise arc) at the current `feed rate <#sec:set-feed-rate>`__. The direction (CW, CCW) is as viewed from the positive end of the axis about which the circular motion occurs. The axis of the circle or helix must be parallel to the X, Y, or Z axis of the machine coordinate -system. The axis (or, equivalently, the plane perpendicular to the axis) is selected with 'G17' -(Z-axis, XY-plane), 'G18' (Y-axis, XZ-plane), or 'G19' (X-axis, YZ-plane). Planes '17.1', '18.1', -and '19.1' are not currently supported. If the arc is circular, it lies in a plane parallel to the +system. The axis (or, equivalently, the plane perpendicular to the axis) is selected with ``G17`` +(Z-axis, XY-plane), ``G18`` (Y-axis, XZ-plane), or ``G19`` (X-axis, YZ-plane). Planes ``17.1``, ``18.1``, +and ``19.1`` are not currently supported. If the arc is circular, it lies in a plane parallel to the selected plane. To program a helix, include the axis word perpendicular to the arc plane: for example, if in the -'G17' plane, include a 'Z' word. This will cause the 'Z' axis to move to the programmed value during -the circular 'XY' motion. +``G17`` plane, include a ``Z`` word. This will cause the ``Z`` axis to move to the programmed value during +the circular ``XY`` motion. -To program an arc that gives more than one full turn, use the 'P' word specifying the number of full -turns plus the programmed arc. The 'P' word must be an integer. If 'P' is unspecified, the behavior -is as if 'P1' was given: that is, only one full or partial turn will result. For example, if a 180 +To program an arc that gives more than one full turn, use the ``P`` word specifying the number of full +turns plus the programmed arc. The ``P`` word must be an integer. If ``P`` is unspecified, the behavior +is as if ``P1`` was given: that is, only one full or partial turn will result. For example, if a 180 degree arc is programmed with a P2, the resulting motion will be 1 1/2 rotations. For each P increment above 1 an extra full circle is added to the programmed arc. Multi turn helical arcs are supported and give motion useful for milling holes or threads. @@ -249,23 +249,23 @@ Distance Mode is default. One or more axis words and one or more offsets must be programmed for an arc that is less than 360 degrees. -No axis words and one or more offsets must be programmed for full circles. The 'P' word defaults to +No axis words and one or more offsets must be programmed for full circles. The ``P`` word defaults to 1 and is optional. -For more information on 'Incremental Arc Distance Mode see the `G91.1 <#gcode:g90.1-g91.1>`__ +For more information on ``Incremental Arc Distance Mode see the `G91.1 <#gcode:g90.1-g91.1>`__ section. Absolute Arc Distance Mode Arc center offsets are the absolute distance from the current 0 position of the axis. -One or more axis words and 'both' offsets must be programmed for arcs +One or more axis words and ``both`` offsets must be programmed for arcs less than 360 degrees. -No axis words and both offsets must be programmed for full circles. The 'P' word defaults to 1 and +No axis words and both offsets must be programmed for full circles. The ``P`` word defaults to 1 and is optional. -For more information on 'Absolute Arc Distance Mode see the `G90.1 <#gcode:g90.1-g91.1>`__ section. +For more information on ``Absolute Arc Distance Mode see the `G90.1 <#gcode:g90.1-g91.1>`__ section. XY-plane (G17) @@ -273,10 +273,10 @@ XY-plane (G17) G2 or G3 -* 'Z' - helix -* 'I' - X offset -* 'J' - Y offset -* 'P' - number of turns +* ``Z`` - helix +* ``I`` - X offset +* ``J`` - Y offset +* ``P`` - number of turns XZ-plane (G18) @@ -284,10 +284,10 @@ XZ-plane (G18) G2 or G3 -* 'Y' - helix -* 'I' - X offset -* 'K' - Z offset -* 'P' - number of turns +* ``Y`` - helix +* ``I`` - X offset +* ``K`` - Z offset +* ``P`` - number of turns YZ-plane (G19) @@ -295,10 +295,10 @@ YZ-plane (G19) G2 or G3 -* 'X' - helix -* 'J' - Y offset -* 'K' - Z offset -* 'P' - number of turns +* ``X`` - helix +* ``J`` - Y offset +* ``K`` - Z offset +* ``P`` - number of turns **It is an error if:** @@ -308,13 +308,13 @@ YZ-plane (G19) differs from the distance from the end point to the center by more than (.05 inch/.5 mm) OR ((.0005 inch/.005mm) AND .1% of radius). -Deciphering the Error message 'Radius to end of arc differs from radius to start:' +Deciphering the Error message ``Radius to end of arc differs from radius to start:`` -* 'start' - the current position -* 'center' - the center position as calculated using the i, j, or k words -* 'end' - the programmed end point -* 'r1' - radius from the start position to the center -* 'r2' - radius from the end position to the center +* ``start`` - the current position +* ``center`` - the center position as calculated using the i, j, or k words +* ``end`` - the programmed end point +* ``r1`` - radius from the start position to the center +* ``r2`` - radius from the end position to the center Center Format Examples ~~~~~~~~~~~~~~~~~~~~~~ @@ -384,7 +384,7 @@ Radius Format Arcs G2 or G3 axes R- -* 'R' - radius from current position +* ``R`` - radius from current position It is not good practice to program radius format arcs that are nearly full circles or nearly semicircles because a small change in the location of the end point will produce a much larger @@ -395,7 +395,7 @@ of the point 90 degrees along the arc. Nearly full circles are even worse. Other range tiny to 165 degrees or 195 to 345 degrees) are OK. In the radius format, the coordinates of the end point of the arc in the selected plane are -specified along with the radius of the arc. Program 'G2' 'axes' 'R-' (or use 'G3' instead of 'G2' +specified along with the radius of the arc. Program ``G2`` ``axes`` ``R-`` (or use ``G3`` instead of ``G2`` ). R is the radius. The axis words are all optional except that at least one of the two words for the axes in the selected plane must be used. The R number is the radius. A positive radius indicates that the arc turns through less than 180 degrees, while a negative radius indicates a turn of more @@ -425,7 +425,7 @@ G4 Dwell G4 P- -* 'P' - seconds to dwell (floating point) +* ``P`` - seconds to dwell (floating point) The P number is the time in seconds that all axes will remain unmoving. The P number is a floating point number so fractions of a second may be @@ -448,10 +448,10 @@ G5 Cubic Spline G5 X- Y- P- Q- -* 'I' - X incremental offset from start point to first control point -* 'J' - Y incremental offset from start point to first control point -* 'P' - X incremental offset from end point to second control point -* 'Q' - Y incremental offset from end point to second control point +* ``I`` - X incremental offset from start point to first control point +* ``J`` - Y incremental offset from start point to first control point +* ``P`` - X incremental offset from end point to second control point +* ``Q`` - Y incremental offset from end point to second control point G5 creates a cubic B-spline in the XY plane with the X and Y axes only. P and Q must both be specified for every G5 command. @@ -496,8 +496,8 @@ G5.1 Quadratic Spline G5.1 X- Y- I- J- -* 'I' - X incremental offset from start point to control point -* 'J' - Y incremental offset from start point to control point +* ``I`` - X incremental offset from start point to control point +* ``J`` - Y incremental offset from start point to control point G5.1 creates a quadratic B-spline in the XY plane with the X and Y axis only. Not specifying I or J gives zero offset for the unspecified axis, so one or both must be given. @@ -534,7 +534,7 @@ Warning: G5.2, G5.3 is experimental and not fully tested. G5.2 is for opening the data block defining a NURBS and G5.3 for closing the data block. In the lines between these two codes the curve control points are defined with both their related -'weights' (P) and the parameter (L) which determines the order of the curve. +``weights`` (P) and the parameter (L) which determines the order of the curve. The current coordinate, before the first G5.2 command, is always taken as the first NURBS control point. To set the weight for this first control point, first program G5.2 P- without giving any X Y. @@ -595,13 +595,13 @@ G10 L1 Set Tool Table G10 L1 P- axes -* 'P' - tool number -* 'R' - radius of tool -* 'I' - front angle (lathe) -* 'J' - back angle (lathe) -* 'Q' - orientation (lathe) +* ``P`` - tool number +* ``R`` - radius of tool +* ``I`` - front angle (lathe) +* ``J`` - back angle (lathe) +* ``Q`` - orientation (lathe) -G10 L1 sets the tool table for the 'P' tool number to the values of the words. +G10 L1 sets the tool table for the ``P`` tool number to the values of the words. A valid G10 L1 rewrites and reloads the tool table. @@ -619,7 +619,7 @@ G10 L1 Example Line * The P number is not a valid tool number from the tool table * The P number is 0 -For more information on cutter orientation used by the 'Q' word, see the `Lathe Tool Orientation +For more information on cutter orientation used by the ``Q`` word, see the `Lathe Tool Orientation <#lathe-tool-orientation>`__ diagram. G10 L2 Set Coordinate System @@ -629,8 +629,8 @@ G10 L2 Set Coordinate System G10 L2 P- -* 'P' - coordinate system (0-9) -* 'R' - rotation about the Z axis +* ``P`` - coordinate system (0-9) +* ``R`` - rotation about the Z axis G10 L2 offsets the origin of the axes in the coordinate system specified to the value of the axis word. The offset is from the machine origin established during homing. The offset value will replace @@ -659,7 +659,7 @@ rotation is CCW as viewed from the positive end of the Z axis. All axis words are optional. -Being in incremental distance mode (`'G91' <#gcode:g90-g91>`__) has no effect on 'G10 L2'. +Being in incremental distance mode (```G91`` <#gcode:g90-g91>`__) has no effect on ``G10 L2``. Important Concepts: @@ -667,12 +667,12 @@ Important Concepts: to use G54-59.3 to select a coordinate system. * When a rotation is in effect jogging an axis will only move that axis in a positive or negative direction and not along the rotated axis. -* If a 'G52' local offset or 'G92' origin offset was in effect before 'G10 L2', it will continue to +* If a ``G52`` local offset or ``G92`` origin offset was in effect before ``G10 L2``, it will continue to be in effect afterwards. -* When programming a coordinate system with R, any 'G52' or 'G92' will be applied **after** the +* When programming a coordinate system with R, any ``G52`` or ``G92`` will be applied **after** the rotation. -* The coordinate system whose origin is set by a 'G10' command may be active or inactive at the time - the 'G10' is executed. If it is currently active, the new coordinates take effect immediately. +* The coordinate system whose origin is set by a ``G10`` command may be active or inactive at the time + the ``G10`` is executed. If it is currently active, the new coordinates take effect immediately. **It is an error if:** @@ -685,7 +685,7 @@ G10 L2 Example Line G10 L2 P1 X3.5 Y17.2 -In the above example the origin of the first coordinate system (the one selected by 'G54') is set to +In the above example the origin of the first coordinate system (the one selected by ``G54``) is set to be X=3.5 and Y=17.2. Because only X and Y are specified, the origin point is only moved in X and Y; the other coordinates are not changed. @@ -706,11 +706,11 @@ G10 L10 Set Tool Table G10 L10 P- axes -* 'P' - tool number -* 'R' - radius of tool -* 'I' - front angle (lathe) -* 'J' - back angle (lathe) -* 'Q' - orientation (lathe) +* ``P`` - tool number +* ``R`` - radius of tool +* ``I`` - front angle (lathe) +* ``J`` - back angle (lathe) +* ``Q`` - orientation (lathe) G10 L10 changes the tool table entry for tool P so that if the tool offset is reloaded, with the machine in its current position and with the current G5x and G52/G92 offsets active, the current @@ -744,11 +744,11 @@ G10 L11 Set Tool Table G10 L11 P- axes -* 'P' - tool number -* 'R' - radius of tool -* 'I' - front angle (lathe) -* 'J' - back angle (lathe) -* 'Q' - orientation (lathe) +* ``P`` - tool number +* ``R`` - radius of tool +* ``I`` - front angle (lathe) +* ``J`` - back angle (lathe) +* ``Q`` - orientation (lathe) G10 L11 is just like G10 L10 except that instead of setting the entry according to the current offsets, it is set so that the current coordinates would become the given value if the new tool @@ -772,7 +772,7 @@ G10 L20 Set Coordinate System G10 L20 P- axes -* 'P' - coordinate system (0-9) +* ``P`` - coordinate system (0-9) G10 L20 is similar to G10 L2 except that instead of setting the offset/entry to the given value, it is set to a calculated value that makes the current coordinates become the given value. @@ -795,12 +795,12 @@ G17 - G19.1 Plane Select These codes set the current plane as follows: -* 'G17' - XY (default) -* 'G18' - ZX -* 'G19' - YZ -* 'G17.1' - UV -* 'G18.1' - WU -* 'G19.1' - VW +* ``G17`` - XY (default) +* ``G18`` - ZX +* ``G19`` - YZ +* ``G17.1`` - UV +* ``G18.1`` - WU +* ``G19.1`` - VW The UV, WU and VW planes do not support arcs. @@ -812,8 +812,8 @@ Section `G81 G89 <#gcode:g80-g89>`__ G20, G21 Units -------------- -* 'G20' - to use inches for length units. -* 'G21' - to use millimeters for length units. +* ``G20`` - to use inches for length units. +* ``G21`` - to use millimeters for length units. It is a good idea to include units in the preamble of each G code file. @@ -823,19 +823,19 @@ G28, G28.1 Go/Set Predefined Position ------------------------------------- G28 uses the values stored in `parameters <#sub:numbered-parameters>`__ 5161-5169 as the X Y Z A B C -U V W final point to move to. The parameter values are 'absolute' machine coordinates in the native -machine 'units' as specified in the ini file. All axes defined in the ini file will be moved when a +U V W final point to move to. The parameter values are ``absolute`` machine coordinates in the native +machine ``units`` as specified in the ini file. All axes defined in the ini file will be moved when a G28 is issued. If no positions are stored with G28.1 then all axes will go to the `machine origin <#sec.machine-corrdinate-system>`__. -* 'G28' - makes a `rapid move <#gcode:g0>`__ from the current position to the 'absolute' position of +* ``G28`` - makes a `rapid move <#gcode:g0>`__ from the current position to the ``absolute`` position of the values in parameters 5161-5166. -* 'G28 axes' - makes a rapid move to the position specified by 'axes' including any offsets, then - will make a rapid move to the 'absolute' position of the values in parameters 5161-5166 for all - 'axes' specified. Any 'axis' not specified will not move. +* ``G28 axes`` - makes a rapid move to the position specified by ``axes`` including any offsets, then + will make a rapid move to the ``absolute`` position of the values in parameters 5161-5166 for all + ``axes`` specified. Any ``axis`` not specified will not move. -* 'G28.1' - stores the current 'absolute' position into parameters 5161-5166. +* ``G28.1`` - stores the current ``absolute`` position into parameters 5161-5166. G28 Example Line @@ -854,19 +854,19 @@ G30, G30.1 Go/Set Predefined Position G30 functions the same as G28 but uses the values stored in `parameters <#sub:numbered-parameters>`__ 5181-5189 as the X Y Z A B C U V W final point to move to. The -parameter values are 'absolute' machine coordinates in the native machine 'units' as specified in +parameter values are ``absolute`` machine coordinates in the native machine ``units`` as specified in the ini file. All axes defined in the ini file will be moved when a G30 is issued. If no positions are stored with G30.1 then all axes will go to the `machine origin <#sec.machine-corrdinate-system>`__. -* 'G30' - makes a `rapid move <#gcode:g0>`__ from the current position to the 'absolute' position of +* ``G30`` - makes a `rapid move <#gcode:g0>`__ from the current position to the ``absolute`` position of the values in parameters 5181-5186. -* 'G30 axes' - makes a rapid move to the position specified by 'axes' including any offsets, then - will make a rapid move to the 'absolute' position of the values in parameters 5181-5186 for all - 'axes' specified. Any 'axis' not specified will not move. +* ``G30 axes`` - makes a rapid move to the position specified by ``axes`` including any offsets, then + will make a rapid move to the ``absolute`` position of the values in parameters 5181-5186 for all + ``axes`` specified. Any ``axis`` not specified will not move. -* 'G30.1' - stores the current absolute position into parameters 5181-5186. +* ``G30.1`` - stores the current absolute position into parameters 5181-5186. G30 Example Line @@ -885,19 +885,19 @@ G33 Spindle Synchronized Motion G33 X- Y- Z- K- $- -* 'K' - distance per revolution +* ``K`` - distance per revolution -For spindle-synchronized motion in one direction, code 'G33 X- Y- Z- K-' where K gives the distance -moved in XYZ for each revolution of the spindle. For instance, if starting at 'Z=0', 'G33 Z-1 -K.0625' produces a 1 inch motion in Z over 16 revolutions of the spindle. This command might be part -of a program to produce a 16TPI thread. Another example in metric, 'G33 Z-15 K1.5' produces a +For spindle-synchronized motion in one direction, code ``G33 X- Y- Z- K-`` where K gives the distance +moved in XYZ for each revolution of the spindle. For instance, if starting at ``Z=0``, ``G33 Z-1 +K.0625`` produces a 1 inch motion in Z over 16 revolutions of the spindle. This command might be part +of a program to produce a 16TPI thread. Another example in metric, ``G33 Z-15 K1.5`` produces a movement of 15mm while the spindle rotates 10 times for a thread of 1.5mm. The (optional) $ argument sets which spindle the motion is synchronised to (default is zero). For example G33 Z10 K1 $1 will move the spindle in synchrony with the spindle.N.revs HAL pin value. Spindle-synchronized motion waits for the spindle index and spindle at speed pins, so multiple -passes line up. 'G33' moves end at the programmed endpoint. G33 could be used to cut tapered threads +passes line up. ``G33`` moves end at the programmed endpoint. G33 could be used to cut tapered threads or a fusee. All the axis words are optional, except that at least one must be used. @@ -913,7 +913,7 @@ cutting a good thread. HAL Connections -The pin 'spindle.N.at-speed' must be set or driven true for the motion to start. Additionally +The pin ``spindle.N.at-speed`` must be set or driven true for the motion to start. Additionally spindle.N.revs must increase by 1 for each revolution of the spindle and the spindle.N.index-enable pin must be connected to an encoder (or resolver) counter which resets index-enable once per rev. @@ -949,11 +949,11 @@ G33.1 Rigid Tapping G33.1 X- Y- Z- K- I- $- -* 'K' - distance per revolution -* 'I' - optional spindle speed multiplier for faster return move -* '$' - optional spindle selector +* ``K`` - distance per revolution +* ``I`` - optional spindle speed multiplier for faster return move +* ``$`` - optional spindle selector -For rigid tapping (spindle synchronized motion with return), code 'G33.1 X- Y- Z- K-' where 'K-' +For rigid tapping (spindle synchronized motion with return), code ``G33.1 X- Y- Z- K-`` where ``K-`` gives the distance moved for each revolution of the spindle. A rigid tapping move consists of the following sequence: @@ -971,7 +971,7 @@ A rigid tapping move consists of the following sequence: reverses. #. An **unsynchronized** move back to the original coordinate. -Spindle-synchronized motions wait for spindle index, so multiple passes line up.'G33.1' moves end at +Spindle-synchronized motions wait for spindle index, so multiple passes line up.``G33.1`` moves end at the original coordinate. All the axis words are optional, except that at least one must be used. @@ -1005,12 +1005,12 @@ G38.n Straight Probe G38.n axes -* 'G38.2' - probe toward workpiece, stop on contact, signal error if failure -* 'G38.3' - probe toward workpiece, stop on contact -* 'G38.4' - probe away from workpiece, stop on loss of contact, signal error if failure -* 'G38.5' - probe away from workpiece, stop on loss of contact +* ``G38.2`` - probe toward workpiece, stop on contact, signal error if failure +* ``G38.3`` - probe toward workpiece, stop on contact +* ``G38.4`` - probe away from workpiece, stop on loss of contact, signal error if failure +* ``G38.5`` - probe away from workpiece, stop on loss of contact -Program 'G38.n axes' to perform a straight probe operation. The axis words are optional, except that +Program ``G38.n axes`` to perform a straight probe operation. The axis words are optional, except that at least one of them must be used. The axis words together define the destination point that the probe will move towards, starting from the current location. If the probe is not tripped before the destination is reached G38.2 and G38.4 will signal an error. @@ -1031,13 +1031,13 @@ programmed point. Parameter 5070 is set to 1 if the probe succeeded and 0 if the the probing operation failed, G38.2 and G38.4 will signal an error by posting an message on screen if the selected GUI supports that. And by halting program execution. -A comment of the form '(PROBEOPEN filename.txt)' will open 'filename.txt' and store the 9-number +A comment of the form ``(PROBEOPEN filename.txt)`` will open ``filename.txt`` and store the 9-number coordinate consisting of XYZABCUVW of each successful straight probe in it. The file must be closed -with '(PROBECLOSE)'. For more information see the `Comments <#gcode:comments>`__ Section. +with ``(PROBECLOSE)``. For more information see the `Comments <#gcode:comments>`__ Section. -An example file 'smartprobe.ngc' is included (in the examples directory) to demonstrate using probe -moves to log to a file the coordinates of a part. The program 'smartprobe.ngc' could be used with -'ngcgui' with minimal changes. +An example file ``smartprobe.ngc`` is included (in the examples directory) to demonstrate using probe +moves to log to a file the coordinates of a part. The program ``smartprobe.ngc`` could be used with +``ngcgui`` with minimal changes. **It is an error if:** @@ -1050,7 +1050,7 @@ moves to log to a file the coordinates of a part. The program 'smartprobe.ngc' c G40 Compensation Off -------------------- -* 'G40' - turn cutter compensation off. If tool compensation was on the next move must be a linear +* ``G40`` - turn cutter compensation off. If tool compensation was on the next move must be a linear move and longer than the tool diameter. It is OK to turn compensation off when it is already off. G40 Example @@ -1077,7 +1077,7 @@ G41, G42 Cutter Compensation G41 (left of programmed path) G42 (right of programmed path) -* 'D' - tool number +* ``D`` - tool number The D word is optional; if there is no D word the radius of the currently loaded tool will be used (if no tool is loaded and no D word is given, a radius of 0 will be used). @@ -1119,8 +1119,8 @@ G41.1, G42.1 Dynamic Cutter Compensation G41.1 D- (left of programmed path) G42.1 D- (right of programmed path) -* 'D' - cutter diameter -* 'L' - tool orientation (see `lathe tool orientation <#lathe-tool-orientation>`__) +* ``D`` - cutter diameter +* ``L`` - tool orientation (see `lathe tool orientation <#lathe-tool-orientation>`__) G41.1 & G42.1 function the same as G41 & G42 with the added scope of being able to program the tool diameter. The L word defaults to 0 if unspecified. @@ -1139,15 +1139,15 @@ G43 Tool Length Offset G43 -* 'H' - tool number (optional) +* ``H`` - tool number (optional) G43 enables tool length compensation. G43 changes subsequent motions by offsetting the axis coordinates by the length of the offset. G43 does not cause any motion. The next time a compensated axis is moved, that axis’s endpoint is the compensated location. -'G43' without an H word uses the currently loaded tool from the last 'Tn M6'. +``G43`` without an H word uses the currently loaded tool from the last ``Tn M6``. -'G43 Hn' uses the offset for tool n. +``G43 Hn`` uses the offset for tool n. G43 H- Example Line @@ -1171,7 +1171,7 @@ G43.1: Dynamic Tool Length Offset G43.1 axes -* 'G43.1 axes' - change subsequent motions by replacing the current offset(s) of axes. G43.1 does +* ``G43.1 axes`` - change subsequent motions by replacing the current offset(s) of axes. G43.1 does not cause any motion. The next time a compensated axis is moved, that axis’s endpoint is the compensated location. @@ -1189,7 +1189,7 @@ G43.1 Example **It is an error if:** -* motion is commanded on the same line as 'G43.1' +* motion is commanded on the same line as ``G43.1`` .. _g432-apply-additional-tool-length-offset: @@ -1200,7 +1200,7 @@ G43.2: Apply additional Tool Length Offset G43.2 H- -* 'H' - tool number +* ``H`` - tool number G43.2 applies an additional simultaneous tool offset. @@ -1210,8 +1210,8 @@ G43.2 Example G90 (set absolute mode) T1 M6 (load tool 1) - G43 (or G43 H1 - replace all tool offsets with T1's offset) - G43.2 H10 (also add in T10's tool offset) + G43 (or G43 H1 - replace all tool offsets with T1``s offset) + G43.2 H10 (also add in T10``s tool offset) M2 (end program) You can sum together an arbitrary number of offsets by calling G43.2 more times. There are no @@ -1223,13 +1223,13 @@ moved, that axis’s endpoint is the compensated location. **It is an error if:** -* 'H' is unspecified, or +* ``H`` is unspecified, or * the given tool number does not exist in the tool table G49: Cancel Tool Length Compensation ------------------------------------ -* 'G49' - cancels tool length compensation +* ``G49`` - cancels tool length compensation It is OK to program using the same offset already in use. It is also OK to program using no tool length offset if none is currently being used. @@ -1241,11 +1241,11 @@ G53 Move in Machine Coordinates G53 axes -To move in the `machine coordinate system <#sec.machine-corrdinate-system>`__, program 'G53' on the -same line as a linear move. 'G53' is not modal and must be programmed on each line. 'G0' or 'G1' +To move in the `machine coordinate system <#sec.machine-corrdinate-system>`__, program ``G53`` on the +same line as a linear move. ``G53`` is not modal and must be programmed on each line. ``G0`` or ``G1`` does not have to be programmed on the same line if one is currently active. -For example 'G53 G0 X0 Y0 Z0' will move the axes to the home position even if the currently selected +For example ``G53 G0 X0 Y0 Z0`` will move the axes to the home position even if the currently selected coordinate system has offsets in effect. G53 Example @@ -1267,15 +1267,15 @@ G53 Example G54-G59.3 Select Coordinate System ---------------------------------- -* 'G54' - select coordinate system 1 -* 'G55' - select coordinate system 2 -* 'G56' - select coordinate system 3 -* 'G57' - select coordinate system 4 -* 'G58' - select coordinate system 5 -* 'G59' - select coordinate system 6 -* 'G59.1' - select coordinate system 7 -* 'G59.2' - select coordinate system 8 -* 'G59.3' - select coordinate system 9 +* ``G54`` - select coordinate system 1 +* ``G55`` - select coordinate system 2 +* ``G56`` - select coordinate system 3 +* ``G57`` - select coordinate system 4 +* ``G58`` - select coordinate system 5 +* ``G59`` - select coordinate system 6 +* ``G59.1`` - select coordinate system 7 +* ``G59.2`` - select coordinate system 8 +* ``G59.3`` - select coordinate system 9 The coordinate systems store the axis values and the XY rotation angle around the Z axis in the parameters shown in the following table. @@ -1306,9 +1306,9 @@ systems. G61, G61.1 Exact Path Mode -------------------------- -* 'G61' - Exact path mode, movement exactly as programed. Moves will slow or stop as needed to reach +* ``G61`` - Exact path mode, movement exactly as programed. Moves will slow or stop as needed to reach every programed point. If two sequential moves are exactly co-linear movement will not stop. -* 'G61.1' - Exact stop mode, movement will stop at the end of each programed segment. +* ``G61.1`` - Exact stop mode, movement will stop at the end of each programed segment. G64 Path Blending ----------------- @@ -1317,22 +1317,22 @@ G64 Path Blending G64 > -* 'P' - motion blending tolerance -* 'Q' - naive cam tolerance -* 'G64' - best possible speed. -* 'G64 P- ' blending with tolerance. -* 'G64' - without P means to keep the best speed possible, no matter how far away from the +* ``P`` - motion blending tolerance +* ``Q`` - naive cam tolerance +* ``G64`` - best possible speed. +* ``G64 P- `` blending with tolerance. +* ``G64`` - without P means to keep the best speed possible, no matter how far away from the programmed point you end up. -* 'G64 P- Q-' - is a way to fine tune your system for best compromise between speed and +* ``G64 P- Q-`` - is a way to fine tune your system for best compromise between speed and accuracy. The P- tolerance means that the actual path will be no more than P- away from the programmed endpoint. The velocity will be reduced if needed to maintain the path. In addition, - when you activate G64 P- Q- it turns on the 'naive cam detector'; when there are a series of + when you activate G64 P- Q- it turns on the ``naive cam detector``; when there are a series of linear XYZ feed moves at the same `feed rate <#sec:set-feed-rate>`__ that are less than Q- away from being collinear, they are collapsed into a single linear move. On G2/G3 moves in the G17 (XY) plane when the maximum deviation of an arc from a straight line is less than the G64 P- tolerance the arc is broken into two lines (from start of arc to midpoint, and from midpoint to end). those lines are then subject to the naive cam algorithm for lines. Thus, line-arc, arc-arc, - and arc-line cases as well as line-line benefit from the 'naive cam detector'. This improves + and arc-line cases as well as line-line benefit from the ``naive cam detector``. This improves contouring performance by simplifying the path. It is OK to program for the mode that is already active. See also the `Trajectory Control <#sec:trajectory-control>`__ Section for more information on these modes. If Q is not specified then it will have the same behavior as before @@ -1353,12 +1353,12 @@ G73 Drilling Cycle with Chip Breaking G73 X- Y- Z- R- Q- -* 'R' - retract position along the Z axis. -* 'Q' - delta increment along the Z axis. -* 'L' - repeat +* ``R`` - retract position along the Z axis. +* ``Q`` - delta increment along the Z axis. +* ``L`` - repeat -The 'G73' cycle is drilling or milling with chip breaking. This cycle takes a Q number which -represents a 'delta' increment along the Z axis. +The ``G73`` cycle is drilling or milling with chip breaking. This cycle takes a Q number which +represents a ``delta`` increment along the Z axis. #. Preliminary motion. @@ -1384,7 +1384,7 @@ G74 Left-hand Tapping Cycle, Dwell G74 (X- Y- Z-) or (U- V- W-) R- L- P- $- -The 'G74' cycle is intended for tapping with floating chuck and dwell at the bottom of the hole. +The ``G74`` cycle is intended for tapping with floating chuck and dwell at the bottom of the hole. #. Preliminary motion, as described in the `Preliminary and In-Between Motion <#gcode:preliminary-motion>`__ section. @@ -1396,7 +1396,7 @@ The 'G74' cycle is intended for tapping with floating chuck and dwell at the bot #. Move the Z-axis at the current feed rate to clear Z #. Restore Feed and Speed override enables to previous state -The length of the dwell is specified by a 'P-' word in the G84 block. Thread pitch is F divided +The length of the dwell is specified by a ``P-`` word in the G84 block. Thread pitch is F divided by S. In example S100 F125 gives pitch of 1.25MM per revolution. G76 Threading Cycle @@ -1410,45 +1410,45 @@ G76 Threading Cycle Figure 3. G76 Threading -* 'Drive Line' - A line through the initial X position parallel to the Z. -* 'P-' - The 'thread pitch' in distance per revolution. -* 'Z-' - The final position of threads. At the end of the cycle the tool will be at this Z position. -* 'I-' - The 'thread peak' offset from the 'drive line'. Negative 'I' values are external threads, - and positive 'I' values are internal threads. Generally the material has been turned to this size - before the 'G76' cycle. -* 'J-' - A positive value specifying the 'initial cut depth'. The first threading cut will be 'J' - beyond the 'thread peak' position. -* 'K-' - A positive value specifying the 'full thread depth'. The final threading cut will be 'K' - beyond the 'thread peak' position. +* ``Drive Line`` - A line through the initial X position parallel to the Z. +* ``P-`` - The ``thread pitch`` in distance per revolution. +* ``Z-`` - The final position of threads. At the end of the cycle the tool will be at this Z position. +* ``I-`` - The ``thread peak`` offset from the ``drive line``. Negative ``I`` values are external threads, + and positive ``I`` values are internal threads. Generally the material has been turned to this size + before the ``G76`` cycle. +* ``J-`` - A positive value specifying the ``initial cut depth``. The first threading cut will be ``J`` + beyond the ``thread peak`` position. +* ``K-`` - A positive value specifying the ``full thread depth``. The final threading cut will be ``K`` + beyond the ``thread peak`` position. Optional settings -* '$-' - The spindle number to which the motion will be synchronised (default 0). For example is $1 +* ``$-`` - The spindle number to which the motion will be synchronised (default 0). For example is $1 is programmed then the motion will begin on the reset od spindle.1.index-enable and proceed in synchrony with the value of spindle.1.revs -* 'R-' - The 'depth degression'. 'R1.0' selects constant depth on successive threading - passes. 'R2.0' selects constant area. Values between 1.0 and 2.0 select decreasing depth but +* ``R-`` - The ``depth degression``. ``R1.0`` selects constant depth on successive threading + passes. ``R2.0`` selects constant area. Values between 1.0 and 2.0 select decreasing depth but increasing area. Values above 2.0 select decreasing area. Beware that unnecessarily high degression values will cause a large number of passes to be used. (degression = a descent by stages or steps.) -* 'Q-' - The 'compound slide angle' is the angle (in degrees) describing to what extent successive +* ``Q-`` - The ``compound slide angle`` is the angle (in degrees) describing to what extent successive passes should be offset along the drive line. This is used to cause one side of the tool to - remove more material than the other. A positive 'Q' value causes the leading edge of the tool to + remove more material than the other. A positive ``Q`` value causes the leading edge of the tool to cut more heavily. Typical values are 29, 29.5 or 30. -* 'H-' - The number of 'spring passes'. Spring passes are additional passes at full thread depth. If - no additional passes are desired, program 'H0'. -* 'E-' - Specifies the distance along the drive line used for the taper. The angle of the taper will - be so the last pass tapers to the thread crest over the distance specified with E.' E0.2' will +* ``H-`` - The number of ``spring passes``. Spring passes are additional passes at full thread depth. If + no additional passes are desired, program ``H0``. +* ``E-`` - Specifies the distance along the drive line used for the taper. The angle of the taper will + be so the last pass tapers to the thread crest over the distance specified with E.`` E0.2`` will give a taper for the first/last 0.2 length units along the thread. For a 45 degree taper program E the same as K -* 'L-' - Specifies which ends of the thread get the taper. Program 'L0' for no taper (the default), - 'L1' for entry taper, 'L2' for exit taper, or 'L3' for both entry and exit tapers. Entry tapers +* ``L-`` - Specifies which ends of the thread get the taper. Program ``L0`` for no taper (the default), + ``L1`` for entry taper, ``L2`` for exit taper, or ``L3`` for both entry and exit tapers. Entry tapers will pause at the drive line to synchronize with the index pulse then move at the `feed rate <#sec:set-feed-rate>`__ in to the beginning of the taper. No entry taper and the tool will rapid to the cut depth then synchronize and begin the cut. The tool is moved to the initial X and Z positions prior to issuing the G76. The X position is the -'drive line' and the Z position is the start of the threads. +``drive line`` and the Z position is the start of the threads. The tool will pause briefly for synchronization before each threading pass, so a relief groove will be required at the entry unless the beginning of the thread is past the end of the material or an @@ -1461,21 +1461,21 @@ moves will require a larger portion of a revolution, resulting in a very heavy c move. This can be avoided by providing a relief groove at the exit, or by not changing the spindle speed while threading. -The final position of the tool will be at the end of the 'drive line'. A safe Z move will be needed +The final position of the tool will be at the end of the ``drive line``. A safe Z move will be needed with an internal thread to remove the tool from the hole. **It is an error if:** * The active plane is not the ZX plane * Other axis words, such as X- or Y-, are specified -* The 'R-' degression value is less than 1.0. +* The ``R-`` degression value is less than 1.0. * All the required words are not specified -* 'P-', 'J-', 'K-' or 'H-' is negative -* 'E-' is greater than half the drive line length +* ``P-``, ``J-``, ``K-`` or ``H-`` is negative +* ``E-`` is greater than half the drive line length HAL Connections -The pins 'spindle.N.at-speed' and the 'encoder.n.phase-Z' for the spindle must be connected in your +The pins ``spindle.N.at-speed`` and the ``encoder.n.phase-Z`` for the spindle must be connected in your HAL file before G76 will work. See the `spindle <#sec:motion-pins>`__ pins in the Motion section for more information. @@ -1484,8 +1484,8 @@ Technical Info The G76 canned cycle is based on the G33 Spindle Synchronized Motion. For more information see the G33 `Technical Info <#gcode:g33-tech-info>`__. -The sample program 'g76.ngc' shows the use of the G76 canned cycle, and can be previewed and -executed on any machine using the 'sim/lathe.ini' configuration. +The sample program ``g76.ngc`` shows the use of the G76 canned cycle, and can be previewed and +executed on any machine using the ``sim/lathe.ini`` configuration. G76 Example @@ -1505,13 +1505,13 @@ Figure 4. G76 Example Canned Cycles ------------- -The canned cycles 'G81' through 'G89' and the canned cycle stop 'G80' +The canned cycles ``G81`` through ``G89`` and the canned cycle stop ``G80`` are described in this section. All canned cycles are performed with respect to the currently-selected plane. Any of the nine planes may be selected. Throughout this section, most of the descriptions assume the XY-plane has been selected. The behavior is analogous if another plane is selected, and the correct words must be -used. For instance, in the 'G17.1' plane, the action of the canned cycle is along W, and the +used. For instance, in the ``G17.1`` plane, the action of the canned cycle is along W, and the locations or increments are given with U and V. In this case substitute U,V,W for X,Y,Z in the instructions below. @@ -1529,7 +1529,7 @@ All canned cycles use X, Y, Z, or U, V, W groups depending on the plane selected Sticky Words ~~~~~~~~~~~~ -For canned cycles, we will call a number 'sticky' if, when the same cycle is used on several lines +For canned cycles, we will call a number ``sticky`` if, when the same cycle is used on several lines of code in a row, the number must be used the first time, but is optional on the rest of the lines. Sticky numbers keep their value on the rest of the lines if they are not explicitly programmed to be different. The R number is always sticky. @@ -1547,17 +1547,17 @@ motions is repeated in several equally spaced places along a straight line. When 1 in incremental mode with the XY-plane selected, the X and Y positions are determined by adding the given X and Y numbers either to the current X and Y positions (on the first go-around) or to the X and Y positions at the end of the previous go-around (on the repetitions). Thus, if you program -'L10' , you will get 10 cycles. The first cycle will be distance X,Y from the original location. The +``L10`` , you will get 10 cycles. The first cycle will be distance X,Y from the original location. The R and Z positions do not change during the repeats. The L number is not sticky. In absolute -distance mode, L>1 means 'do the same cycle in the same place several times', Omitting the L word is +distance mode, L>1 means ``do the same cycle in the same place several times``, Omitting the L word is equivalent to specifying L=1. Retract Mode ~~~~~~~~~~~~ -The height of the retract move at the end of each repeat (called 'clear Z' in the descriptions +The height of the retract move at the end of each repeat (called ``clear Z`` in the descriptions below) is determined by the setting of the retract mode: either to the original Z position (if that -is above the R position and the retract mode is 'G98', OLD_Z), or otherwise to the R position. See +is above the R position and the retract mode is ``G98``, OLD_Z), or otherwise to the R position. See the `G98 G99 <#gcode:g98-g99>`__ Section. Canned Cycle Errors @@ -1654,7 +1654,7 @@ regardless of the start point of the canned cycle. G80 Cancel Canned Cycle ----------------------- -* 'G80' - cancel canned cycle modal motion. 'G80' is part of modal group 1, so programming any other +* ``G80`` - cancel canned cycle modal motion. ``G80`` is part of modal group 1, so programming any other G code from modal group 1 will also cancel the canned cycle. **It is an error if:** @@ -1722,7 +1722,7 @@ G81 Drilling Cycle G81 (X- Y- Z-) or (U- V- W-) R- L- -The 'G81' cycle is intended for drilling. +The ``G81`` cycle is intended for drilling. The cycle functions as follows: @@ -1832,7 +1832,7 @@ Example 5 - Relative position R > Z G90 G98 G81 X4 Y5 Z-0.6 R1.8 Since this plot starts with (X0, Y0, Z0), the interpreter adds the initial Z0 and R1.8 and rapid -moves to that location as in 'Example 4'. After that initial Z move, the `rapid move <#gcode:g0>`__ +moves to that location as in ``Example 4``. After that initial Z move, the `rapid move <#gcode:g0>`__ to X4 Y5 is done. Then the final Z depth being 0.6 below the R value. The repeat function would make the Z move in the same location again. @@ -1843,7 +1843,7 @@ G82 Drilling Cycle, Dwell G82 (X- Y- Z-) or (U- V- W-) R- L- P- -The 'G82' cycle is intended for drilling with a dwell at the bottom of the hole. +The ``G82`` cycle is intended for drilling with a dwell at the bottom of the hole. #. Preliminary motion, as described in the `Preliminary and In-Between Motion <#gcode:preliminary-motion>`__ section. @@ -1852,7 +1852,7 @@ The 'G82' cycle is intended for drilling with a dwell at the bottom of the hole. #. The Z-axis does a `rapid move <#gcode:g0>`__ to clear Z. The motion of a G82 canned cycle looks just like G81 with the addition of a dwell at the bottom of -the Z move. The length of the dwell is specified by a 'P-' word in the G82 block. +the Z move. The length of the dwell is specified by a ``P-`` word in the G82 block. G83 Peck Drilling Cycle ----------------------- @@ -1861,10 +1861,10 @@ G83 Peck Drilling Cycle G83 (X- Y- Z-) or (U- V- W-) R- L- Q- -The 'G83' cycle (often called peck drilling) is intended for deep drilling or milling with chip +The ``G83`` cycle (often called peck drilling) is intended for deep drilling or milling with chip breaking. The retracts in this cycle clear the hole of chips and cut off any long stringers (which -are common when drilling in aluminum). This cycle takes a Q number which represents a 'delta' -increment along the Z-axis. The retract before final depth will always be to the 'retract' plane +are common when drilling in aluminum). This cycle takes a Q number which represents a ``delta`` +increment along the Z-axis. The retract before final depth will always be to the ``retract`` plane even if G98 is in effect. The final retract will honor the G98/99 in effect. G83 functions the same as G81 with the addition of retracts during the drilling operation. @@ -1888,7 +1888,7 @@ G84 Right-hand Tapping Cycle, Dwell G84 (X- Y- Z-) or (U- V- W-) R- L- P- $- -The 'G84' cycle is intended for tapping with floating chuck and dwell at the bottom of the hole. +The ``G84`` cycle is intended for tapping with floating chuck and dwell at the bottom of the hole. #. Preliminary motion, as described in the `Preliminary and In-Between Motion <#gcode:preliminary-motion>`__ section. @@ -1900,7 +1900,7 @@ The 'G84' cycle is intended for tapping with floating chuck and dwell at the bot #. Move the Z-axis at the current feed rate to clear Z #. Restore Feed and Speed override enables to previous state -The length of the dwell is specified by a 'P-' word in the G84 block. Thread pitch is F divided +The length of the dwell is specified by a ``P-`` word in the G84 block. Thread pitch is F divided by S. In example S100 F125 gives pitch of 1.25MM per revolution. G85 Boring Cycle, Feed Out @@ -1910,7 +1910,7 @@ G85 Boring Cycle, Feed Out G85 (X- Y- Z-) or (U- V- W-) R- L- -The 'G85' cycle is intended for boring or reaming, but could be used for drilling or milling. +The ``G85`` cycle is intended for boring or reaming, but could be used for drilling or milling. #. Preliminary motion, as described in the `Preliminary and In-Between Motion <#gcode:preliminary-motion>`__ section. @@ -1925,7 +1925,7 @@ G86 Boring Cycle, Spindle Stop, Rapid Move Out G86 (X- Y- Z-) or (U- V- W-) R- L- P- $- -The 'G86' cycle is intended for boring. This cycle uses a P number for the number of seconds to +The ``G86`` cycle is intended for boring. This cycle uses a P number for the number of seconds to dwell. #. Preliminary motion, as described in the `Preliminary and In-Between Motion @@ -1957,7 +1957,7 @@ G89 Boring Cycle, Dwell, Feed Out G89 (X- Y- Z-) or (U- V- W-) R- L- P- -The 'G89' cycle is intended for boring. This cycle uses a P number, where P specifies the number of +The ``G89`` cycle is intended for boring. This cycle uses a P number, where P specifies the number of seconds to dwell. #. Preliminary motion, as described in the `Preliminary and In-Between Motion @@ -1969,10 +1969,10 @@ seconds to dwell. G90, G91 Distance Mode ---------------------- -* 'G90' - absolute distance mode In absolute distance mode, axis numbers (X, Y, Z, A, B, C, U, V, W) +* ``G90`` - absolute distance mode In absolute distance mode, axis numbers (X, Y, Z, A, B, C, U, V, W) usually represent positions in terms of the currently active coordinate system. Any exceptions to that rule are described explicitly in the `G80 G89 <#gcode:g80-g89>`__ Section. -* 'G91' - incremental distance mode In incremental distance mode, axis numbers usually represent +* ``G91`` - incremental distance mode In incremental distance mode, axis numbers usually represent increments from the current coordinate. G90 Example @@ -1996,9 +1996,9 @@ G91 Example G90.1, G91.1 Arc Distance Mode ------------------------------ -* 'G90.1' - absolute distance mode for I, J & K offsets. When G90.1 is in effect I and J both must +* ``G90.1`` - absolute distance mode for I, J & K offsets. When G90.1 is in effect I and J both must be specified with G2/3 for the XY plane or J and K for the XZ plane or it is an error. -* 'G91.1' - incremental distance mode for I, J & K offsets. G91.1 Returns I, J & K to their default +* ``G91.1`` - incremental distance mode for I, J & K offsets. G91.1 Returns I, J & K to their default behavior. G92 Coordinate System Offset @@ -2008,27 +2008,27 @@ G92 Coordinate System Offset G92 axes -'G92' makes the current point have the coordinates you want (without motion), where the axis words +``G92`` makes the current point have the coordinates you want (without motion), where the axis words contain the axis numbers you want. All axis words are optional, except that at least one must be used. If an axis word is not used for a given axis, the offset for that axis will be zero. -When 'G92' is executed, the `origins <#sec.machine-corrdinate-system>`__ of all coordinate systems +When ``G92`` is executed, the `origins <#sec.machine-corrdinate-system>`__ of all coordinate systems move. They move such that the value of the current controlled point, in the currently active coordinate system, becomes the specified value. All of the coordinate system’s origins (G53-G59.3) are offset this same distance. -'G92' uses the values stored in `parameters <#sub:numbered-parameters>`__ 5211-5219 as the X Y Z A B -C U V W offset values for each axis. The parameter values are 'absolute' machine coordinates in the -native machine 'units' as specified in the ini file. All axes defined in the ini file will be offset -when G92 is active. If an axis was not entered following the G92, that axis' offset will be zero. +``G92`` uses the values stored in `parameters <#sub:numbered-parameters>`__ 5211-5219 as the X Y Z A B +C U V W offset values for each axis. The parameter values are ``absolute`` machine coordinates in the +native machine ``units`` as specified in the ini file. All axes defined in the ini file will be offset +when G92 is active. If an axis was not entered following the G92, that axis`` offset will be zero. -For example, suppose the current point is at X=4 and there is currently no 'G92' offset active. Then -'G92 X7' is programmed. This moves all origins -3 in X, which causes the current point to become +For example, suppose the current point is at X=4 and there is currently no ``G92`` offset active. Then +``G92 X7`` is programmed. This moves all origins -3 in X, which causes the current point to become X=7. This -3 is saved in parameter 5211. -Being in incremental distance mode (G91 instead of G90) has no effect on the action of 'G92'. +Being in incremental distance mode (G91 instead of G90) has no effect on the action of ``G92``. -'G92' offsets may be already be in effect when the 'G92' is called. If this is the case, the offset +``G92`` offsets may be already be in effect when the ``G92`` is called. If this is the case, the offset is replaced with a new offset that makes the current point become the specified value. **It is an error if:** @@ -2048,10 +2048,10 @@ See the `Parameters <#gcode:parameters>`__ Section for more information. G92.1, G92.2 Reset G92 Offsets ------------------------------ -* 'G92.1' - turn off G92 offsets and reset +* ``G92.1`` - turn off G92 offsets and reset `parameters <#sub:numbered-parameters>`__ 5211 - 5219 to zero. -* 'G92.2' - turn off G92 offsets but keep +* ``G92.2`` - turn off G92 offsets but keep `parameters <#sub:numbered-parameters>`__ 5211 - 5219 available. .. _g923-restore-g92-offsets: @@ -2059,18 +2059,18 @@ G92.1, G92.2 Reset G92 Offsets G92.3 Restore G92 Offsets ------------------------- -* 'G92.3' - set the G92 offset to the values saved in parameters 5211 to 5219 +* ``G92.3`` - set the G92 offset to the values saved in parameters 5211 to 5219 -You can set axis offsets in one program and use the same offsets in another program. Program 'G92' -in the first program. This will set parameters 5211 to 5219. Do not use 'G92.1' in the remainder of +You can set axis offsets in one program and use the same offsets in another program. Program ``G92`` +in the first program. This will set parameters 5211 to 5219. Do not use ``G92.1`` in the remainder of the first program. The parameter values will be saved when the first program exits and restored when -the second one starts up. Use 'G92.3' near the beginning of the second program. That will restore +the second one starts up. Use ``G92.3`` near the beginning of the second program. That will restore the offsets saved in the first program. G93, G94, G95: Feed Rate Mode ----------------------------- -* 'G93' - is Inverse Time Mode. In inverse time feed rate mode, an F word means the move should be +* ``G93`` - is Inverse Time Mode. In inverse time feed rate mode, an F word means the move should be completed in [one divided by the F number] minutes. For example, if the F number is 2.0, the move should be completed in half a minute. @@ -2078,12 +2078,12 @@ G93, G94, G95: Feed Rate Mode G1, G2, or G3 motion, and an F word on a line that does not have G1, G2, or G3 is ignored. Being in inverse time feed rate mode does not affect G0 (`rapid move <#gcode:g0>`__) motions. -* 'G94' - is Units per Minute Mode. In units per minute feed mode, an F word is interpreted to mean +* ``G94`` - is Units per Minute Mode. In units per minute feed mode, an F word is interpreted to mean the controlled point should move at a certain number of inches per minute, millimeters per minute, or degrees per minute, depending upon what length units are being used and which axis or axes are moving. -* 'G95' - is Units per Revolution Mode In units per revolution mode, an F word is interpreted to +* ``G95`` - is Units per Revolution Mode In units per revolution mode, an F word is interpreted to mean the controlled point should move a certain number of inches per revolution of the spindle, depending on what length units are being used and which axis or axes are moving. G95 is not suitable for threading, for threading use G33 or G76. G95 requires that spindle.N.speed-in to be @@ -2103,10 +2103,10 @@ G96, G97 Spindle Control Mode G96 S- <$-> (Constant Surface Speed Mode) G97 S- <$-> (RPM Mode) -* 'D' - maximum spindle RPM -* 'S' - surface speed -* '$" - the spindle of which the speed will be varied. -* 'G96 D- S-' - selects constant surface speed of 'S' feet per minute (if G20 is in effect) or +* ``D`` - maximum spindle RPM +* ``S`` - surface speed +* ``$" - the spindle of which the speed will be varied. +* ``G96 D- S-`` - selects constant surface speed of ``S`` feet per minute (if G20 is in effect) or meters per minute (if G21 is in effect). D- is optional. When using G96, ensure that X0 in the current coordinate system (including offsets and tool @@ -2116,7 +2116,7 @@ G96, G97 Spindle Control Mode To achieve CSS mode on selected spindles programme successive G96 commands for each spindle prior to issuing M3. -* 'G97' selects RPM mode. +* ``G97`` selects RPM mode. G96 Example Line @@ -2132,11 +2132,11 @@ G96 Example Line G98, G99 Canned Cycle Return Level ---------------------------------- -* 'G98' - retract to the position that axis was in just before this series of one or more contiguous +* ``G98`` - retract to the position that axis was in just before this series of one or more contiguous canned cycles was started. -* 'G99' - retract to the position specified by the R word of the canned cycle. +* ``G99`` - retract to the position specified by the R word of the canned cycle. -Program a 'G98' and the canned cycle will use the Z position prior to the canned cycle as the Z +Program a ``G98`` and the canned cycle will use the Z position prior to the canned cycle as the Z return position if it is higher than the R value specified in the cycle. If it is lower, the R value will be used. The R word has different meanings in absolute distance mode and incremental distance mode. @@ -2151,10 +2151,10 @@ G98 Retract to Origin The G98 to the second line above means that the return move will be to the value of Z in the first line since it is higher that the R value specified. -The 'initial' (G98) plane is reset any time cycle motion mode is abandoned, whether explicitly (G80) -or implicitly (any motion code that is not a cycle). Switching among cycle modes (say G81 to G83) -does NOT reset the 'initial' plane. It is possible to switch between G98 and G99 during a series of -cycles. +The ``initial`` (G98) plane is reset any time cycle motion mode is abandoned, whether explicitly +(G80) or implicitly (any motion code that is not a cycle). Switching among cycle modes (say G81 to +G83) does NOT reset the ``initial`` plane. It is possible to switch between G98 and G99 during a +series of cycles. .. |G2 Example| image:: images/g2.png .. |G2-G3 Example| image:: images/g2-3.png diff --git a/doc/sphinx/source/gcode-reference/linuxcnc/m-code.rst b/doc/sphinx/source/gcode-reference/linuxcnc/m-code.rst index 8d2a3d109b7bff3bb29ff59d02d420fe0d496e30..2755968742989754de0ea8807bf3ed5fb60d9809 100644 --- a/doc/sphinx/source/gcode-reference/linuxcnc/m-code.rst +++ b/doc/sphinx/source/gcode-reference/linuxcnc/m-code.rst @@ -35,46 +35,46 @@ Code Description M0, M1 Program Pause -------------------- -* 'M0' - pause a running program temporarily. LinuxCNC remains in the Auto Mode so MDI and other +* ``M0`` - pause a running program temporarily. LinuxCNC remains in the Auto Mode so MDI and other manual actions are not enabled. Pressing the resume button will restart the program at the following line. -* 'M1' - pause a running program temporarily if the optional stop switch is on. LinuxCNC remains in +* ``M1`` - pause a running program temporarily if the optional stop switch is on. LinuxCNC remains in the Auto Mode so MDI and other manual actions are not enabled. Pressing the resume button will restart the program at the following line. M2, M30 Program End ------------------- -* 'M2' - end the program. Pressing r will start the program at the beginning of the file. -* 'M30' - exchange pallet shuttles and end the program. Pressing cycle start will start the program +* ``M2`` - end the program. Pressing r will start the program at the beginning of the file. +* ``M30`` - exchange pallet shuttles and end the program. Pressing cycle start will start the program at the beginning of the file. Both of these commands have the following effects: #. Change from Auto mode to MDI mode. -#. Origin offsets are set to the default (like 'G54'). -#. Selected plane is set to XY plane (like 'G17'). -#. Distance mode is set to absolute mode (like 'G90'). -#. Feed rate mode is set to units per minute (like 'G94'). -#. Feed and speed overrides are set to ON (like 'M48'). -#. Cutter compensation is turned off (like 'G40'). -#. The spindle is stopped (like 'M5'). -#. The current motion mode is set to feed (like 'G1'). -#. Coolant is turned off (like 'M9'). +#. Origin offsets are set to the default (like ``G54``). +#. Selected plane is set to XY plane (like ``G17``). +#. Distance mode is set to absolute mode (like ``G90``). +#. Feed rate mode is set to units per minute (like ``G94``). +#. Feed and speed overrides are set to ON (like ``M48``). +#. Cutter compensation is turned off (like ``G40``). +#. The spindle is stopped (like ``M5``). +#. The current motion mode is set to feed (like ``G1``). +#. Coolant is turned off (like ``M9``). M60 Pallet Change Pause ----------------------- -* 'M60' - exchange pallet shuttles and then pause a running program temporarily (regardless of the +* ``M60`` - exchange pallet shuttles and then pause a running program temporarily (regardless of the setting of the optional stop switch). Pressing the cycle start button will restart the program at the following line. M3, M4, M5 Spindle Control -------------------------- -* 'M3' - start the selected spindle clockwise at the 'S' speed. -* 'M4' - start the selected spindle counterclockwise at the 'S' speed. -* 'M5' - stop the selected spindle. +* ``M3`` - start the selected spindle clockwise at the ``S`` speed. +* ``M4`` - start the selected spindle counterclockwise at the ``S`` speed. +* ``M5`` - stop the selected spindle. Use $ to operate on specific spindles. If $ is omitted then thr commands operate on all spindles. @@ -97,11 +97,11 @@ For example If the $ is omitted then behaviour is exactly as normal for a single spindle machine -It is OK to use 'M3' or 'M4' if the `S <#sec:set-spindle-speed>`__ spindle speed is set to zero. If +It is OK to use ``M3`` or ``M4`` if the `S <#sec:set-spindle-speed>`__ spindle speed is set to zero. If this is done (or if the speed override switch is enabled and set to zero), the spindle will not start turning. If, later, the spindle speed is set above zero (or the override switch is turned -up), the spindle will start turning. It is OK to use 'M3' or 'M4' when the spindle is already -turning or to use 'M5' when the spindle is already stopped. +up), the spindle will start turning. It is OK to use ``M3`` or ``M4`` when the spindle is already +turning or to use ``M5`` when the spindle is already stopped. M6 Tool Change -------------- @@ -110,14 +110,14 @@ Manual Tool Change ~~~~~~~~~~~~~~~~~~ If the HAL component hal_manualtoolchange is loaded, M6 will stop the spindle and prompt the user to -change the tool based on the last 'T-' number programmed. For more information on +change the tool based on the last ``T-`` number programmed. For more information on hal_manualtoolchange see the `Manual Tool Change <#sec:manual-tool-change>`__ section. Tool Changer ~~~~~~~~~~~~ To change a tool in the spindle from the tool currently in the spindle to the tool most recently -selected (using a T word - see Section `Select Tool <#sec:select-tool>`__), program 'M6'. When the +selected (using a T word - see Section `Select Tool <#sec:select-tool>`__), program ``M6``. When the tool change is complete: * The spindle will be stopped. @@ -128,7 +128,7 @@ tool change is complete: * If configured in the .ini file some axis positions may move when a M6 is issued. See the `EMCIO section <#sec:emcio-section>`__ for more information on tool change options. * No other changes will be made. For example, coolant will continue to flow during the tool change - unless it has been turned off by an 'M9'. + unless it has been turned off by an ``M9``. The tool change may include axis motion. It is OK (but not useful) to program a change to the tool already in the spindle. It is OK if there is no tool in the selected slot; in that case, the spindle @@ -139,9 +139,9 @@ change in hal and possibly classic ladder. M7, M8, M9 Coolant Control -------------------------- -* 'M7' - turn mist coolant on. M7 controls iocontrol.0.coolant-mist pin. -* 'M8' - turn flood coolant on. M8 controls iocontrol.0.coolant-flood pin. -* 'M9' - turn both M7 and M8 off. +* ``M7`` - turn mist coolant on. M7 controls iocontrol.0.coolant-mist pin. +* ``M8`` - turn flood coolant on. M8 controls iocontrol.0.coolant-flood pin. +* ``M9`` - turn both M7 and M8 off. Connect one or both of the coolant control pins in HAL before M7 or M8 will control an output. M7 and M8 can be used to turn on any output via G code. @@ -151,17 +151,17 @@ It is OK to use any of these commands, regardless of the current coolant state. M19 Orient Spindle ------------------ -* 'M19 R- Q- [P-] [$-]' -* 'R' Position to rotate to from 0, valid range is 0-360 degrees -* 'Q' Number of seconds to wait until orient completes. If spindle.N.is-oriented does not become +* ``M19 R- Q- [P-] [$-]`` +* ``R`` Position to rotate to from 0, valid range is 0-360 degrees +* ``Q`` Number of seconds to wait until orient completes. If spindle.N.is-oriented does not become true within Q timeout an error occurs. -* 'P' Direction to rotate to position. +* ``P`` Direction to rotate to position. - * '0' rotate for smallest angular movement (default) - * '1' always rotate clockwise (same as M3 direction) - * '2' always rotate counterclockwise (same as M4 direction) + * ``0`` rotate for smallest angular movement (default) + * ``1`` always rotate clockwise (same as M3 direction) + * ``2`` always rotate counterclockwise (same as M4 direction) -* '$' The spindle to orient (actually only determines which HAL pins carry the spindle position +* ``$`` The spindle to orient (actually only determines which HAL pins carry the spindle position commands) M19 is cleared by any of M3,M4,M5. @@ -175,25 +175,25 @@ ORIENT_OFFSET = 0-360 (fixed offset in degrees added to M19 R word) HAL Pins -* 'spindle.N.orient-angle' (out float) Desired spindle orientation for M19. Value of the M19 R word +* ``spindle.N.orient-angle`` (out float) Desired spindle orientation for M19. Value of the M19 R word parameter plus the value of the [RS274NGC]ORIENT_OFFSET ini parameter. -* 'spindle.N.orient-mode' (out s32) Desired spindle rotation mode. Reflects M19 P parameter word, +* ``spindle.N.orient-mode`` (out s32) Desired spindle rotation mode. Reflects M19 P parameter word, Default = 0 -* 'spindle.N.orient' (out bit) Indicates start of spindle orient cycle. Set by M19. Cleared by any +* ``spindle.N.orient`` (out bit) Indicates start of spindle orient cycle. Set by M19. Cleared by any of M3,M4,M5. If spindle-orient-fault is not zero during spindle-orient true, the M19 command fails with an error message. -* 'spindle.N.is-oriented' (in bit) Acknowledge pin for spindle-orient. Completes orient cycle. If +* ``spindle.N.is-oriented`` (in bit) Acknowledge pin for spindle-orient. Completes orient cycle. If spindle-orient was true when spindle-is-oriented was asserted, the spindle-orient pin is cleared and the spindle-locked pin is asserted. Also, the spindle-brake pin is asserted. -* 'spindle.N.orient-fault' (in s32) Fault code input for orient cycle. Any value other than zero +* ``spindle.N.orient-fault`` (in s32) Fault code input for orient cycle. Any value other than zero will cause the orient cycle to abort. -* 'spindle.N.locked' (out bit) Spindle orient complete pin. Cleared by any of M3,M4,M5. +* ``spindle.N.locked`` (out bit) Spindle orient complete pin. Cleared by any of M3,M4,M5. M48, M49 Speed and Feed Override Control ---------------------------------------- -* 'M48' - enable the spindle speed and feed rate override controls. -* 'M49' - disable both controls. +* ``M48`` - enable the spindle speed and feed rate override controls. +* ``M49`` - disable both controls. These commands also take an optional $ parameter to determine which spindle they operate on. @@ -203,8 +203,8 @@ Rate <#sub:feed-rate>`__ Section for more details. M50 Feed Override Control ------------------------- -* 'M50 ' - enable the feed rate override control. The P1 is optional. -* 'M50 P0' - disable the feed rate control. +* ``M50 `` - enable the feed rate override control. The P1 is optional. +* ``M50 P0`` - disable the feed rate control. While disabled the feed override will have no influence, and the motion will be executed at programmed feed rate. (unless there is an adaptive feed rate override active). @@ -212,37 +212,37 @@ programmed feed rate. (unless there is an adaptive feed rate override active). M51 Spindle Speed Override Control ---------------------------------- -* 'M51 <$→'- enable the spindle speed override control for the selected spindle. The P1 is +* ``M51 <$→``- enable the spindle speed override control for the selected spindle. The P1 is optional. -* 'M51 P0 <$→' - disable the spindle speed override control program. While disabled the spindle +* ``M51 P0 <$→`` - disable the spindle speed override control program. While disabled the spindle speed override will have no influence, and the spindle speed will have the exact program specified value of the S-word (described in `Spindle Speed <#sec:set-spindle-speed>`__ Section). M52 Adaptive Feed Control ------------------------- -* 'M52 ' - use an adaptive feed. The P1 is optional. -* 'M52 P0' - stop using adaptive feed. +* ``M52 `` - use an adaptive feed. The P1 is optional. +* ``M52 P0`` - stop using adaptive feed. When adaptive feed is enabled, some external input value is used together with the user interface feed override value and the commanded feed rate to set the actual feed rate. In LinuxCNC, the HAL -pin 'motion.adaptive-feed' is used for this purpose. Values on 'motion.adaptive-feed' should range +pin ``motion.adaptive-feed`` is used for this purpose. Values on ``motion.adaptive-feed`` should range from 0 (feed hold) to 1 (full speed). M53 Feed Stop Control --------------------- -* 'M53 ' - enable the feed stop switch. The P1 is optional. Enabling the feed stop switch will +* ``M53 `` - enable the feed stop switch. The P1 is optional. Enabling the feed stop switch will allow motion to be interrupted by means of the feed stop control. In LinuxCNC, the HAL pin - 'motion.feed-hold' is used for this purpose. A 'true' value will cause the motion to stop when - 'M53' is active. -* 'M53 P0' - disable the feed stop switch. The state of 'motion.feed-hold' will have no effect on + ``motion.feed-hold`` is used for this purpose. A ``true`` value will cause the motion to stop when + ``M53`` is active. +* ``M53 P0`` - disable the feed stop switch. The state of ``motion.feed-hold`` will have no effect on feed when M53 is not active. M61 Set Current Tool -------------------- -* 'M61 Q-' - change the current tool number while in MDI or Manual mode. One use is when you power +* ``M61 Q-`` - change the current tool number while in MDI or Manual mode. One use is when you power up LinuxCNC with a tool currently in the spindle you can set that tool number without doing a tool change. @@ -253,12 +253,12 @@ It is an error if: M62 - M65 Digital Output Control -------------------------------- -* 'M62 P-' - turn on digital output synchronized with motion. The P- word specifies the digital +* ``M62 P-`` - turn on digital output synchronized with motion. The P- word specifies the digital output number. -* 'M63 P-' - turn off digital output synchronized with motion. The P- word specifies the digital +* ``M63 P-`` - turn off digital output synchronized with motion. The P- word specifies the digital output number. -* 'M64 P-' - turn on digital output immediately. The P- word specifies the digital output number. -* 'M65 P-' - turn off digital output immediately. The P- word specifies the digital output number. +* ``M64 P-`` - turn on digital output immediately. The P- word specifies the digital output number. +* ``M65 P-`` - turn off digital output immediately. The P- word specifies the digital output number. The P-word ranges from 0 to a default value of 3. If needed the the number of I/O can be increased by using the num_dio parameter when loading the motion controller. See the `Motion Section @@ -282,18 +282,18 @@ M66 Wait on Input M66 P- | E- -* 'P-' - specifies the digital input number from 0 to 3. -* 'E-' - specifies the analog input number from 0 to 3. -* 'L-' - specifies the wait mode type. +* ``P-`` - specifies the digital input number from 0 to 3. +* ``E-`` - specifies the analog input number from 0 to 3. +* ``L-`` - specifies the wait mode type. - * 'Mode 0: IMMEDIATE' - no waiting, returns immediately. The current value of the input is stored + * ``Mode 0: IMMEDIATE`` - no waiting, returns immediately. The current value of the input is stored in parameter #5399 - * 'Mode 1: RISE' - waits for the selected input to perform a rise event. - * 'Mode 2: FALL' - waits for the selected input to perform a fall event. - * 'Mode 3: HIGH' - waits for the selected input to go to the HIGH state. - * 'Mode 4: LOW' - waits for the selected input to go to the LOW state. + * ``Mode 1: RISE`` - waits for the selected input to perform a rise event. + * ``Mode 2: FALL`` - waits for the selected input to perform a fall event. + * ``Mode 3: HIGH`` - waits for the selected input to go to the HIGH state. + * ``Mode 4: LOW`` - waits for the selected input to go to the LOW state. -* 'Q-' - specifies the timeout in seconds for waiting. If the timeout is exceeded, the wait is +* ``Q-`` - specifies the timeout in seconds for waiting. If the timeout is exceeded, the wait is interrupt, and the variable #5399 will be holding the value -1. The Q value is ignored if the L-word is zero (IMMEDIATE). A Q value of zero is an error if the L-word is non-zero. @@ -328,9 +328,9 @@ M67 Analog Output,Synchronized M67 E- Q- -* 'M67' - set an analog output synchronized with motion. -* 'E-' - output number ranging from 0 to 3. -* 'Q-' - is the value to set (set to 0 to turn off). +* ``M67`` - set an analog output synchronized with motion. +* ``E-`` - output number ranging from 0 to 3. +* ``Q-`` - is the value to set (set to 0 to turn off). The actual change of the specified outputs will happen at the beginning of the next motion command. If there is no subsequent motion command, the queued output changes won’t happen. It’s best @@ -347,9 +347,9 @@ M68 Analog Output, Immediate M68 E- Q- -* 'M68' - set an analog output immediately. -* 'E-' - output number ranging from 0 to 3. -* 'Q-' - is the value to set (set to 0 to turn off). +* ``M68`` - set an analog output immediately. +* ``E-`` - output number ranging from 0 to 3. +* ``Q-`` - is the value to set (set to 0 to turn off). M68 output happen immediately as they are received by the motion controller. They are not synchronized with movement, and they will break blending. M68 functions the same as M64-65. @@ -360,10 +360,10 @@ controller. See the `Motion Section <#sec:motion>`__ for more information. M70 Save Modal State -------------------- -To explicitly save the modal state at the current call level, program 'M70'. Once modal state has -been saved with 'M70', it can be restored to exactly that state by executing an 'M72'. +To explicitly save the modal state at the current call level, program ``M70``. Once modal state has +been saved with ``M70``, it can be restored to exactly that state by executing an ``M72``. -A pair of 'M70' and 'M72' instructions will typically be used to protect a program against +A pair of ``M70`` and ``M72`` instructions will typically be used to protect a program against inadvertant modal changes within subroutines. The state saved consists of: @@ -380,7 +380,7 @@ The state saved consists of: * arc distance mode (G90.1, G91.1) * lathe radius/diameter mode (G7,G8) * path control mode (G61, G61.1, G64) -* current feed and speed ('F' and 'S' values) +* current feed and speed (``F`` and ``S`` values) * spindle status (M3,M4,M5) - on/off and direction * mist (M7) and flood (M8) status * speed override (M51) and feed override (M50) settings @@ -389,27 +389,27 @@ The state saved consists of: Note that in particular, the motion mode (G1 etc) is NOT restored. -'current call level' means either: +``current call level`` means either: * executing in the main program. There is a single storage location for state at the main program - level; if several 'M70' instructions are executed in turn, only the most recently saved state is - restored when an 'M72' is executed. + level; if several ``M70`` instructions are executed in turn, only the most recently saved state is + restored when an ``M72`` is executed. -* executing within a G-code subroutine. The state saved with 'M70' within a subroutine behaves +* executing within a G-code subroutine. The state saved with ``M70`` within a subroutine behaves exactly like a local named parameter - it can be referred to only within this subroutine - invocation with an 'M72' and when the subroutine exits, the parameter goes away. + invocation with an ``M72`` and when the subroutine exits, the parameter goes away. A recursive invocation of a subroutine introduces a new call level. M71 Invalidate Stored Modal State --------------------------------- -Modal state saved with an 'M70' or by an 'M73' at the current call level is invalidated (cannot be +Modal state saved with an ``M70`` or by an ``M73`` at the current call level is invalidated (cannot be restored from anymore). -A subsequent 'M72' at the same call level will fail. +A subsequent ``M72`` at the same call level will fail. -If executed in a subroutine which protects modal state by an 'M73', a subsequent return or endsub +If executed in a subroutine which protects modal state by an ``M73``, a subsequent return or endsub will **not** restore modal state. The usefulness of this feature is dubious. It should not be relied upon as it might go away. @@ -417,18 +417,18 @@ The usefulness of this feature is dubious. It should not be relied upon as it mi M72 Restore Modal State ----------------------- -`Modal state saved with an 'M70' <#mcode:m70-saved-state>`__ code can be restored by executing an -'M72'. +`Modal state saved with an ``M70`` <#mcode:m70-saved-state>`__ code can be restored by executing an +``M72``. The handling of G20/G21 is specially treated as feeds are interpreted differently depending on -G20/G21: if length units (mm/in) are about to be changed by the restore operation, 'M72 'will +G20/G21: if length units (mm/in) are about to be changed by the restore operation, ``M72 ``will restore the distance mode first, and then all other state including feed to make sure the feed value is interpreted in the correct unit setting. -It is an error to execute an 'M72' with no previous 'M70' save operation at that level. +It is an error to execute an ``M72`` with no previous ``M70`` save operation at that level. The following example demonstrates saving and explicitely restoring modal state around a subroutine -call using 'M70' and 'M72'. Note that the 'imperialsub' subroutine is not "aware" of the M7x +call using ``M70`` and ``M72``. Note that the ``imperialsub`` subroutine is not "aware" of the M7x features and can be used unmodified: .. code:: text @@ -466,17 +466,17 @@ features and can be used unmodified: M73 Save and Autorestore Modal State ------------------------------------ -To save modal state within a subroutine, and restore state on subroutine 'endsub' or any 'return' -path, program 'M73'. +To save modal state within a subroutine, and restore state on subroutine ``endsub`` or any ``return`` +path, program ``M73``. -Aborting a running program in a subroutine which has an 'M73' operation will **not** restore state . +Aborting a running program in a subroutine which has an ``M73`` operation will **not** restore state . -Also, the normal end ('M2') of a main program which contains an 'M73' will **not** restore state. +Also, the normal end (``M2``) of a main program which contains an ``M73`` will **not** restore state. The suggested use is at the beginning of a O-word subroutine as in the following example. Using -'M73' this way enables designing subroutines which need to modify modal state but will protect the +``M73`` this way enables designing subroutines which need to modify modal state but will protect the calling program against inadvertant modal changes. Note the use of `predefined named parameters -<#gcode:predefined-named-parameters>`__ in the 'showstate' subroutine. +<#gcode:predefined-named-parameters>`__ in the ``showstate`` subroutine. .. code:: text @@ -494,7 +494,7 @@ calling program against inadvertant modal changes. Note the use of `predefined n o call ; note - no M72 is needed here - the following endsub or an - ; explicit 'return' will restore caller state + ; explicit ``return`` will restore caller state O endsub ; main program @@ -512,20 +512,20 @@ calling program against inadvertant modal changes. Note the use of `predefined n M98 and M99 ----------- -The interpreter supports Fanuc-style main- and sub-programs with the 'M98' and 'M99' M-codes. See +The interpreter supports Fanuc-style main- and sub-programs with the ``M98`` and ``M99`` M-codes. See `Fanuc-Style Programs <#ocode:fanuc-style-programs>`__. Selectively Restoring Modal State ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Executing an 'M72' or returning from a subroutine which contains an 'M73' will restore `all modal +Executing an ``M72`` or returning from a subroutine which contains an ``M73`` will restore `all modal state saved <#mcode:m70-saved-state>`__. If only some aspects of modal state should be preserved, an alternative is the usage of `predefined named parameters <#gcode:predefined-named-parameters>`__, local parameters and conditional statements. The idea is to remember the modes to be restored at the beginning of the subroutine, and restore these before exiting. Here is an example, based on snippet of -'nc_files/tool-length-probe.ngc': +``nc_files/tool-length-probe.ngc``: .. code:: text @@ -552,17 +552,17 @@ M100 - M199 User Defined Commands M1-- -* 'M1--' - an integer in the range of 100 - 199. -* 'P-' - a number passed to the file as the first parameter. -* 'Q-' - a number passed to the file as the second parameter. +* ``M1--`` - an integer in the range of 100 - 199. +* ``P-`` - a number passed to the file as the first parameter. +* ``Q-`` - a number passed to the file as the second parameter. -The external program named 'M100' through 'M199' (no extension and a capitol M) is executed with the +The external program named ``M100`` through ``M199`` (no extension and a capitol M) is executed with the optional P and Q values as its two arguments. Execution of the G code file pauses until the external program exits. Any valid executable file can be used. The file must be located in the search path specificed in the ini file configuration. See the `Display Section <#sec:display-section>`__ for more information on search paths. -The error 'Unknown M code used' denotes one of the following +The error ``Unknown M code used`` denotes one of the following * The specified User Defined Command does not exist * The file is not an executable file diff --git a/doc/sphinx/source/gcode-reference/linuxcnc/o-code.rst b/doc/sphinx/source/gcode-reference/linuxcnc/o-code.rst index 9097ba48196e6fb0b292f2c775f94c3c1df071ae..3e7112cf586e2b1d5de9a0a2139da26d73f7ecc9 100644 --- a/doc/sphinx/source/gcode-reference/linuxcnc/o-code.rst +++ b/doc/sphinx/source/gcode-reference/linuxcnc/o-code.rst @@ -2,7 +2,7 @@ O Codes ======= O-codes provide for flow control in NC programs. Each block has an associated number, which is the -number used after O. Care must be taken to properly match the O-numbers. O codes use the letter 'O' +number used after O. Care must be taken to properly match the O-numbers. O codes use the letter ``O`` not the number zero as the first character in the number like O100 or o100. Numbering @@ -42,8 +42,8 @@ The behavior is undefined if: Subroutines ----------- -Subroutines starts at 'Onnn sub' and ends at 'Onnn endsub'. The lines between 'Onnn sub' and 'Onnn -endsub' are not executed until the subroutine is called with 'Onnn call'. Each subroutine must use a +Subroutines starts at ``Onnn sub`` and ends at ``Onnn endsub``. The lines between ``Onnn sub`` and ``Onnn +endsub`` are not executed until the subroutine is called with ``Onnn call``. Each subroutine must use a unique number. Subroutine Example @@ -63,8 +63,8 @@ information. O- Return -Inside a subroutine, 'O- return' can be executed. This immediately returns to the calling code, just -as though 'O- endsub' was encountered. +Inside a subroutine, ``O- return`` can be executed. This immediately returns to the calling code, just +as though ``O- endsub`` was encountered. O- Return Example @@ -85,12 +85,12 @@ for more information. O- Call -'O- Call' takes up to 30 optional arguments, which are passed to the subroutine as '#1', '#2' , …​, +``O- Call`` takes up to 30 optional arguments, which are passed to the subroutine as ``#1``, ``#2`` , …​, #N. Parameters from #N+1 to #30 have the same value as in the calling context. On return from the subroutine, the values of parameters #1 through #30 (regardless of the number of arguments) will be restored to the values they had before the call. Parameters #1 - #30 are local to the subroutine. -Because '1 2 3' is parsed as the number 123, the parameters must be enclosed in square brackets. The +Because ``1 2 3`` is parsed as the number 123, the parameters must be enclosed in square brackets. The following calls a subroutine with 3 arguments: O- Call Example @@ -113,14 +113,14 @@ Subroutine bodies may not be nested. They may only be called after they are defi called from other functions, and may call themselves recursively if it makes sense to do so. The maximum subroutine nesting level is 10. -Subroutines do not have 'return values', but they may change the value of parameters above #30 and +Subroutines do not have ``return values``, but they may change the value of parameters above #30 and those changes will be visible to the calling code. Subroutines may also change the value of global named parameters. Fanuc-Style Numbered Programs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Numbered programs (both main and subprograms), the 'M98' call and 'M99' return M-codes, and their +Numbered programs (both main and subprograms), the ``M98`` call and ``M99`` return M-codes, and their respective semantic differences are an alternative to the rs274ngc subroutines described above, provided for compatibility with Fanuc and other machine controllers. @@ -149,7 +149,7 @@ but this has no special meaning in the rs274ngc interpreter. Call a numbered subprogram. The block ``M98 P100`` is analogous to the traditional ``o100 call`` syntax, but may only be used to call a following numbered subprogram defined with ``o100``\ …​\ -``M99``. An optional 'L'-word specifies a loop count. +``M99``. An optional ``L``-word specifies a loop count. ``M30`` @@ -182,7 +182,7 @@ The ``M98`` subprogram call differs from rs274ngc ``O call`` in the following wa ``M98 L0`` block will not execute the subprogram. In rare cases, the ``M99`` M-code may be used to terminate the main program, where it indicates an -'endless program'. When the interpreter reaches an ``M99`` in the main program, it will skip back to +``endless program``. When the interpreter reaches an ``M99`` in the main program, it will skip back to the beginning of the file and resume execution at the first line. An example use of an endless program is in a machine warm-up cycle; a block delete program end ``/M30`` block might be used to stop the cycle at a tidy point when the operator is ready. @@ -219,10 +219,10 @@ and ``O200``, its value will equal ``5.25``. Looping ------- -The 'while loop' has two structures: 'while/endwhile', and 'do/while'. In each case, the loop is -exited when the 'while' condition evaluates to false. The difference is when the test condition is -done. The 'do/while' loop runs the code in the loop then checks the test condition. The -'while/endwhile' loop does the test first. +The ``while loop`` has two structures: ``while/endwhile``, and ``do/while``. In each case, the loop is +exited when the ``while`` condition evaluates to false. The difference is when the test condition is +done. The ``do/while`` loop runs the code in the loop then checks the test condition. The +``while/endwhile`` loop does the test first. While Endwhile Example @@ -257,24 +257,24 @@ Do While Example (msg, Loop Done!) M2 -Inside a while loop, 'O- break' immediately exits the loop, and 'O- continue' immediately skips to -the next evaluation of the 'while' condition. If it is still true, the loop begins again at the +Inside a while loop, ``O- break`` immediately exits the loop, and ``O- continue`` immediately skips to +the next evaluation of the ``while`` condition. If it is still true, the loop begins again at the top. If it is false, it exits the loop. Conditional ----------- -The 'if' conditional consists of a group of statements with the same 'o' number that start with 'if' -and end with 'endif'. Optional 'elseif' and 'else' conditions may be between the starting 'if' and -the ending 'endif'. +The ``if`` conditional consists of a group of statements with the same ``o`` number that start with ``if`` +and end with ``endif``. Optional ``elseif`` and ``else`` conditions may be between the starting ``if`` and +the ending ``endif``. -If the 'if' conditional evaluates to true then the group of statements following the 'if' up to the +If the ``if`` conditional evaluates to true then the group of statements following the ``if`` up to the next conditional line are executed. -If the 'if' conditional evaluates to false then the 'elseif' conditions are evaluated in order until -one evaluates to true. If the 'elseif' condition is true then the statements following the 'elseif' -up to the next conditional line are executed. If none of the 'if' or 'elseif' conditions evaluate to -true then the statements following the 'else' are executed. When a condition is evaluated to true no +If the ``if`` conditional evaluates to false then the ``elseif`` conditions are evaluated in order until +one evaluates to true. If the ``elseif`` condition is true then the statements following the ``elseif`` +up to the next conditional line are executed. If none of the ``if`` or ``elseif`` conditions evaluate to +true then the statements following the ``else`` are executed. When a condition is evaluated to true no more conditions are evaluated in the group. If Endif Example @@ -301,7 +301,7 @@ If ElseIf Else EndIf Example F150 o102 endif -Several conditons may be tested for by 'elseif' statements until the 'else' path is finally executed +Several conditons may be tested for by ``elseif`` statements until the ``else`` path is finally executed if all preceding conditons are false: If Elseif Else Endif Example @@ -322,7 +322,7 @@ If Elseif Else Endif Example Repeat ------ -The 'repeat' will execute the statements inside of the repeat/endrepeat the specified number of +The ``repeat`` will execute the statements inside of the repeat/endrepeat the specified number of times. The example shows how you might mill a diagonal series of shapes starting at the present position. @@ -362,8 +362,8 @@ Calling Files ------------- To call a separate file with a subroutine name the file the same as your call and include a sub and -endsub in the file. The file must be in the directory pointed to by 'PROGRAM_PREFIX' or -'SUBROUTINE_PATH' in the ini file. The file name can include **lowercase** letters, numbers, dash, +endsub in the file. The file must be in the directory pointed to by ``PROGRAM_PREFIX`` or +``SUBROUTINE_PATH`` in the ini file. The file name can include **lowercase** letters, numbers, dash, and underscore only. A named subroutine file can contain only a single subroutine definition. Named File Example @@ -396,7 +396,7 @@ Called File Example Subroutine return values ------------------------ -Subroutines may optionally return a value by an optional expression at an 'endsub' or 'return' +Subroutines may optionally return a value by an optional expression at an ``endsub`` or ``return`` statement. Return value example @@ -407,9 +407,9 @@ Return value example ... o123 endsub [3 * 4] -A subroutine return value is stored in the '<_value>' `predefined named parameter -<#gcode:predefined-named-parameters>`__ , and the '<_value_returned>' predefined parameter is set to -1, to indicate a value was returned. Both parameters are global, and are cleared just before the +A subroutine return value is stored in the ``<_value>`` `predefined named parameter +<#gcode:predefined-named-parameters>`__ , and the ``<_value_returned>`` predefined parameter is set +to 1, to indicate a value was returned. Both parameters are global, and are cleared just before the next subroutine call. Errors