
\chapter{AXIS}


\section{Introduction}

AXIS\index{AXIS} is a graphical front-end for EMC2 which features
a live preview and backplot. It is written in Python\index{Python}
and uses Tk\index{Tk} and OpenGL\index{OpenGL} to display its user
interface.

%
\begin{figure}[H]
\caption{AXIS Window\label{cap:AXIS-Window}}


\centering{}\includegraphics[width=0.6\paperwidth,keepaspectratio]{gui/images/axis_2\lyxdot 3}
\end{figure}



\section{Getting Started}

To select AXIS as the front-end for EMC2, edit the .ini file. In the
section \texttt{{[}DISPLAY{]}} change the \texttt{DISPLAY} line to
read
\begin{quote}
DISPLAY = axis
\end{quote}
Then, start EMC2 and select that ini file. The sample configuration
\texttt{sim/axis.ini} is already configured to use AXIS as its front-end.

When you start AXIS, a window like the one in Figure \ref{cap:AXIS-Window}
is shown.


\subsection{A Typical Session}
\begin{enumerate}
\item Start EMC.
\item Clear the E-STOP (F1) and turn the Machine Power (F2) on.
\item Home all axes.
\item Load the g-code file.
\item Use the preview plot to verify that the program is correct.
\item Set the proper offsets for each axis by jogging and using the Touch
Off button.
\item Run the program.
\item To run the same file again, return to step 6. To run a different file,
return to step 4. When you're done, exit AXIS.
\end{enumerate}

\section{AXIS Display}

The AXIS window contains the following elements:
\begin{itemize}
\item A display area that shows a preview of the loaded file (in this case,
\textquotedbl{}axis.ngc\textquotedbl{}), as well as the current location
of the CNC\index{CNC} machine's \textquotedbl{}controlled point\textquotedbl{}.
Later, this area will display the path the CNC machine has moved through,
called the \textquotedbl{}backplot\textquotedbl{}
\item A menu bar and toolbar that allow you to perform various actions
\item \textquotedbl{}Manual Control Tab\textquotedbl{} \index{Manual},
which allows you to make the machine move, turn the spindle on or
off, and turn the coolant on or off if included in the ini file.
\item \textquotedbl{}MDI Tab'' \index{MDI}, where G-code programs can
be entered manually, one line at a time. This also shows the \textquotedbl{}Active
G Codes\textquotedbl{} which shows which modal G Codes are in effect.
\item \textquotedbl{}Feed Override\textquotedbl{} \index{feed override},
which allows you to increase or decrease the speed at which EMC executes
Feed Moves the selected program. The default maximum is 120\% and
can be set to a different value in the ini file. See the Integrators
Manual for more information on this setting.
\item \textquotedbl{}Spindle Override\textquotedbl{} \index{Spindle Override},
which allows you to increase or decrease the speed at which EMC commands
the spindle to run if spindle control is configured.
\item \textquotedbl{}Jog Speed\textquotedbl{} \index{Jog Speed}, which
allows you to set the jog speed within the limits set in the ini file.
See the Integrators Manual for more information on the ini file.
\item \textquotedbl{}Max Velocity\textquotedbl{}, which allows you to set
the maximum velocity for rapids and cap feed rates (except spindle
synchronized motion) for dry runs. Currently only AXIS and Halui allow
you to set it.
\item A text display area that shows the G-code source of the loaded file.
\item A status bar which shows the state of the machine. In this screen
shot, the machine is turned on, does not have a tool inserted, and
the displayed position is \textquotedbl{}Relative\index{position: relative}''
to the machine offset (as opposed to {}``Absolute\index{position: absolute}''),
and the {}``Actual\index{position: actual}'' (as opposed to {}``Commanded\index{position: commanded}''
position)
\end{itemize}

\subsection{Menu Items}

Some menu items might be grayed out depending on how you have your
.ini file configured. For more information on configuration see the
Integrators Manual.


\subsubsection{File Menu}
\begin{description}
\item [{Open...}] Opens a standard dialog box to open a g code file to
load in AXIS. If you have configured EMC to use a filter program you
can also open it up. See the Integrators manual for more information
on filter programs.
\item [{Recent~Files}] Displays a list of recently opened files.
\item [{Edit...}] Open the current g code file for editing if you have
an editor configured in your ini file. See the Integrators Manual
for more information on specifying an editor to use.
\item [{Reload}] reload the current g code file. If you edited it you must
reload it for the changes to take affect. If you stop a file and want
to start from the beginning then reload the file. The toolbar reload
is the same as the menu.
\item [{Save~gcode~as...}] Save the current file with a new name.
\item [{Properties}] Properties of the current loaded g code file.
\item [{Edit~tool~table...}] Same as Edit if you have defined an editor
you can open the tool table and edit it.
\item [{Reload~tool~table}] After editing the tool table you must reload
it.
\item [{Ladder~editor}] If you have loaded Classic Ladder you can edit
it from here. See the Integrators Manual on setting up Classic Ladder
\item [{Quit}] Terminates the current EMC session.
\end{description}

\subsubsection{Machine}
\begin{description}
\item [{Toggle~Emergency~Stop~F1}]~
\item [{Toggle~Machine~Power~F2}]~
\item [{Run~Program}]~
\item [{Run~From~Selected~Line}] Select the line you want to start from
first. Use with caution as this will move the tool to the expected
position before the line first then it will execute the rest of the
code.
\item [{Step}] Single step through a program.
\item [{Pause}] Pause a program.
\item [{Resume}] Resume running from a pause.
\item [{Stop}] Stop a running program.
\item [{Stop~at~M1}] If you have a M1 in your g code and this is checked
program execution will stop on the M1 line. Press Resume to continue.
\item [{Skip~lines~with~\textquotedbl{}/\textquotedbl{}}] If a line
begins with / and this is checked it will skip that line.
\item [{Clear~MDI~history}] Clears the MDI history window.
\item [{Copy~from~MDI~history}] Copies the MDI history to the clipboard
\item [{Paste~to~MDI~history}] Paste from the clipboard to the MDI history
window
\item [{Calibration}] This is a servo testing pop up widow for each axis.
After making changes and testing them it can save them to your .ini
file.
\item [{Show~HAL~Configuration}] Opens up the HAL Configuration widow
where you can monitor HAL Components, Pins, Parameters, Signals, Functions,
and Threads.
\item [{HAL~Meter}] Opens up a window where you can monitor a single HAL
Pin, Signal, or Parameter.
\item [{HAL~Scope}] Opens up a Scope window where you can set up and monitor
Pins and Signals.
\item [{Show~EMC~Status}] Opens up a window showing EMC's status.
\item [{Set~Debug~Level}] Opens a window where debug levels can be viewed
and some can be set.
\item [{Homing}] Home any or all axis.
\item [{Unhoming}] Unhome any or all axis.
\item [{Zero~Coordinate~System}] Zero work offsets.
\end{description}

\subsubsection{View}
\begin{description}
\item [{Top~View}]~
\item [{Rotated~Top~View}]~
\item [{Side~View}]~
\item [{Front~View}]~
\item [{Perspective~View}]~
\item [{Display~Inches}]~
\item [{Display~MM}]~
\item [{Show~Program}]~
\item [{Show~Live~Plot}]~
\item [{Show~Tool}]~
\item [{Show~Extents}]~
\item [{Show~Machine~Limits}]~
\item [{Show~Velocity}]~
\item [{Show~Distance~to~Go}]~
\item [{Clear~Live~Plot}]~
\item [{Show~Commanded~Position}]~
\item [{Show~Actual~Position}]~
\item [{Show~Machine~Position}]~
\item [{Show~Relative~Position}]~
\end{description}

\subsubsection{Help}
\begin{description}
\item [{About~Axis}]~
\item [{Quick~Reference}] Shows the keyboard shortcut keys.
\end{description}

\subsection{Toolbar buttons}

From left to right, the toolbar buttons (keyboard shortcuts in {[}{]}).
\begin{enumerate}
\item \includegraphics{gui/images/tool_estop} Toggle Emergency Stop {[}F1{]}
(also called E-Stop\index{ESTOP})
\item \includegraphics{gui/images/tool_power} Toggle Machine Power {[}F2{]}\index{machine on}
\item \includegraphics{gui/images/tool_open} Open G Code file {[}O{]}
\item \includegraphics{gui/images/tool_reload} Reload current file {[}Ctrl-R{]}
\item \includegraphics{gui/images/tool_run} Begin executing the current
file {[}R{]}
\item \includegraphics{gui/images/tool_step} Execute next line {[}T{]}
\item \includegraphics{gui/images/tool_pause} Pause Execution {[}P{]} Resume
Execution{[}S{]}
\item \includegraphics{gui/images/tool_stop} Stop Program Execution {[}ESC{]}
\item \includegraphics{gui/images/tool_blockdelete} Toggle Skip lines with
\textquotedbl{}/\textquotedbl{} {[}Alt-M-/{]}
\item \includegraphics{gui/images/tool_optpause} Toggle Optional Pause
{[}Alt-M-1{]}
\item \includegraphics{gui/images/tool_zoomin} Zoom In
\item \includegraphics{gui/images/tool_zoomout} Zoom Out
\item \includegraphics{gui/images/tool_axis_z} Top view 
\item \includegraphics{gui/images/tool_axis_z2} Rotated Top view 
\item \includegraphics{gui/images/tool_axis_x} Front view 
\item \includegraphics{gui/images/tool_axis_y} Side view 
\item \includegraphics{gui/images/tool_axis_p} Perspective view 
\item \includegraphics{gui/images/tool_rotate} Toggle between Drag and
Rotate Mode {[}D{]}
\item \includegraphics{gui/images/tool_clear} Clear live backplot {[}Ctrl-K{]}
\end{enumerate}

\subsection{Graphical Display Area}


\subsubsection{Coordinate Display}

In the upper-left corner of the program display is the coordinate
display. It shows the position of the machine. To the left of the
axis name, an origin symbol (\includegraphics[width=1.5ex]{gui/images/axis-homed})
is shown if the axis has been properly homed. To the right of the
axis name, a limit symbol (\includegraphics[width=2ex]{gui/images/axis-limit})
is shown if the axis is on one of its limit switches.

To properly interpret these numbers, refer to the \textquotedbl{}Position:\textquotedbl{}
indicator in the status bar. If the position is \textquotedbl{}Absolute\textquotedbl{},
then the displayed number is in the machine coordinate system. If
it is \textquotedbl{}Relative\textquotedbl{}, then the displayed number
is in the offset coordinate system. When the coordinates displayed
are relative and an offset has been set, the display will include
a cyan \textquotedbl{}machine origin\textquotedbl{} marker (\includegraphics[width=2ex]{gui/images/axis-machineorigin}).
If the position is \textquotedbl{}Commanded\textquotedbl{}, then it
is the ideal position--for instance, the exact coordinate given in
a \texttt{G0} command. If it is \textquotedbl{}Actual\textquotedbl{},
then it is the position the machine has actually been moved to. These
values can differ for several reasons: Following error, dead band,
encoder resolution, or step size. For instance, if you command a movement
to X 0.0033 on your mill, but one step of your stepper motor is 0.00125,
then the \textquotedbl{}Commanded\textquotedbl{} position will be
0.0033 but the \textquotedbl{}Actual\textquotedbl{} position will
be 0.0025 (2 steps) or 0.00375 (3 steps).


\subsubsection{Preview Plot\index{preview plot}}

When a file is loaded, a preview of it is shown in the display area.
Fast moves (such as those produced by the \texttt{G0} command) are
shown as green lines. Moves at a feed rate (such as those produced
by the \texttt{G1} command) are shown as solid white lines. Dwells
(such as those produced by the \texttt{G4} command) are shown as small
\textquotedbl{}X\textquotedbl{} marks.

G0 (Rapid) moves prior to a feed move will not show up on the preview
plot. Rapid moves after a T<n> (Tool Change) will not show on the
AXIS preview until after a feed move. To turn either of these features
off program a G1 without any moves prior to the G0 moves.


\subsubsection{Program Extents\index{program extents}}

The \textquotedbl{}extents\textquotedbl{} of the program in each axis
are shown. At each end, the least or greatest coordinate value is
indicated. In the middle, the difference between the coordinates is
shown. In Figure (\ref{cap:AXIS-Window}), the X extent of the file
is from 0.00 to 6.92 inches, a total of 6.92 inches.

When some coordinates exceed the \textquotedbl{}soft limits\textquotedbl{}
in the .ini file, the relevant dimension is shown in a different color
and enclosed by a box. In Figure (\ref{cap:Soft-Limit}) the maximum
soft limit is exceeded on the X axis as indicated by the box surrounding
the coordinate value.

%
\begin{figure}[H]
\caption{Soft Limit\label{cap:Soft-Limit}}


\centering{}\includegraphics{gui/images/axis-outofrange}
\end{figure}



\subsubsection{Tool Cone}

The location of the tip of the tool is indicated by the \textquotedbl{}tool
cone\textquotedbl{}. The cone does not indicate anything about the
shape, length, or radius of the tool.

When a tool is loaded (for instance, with the MDI command \texttt{T1M6}),
the cone changes to a cylinder which shows the diameter of the tool
given in the tool table file.


\subsubsection{Backplot}

When the machine moves, it leaves a trail called the backplot. The
color of the line indicates the type of motion: Yellow for jogs, faint
green for rapid movements, red for straight moves at a feed rate,
and magenta for circular moves at a feed rate.


\subsubsection{Interacting}

By left-clicking on a portion of the preview plot, the line will be
highlighted in both the graphical and text displays. By left-clicking
on an empty area, the highlighting will be removed.

By dragging with the left mouse button pressed, the preview plot will
be shifted (panned).

By dragging with shift and the left mouse button pressed, or by dragging
with the mouse wheel pressed, the preview plot will be rotated. When
a line is highlighted, the center of rotation is the center of the
line. Otherwise, the center of rotation is the center of the file
as a whole.

By rotating the mouse wheel, or by dragging with the right mouse button
pressed, or by dragging with control and the left mouse button pressed,
the preview plot will be zoomed in or out.

By clicking one of the \textquotedbl{}Preset View\textquotedbl{} icons,
or by pressing \textquotedbl{}V\textquotedbl{}, several preset views
may be selected.


\subsection{Text Display Area}

By left-clicking a line of the program, the line will be highlighted
in both the graphical and text displays in blue.

When the program is running, the line currently being executed is
highlighted in red. If no line has been selected by the user, the
text display will automatically scroll to show the current line.

%
\begin{figure}[H]
\caption{Current and Selected Lines\label{cap:Current-and-Selected}}


\centering{}\includegraphics[width=0.7\paperwidth]{gui/images/axis-currentandselected}
\end{figure}



\subsection{Manual Control\index{Manual}}

While the machine is turned on but not running a program, the items
in the \textquotedbl{}Manual Control\textquotedbl{} tab can be used
to move the machining center or turn different parts of it on and
off.

When the machine is not turned on, or when a program is running, the
manual controls are unavailable.

Many of the items described below are not useful on all machines.
When AXIS detects that a particular pin is not connected in HAL, the
corresponding item in the Manual Control tab is removed. For instance,
if the HAL pin \texttt{motion.spindle-brake} is not connected, then
the \textquotedbl{}Brake\textquotedbl{} button will not appear on
the screen. If the environment variable \texttt{AXIS\_NO\_AUTOCONFIGURE}
is set, this behavior is disabled and all the items will appear.


\subsubsection{The \textquotedbl{}Axis\textquotedbl{} group}

\textquotedbl{}Axis\textquotedbl{} allows you to manually move the
machine. This action is known as \textquotedbl{}jogging\textquotedbl{}.
First, select the axis to be moved by clicking it. Then, click and
hold the \textquotedbl{}+\textquotedbl{} or \textquotedbl{}-\textquotedbl{}
button depending on the desired direction of motion. The first four
axes can also be moved by the arrow keys (X and Y), PAGE UP and PAGE
DOWN keys (Z) and the {[} and {]} keys (A).

If \textquotedbl{}Continuous\textquotedbl{} is selected, the motion
will continue as long as the button or key is pressed. If another
value is selected, the machine will move exactly the displayed distance
each time the button is clicked or the key is pressed. By default,
the available values are:
\begin{quotation}
0.1000, 0.0100, 0.0010, 0.0001
\end{quotation}
See the Configure section of the Integrators Manual for more information
on setting the increments.


\subsubsection{Homing}

If your machine has home switches and a homing sequence defined for
all axes the button will read \textquotedbl{}Home All\textquotedbl{}.
The \textquotedbl{}Home All\textquotedbl{} button or the Ctrl-HOME
key will home all axes using the homing sequence. Pressing the HOME
key will home the current axis, even if a homing sequence is defined. 

If your machine has home switches and no homing sequence is defined
or not all axes have a homing sequence the button will read \textquotedbl{}Home\textquotedbl{}
and will home the selected axis only. Each axis must be selected and
homed separately.

If your machine does not have home switches defined in the configuration
the \textquotedbl{}Home\textquotedbl{} button will set the current
selected axis current position to be the absolute position 0 for that
axis and will set the \textquotedbl{}is-homed\textquotedbl{} bit for
that axis.

See the Integrators Manual for more information on homing.


\subsubsection{Touch Off}

By pressing \textquotedbl{}Touch Off\textquotedbl{} or the END key,
the \textquotedbl{}G54 offset\textquotedbl{} for the current axis
is changed so that the current axis value will be the specified value.
Expressions may be entered using the rules for rs274ngc programs,
except that variables may not be referred to. The resulting value
is shown as a number.

%
\begin{figure}[H]
\caption{Touch Off\label{cap:Touch-Off}}


\centering{}\includegraphics[scale=0.8]{gui/images/touchoff}
\end{figure}



\subsubsection{Override Limits}

By pressing \textquotedbl{}Override Limits\textquotedbl{}, the machine
will temporarily be allowed to jog off of a physical limit switch.
This check box is only available if a limit switch is tripped.


\subsubsection{The \textquotedbl{}Spindle\textquotedbl{} group\index{spindle}}

The buttons on the first row select the direction for the spindle
to rotate: Counterclockwise, Stopped, Clockwise. The buttons on the
next row increase or decrease the rotation speed. The checkbox on
the third row allows the spindle brake to be engaged or released.
Depending on your machine configuration, not all the items in this
group may appear.


\subsubsection{The \textquotedbl{}Coolant\textquotedbl{} group\index{coolant}}

The two buttons allow the \textquotedbl{}Mist\textquotedbl{} and \textquotedbl{}Flood\textquotedbl{}
coolants to be turned on and off. Depending on your machine configuration,
not all the items in this group may appear.


\subsection{MDI}

MDI\index{MDI}, allows G-code programs can be entered manually, one
line at a time. When the machine is not turned on, or when a program
is running, the MDI controls are unavailable.

%
\begin{figure}[H]
\caption{The MDI tab\label{cap:The-MDI-tab}}


\centering{}\includegraphics[scale=0.8]{gui/images/axis_mdi}
\end{figure}

\begin{description}
\item [{History:}] This shows MDI commands that have been typed earlier
in this session.
\item [{MDI~Command:}] This allows you to enter a g-code command to be
executed. Execute the command by pressing Enter or by clicking \textquotedbl{}Go\textquotedbl{}.
\item [{Active~G-Codes:}] This shows the \textquotedbl{}modal codes\textquotedbl{}
that are active in the interpreter. For instance, \textquotedbl{}G54\textquotedbl{}
indicates that the \textquotedbl{}G54 offset\textquotedbl{} is applied
to all coordinates that are entered. When in Auto the Active G-Codes
represent the codes after any read ahead by the interpreter.
\end{description}

\subsection{Feed Override\index{feed override}}

By moving this slider, the programmed feed rate can be modified. For
instance, if a program requests \texttt{F60} and the slider is set
to 120\%, then the resulting feed rate will be 72.


\subsection{Spindle Speed Override\index{spindle speed override}}

By moving this slider, the programmed spindle feed rate can be modified.
For instance, if a program requests F8000 and the slider is set to
80\%, then the resulting spindle speed will be 6400. This item only
appears when the HAL pin \texttt{motion.spindle-speed-out} is connected.


\subsection{Jog Speed\index{jog speed} }

By moving this slider, the speed of jogs can be modified. For instance,
if the slider is set to 1 in/min, then a .01 inch jog will complete
in about .6 seconds, or 1/100 of a minute. Near the left side (slow
jogs) the values are spaced closely together, while near the right
side (fast jogs) they are spaced much further apart, allowing a wide
range of jog speeds with fine control when it is most important.

On machines with a rotary axis, a second jog speed slider is shown.
This slider sets the jog rate for the rotary axes (A, B and C).


\subsection{Max Velocity\index{Max Velocity}}

By moving this slider, the maximum velocity can be set. This caps
the maximum velocity of axis no matter what is programed in the g
code file.


\section{Keyboard Controls}

Almost all actions in AXIS can be accomplished with the keyboard.
A full list of keyboard shortcuts can be found in the AXIS Quick Reference,
which can be displayed by choosing \noun{Help > Quick Reference}.
Many of the shortcuts are unavailable when in MDI mode. 


\subsubsection*{Feed Override Keys}

The Feed Override keys behave differently when in Manual Mode. The
keys `12345678 will select an axis if it is programed. If you have
3 axis then ` will select axis 0, 1 will select axis 1 and 2 will
select axis 2. The remainder of the number keys will still set the
Feed Override. When running a program `1234567890 will set the Feed
Override to 0\% - 100\%.

The most frequently used keyboard shortcuts are shown in Table \ref{cap:Most-Common-Keyboard}.

%
\begin{table}[H]
\caption{Most Common Keyboard Shortcuts\label{cap:Most-Common-Keyboard}}


\centering{}\begin{tabular}{|c|c|c|}
\hline 
Keystroke & Action Taken & Mode\tabularnewline
\hline
\hline 
F1 & Toggle Emergency Stop & All\tabularnewline
\hline 
F2 & Turn machine on/off & All\tabularnewline
\hline 
`, 1 .. 9, 0 & Set feed override from 0\% to 100\% & Varies\tabularnewline
\hline 
X, ` & Activate first axis & Manual\tabularnewline
\hline 
Y, 1 & Activate second axis & Manual\tabularnewline
\hline 
Z, 2 & Activate third axis & Manual\tabularnewline
\hline 
A, 3 & Activate fourth axis & Manual\tabularnewline
\hline 
I & Select jog increment & Manual\tabularnewline
\hline 
C & Continuous jog & Manual\tabularnewline
\hline 
Control-Home & Perform homing sequence & Manual\tabularnewline
\hline 
End & Touch off: Set G54 offset for active axis & Manual\tabularnewline
\hline 
Left, Right & Jog first axis & Manual\tabularnewline
\hline 
Up, Down & Jog second axis & Manual\tabularnewline
\hline 
Pg Up, Pg Dn & Jog third axis & Manual\tabularnewline
\hline 
{[}, {]} & Jog fourth axis & Manual\tabularnewline
\hline 
O & Open File & Manual\tabularnewline
\hline 
Control-R & Reload File & Manual\tabularnewline
\hline 
R & Run file & Manual\tabularnewline
\hline 
P & Pause execution & Auto\tabularnewline
\hline 
S & Resume Execution & Auto\tabularnewline
\hline 
ESC & Stop execution & Auto\tabularnewline
\hline 
Control-K & Clear backplot & Auto/Manual\tabularnewline
\hline 
V & Cycle among preset views & Auto/Manual\tabularnewline
\hline
Shift-Left,Right & Rapid X Axis & Manual\tabularnewline
\hline
Shift-Up,Down & Rapid Y Axis & Manual\tabularnewline
\hline
Shift-PgUp, PgDn & Rapid Z Axis & Manual\tabularnewline
\hline
\end{tabular}
\end{table}



\section{Show EMC Status}

AXIS includes a program called \textquotedbl{}emctop\textquotedbl{}
which shows some of the details of EMC's state. You can run this program
by invoking \noun{Machine > Show EMC Status}

%
\begin{figure}[H]
\caption{EMC Status Window\label{cap:EMC-Status-Window}}


\centering{}\includegraphics[width=0.8\paperwidth]{gui/axis-emctop}
\end{figure}


The name of each item is shown in the left column. The current value
is shown in the right column. If the value has recently changed, it
is shown on a red background.


\section{MDI interface}

AXIS includes a program called \textquotedbl{}MDI\textquotedbl{} which
allows text-mode entry of MDI commands to a running EMC session. You
can run this program by opening a terminal and typing
\begin{quote}
mdi /path/to/emc.nml
\end{quote}
Once it is running, it displays the prompt \texttt{MDI>}. When a blank
line is entered, the machine's current position is shown. When a command
is entered, it is sent to EMC to be executed. 

This is a sample session of mdi.
\begin{quote}
\$ mdi \textasciitilde{}/emc2/configs/sim/emc.nml \\
MDI> \\
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)\\
MDI> G1 F5 X1\\
MDI> \\
(0.5928500000000374, 0.0, 0.0, 0.0, 0.0, 0.0)\\
MDI> \\
(1.0000000000000639, 0.0, 0.0, 0.0, 0.0, 0.0)
\end{quote}

\section{axis-remote}

AXIS includes a program called \textquotedbl{}axis-remote\textquotedbl{}
which can send certain commands to a running AXIS. The available commands
are shown by running \texttt{axis-remote -\--help} and include checking
whether AXIS is running (\texttt{-\--ping}), loading a file by name,
reloading the currently loaded file (\texttt{-\--reload}), and making
AXIS exit (\texttt{-\--quit}).


\section{Manual Tool Change\index{Manual Tool Change}\label{sec:Manual-Tool-Change}}

EMC2 includes a userspace hal component called \textquotedbl{}hal\_manualtoolchange\textquotedbl{},
which shows a window (Figure \ref{cap:The-Manual-Toolchange}) when
a \texttt{M6} command is issued. After the OK button is pressed, execution
of the program will continue.

The HAL configuration file \texttt{configs/sim/axis\_manualtoolchange.hal}
shows the HAL commands necessary to use this component.

hal\_manualtoolchange can be used even when AXIS is not used as the
GUI. This component is most useful if you have presettable tools and
you use the tool table.

Important Note: Rapids will not show on the preview after a T<n> is
issued until the next feed move after the M6. This can be very confusing
to most users. To turn this feature off for the current tool change
program a G1 with no move after the T<n>.

%
\begin{figure}[H]
\caption{The Manual Toolchange Window\label{cap:The-Manual-Toolchange}}


\centering{}\includegraphics[scale=0.8]{gui/images/manualtoolchange}
\end{figure}



\section{Python modules }

AXIS\index{AXIS} includes several Python\index{Python} modules which
may be useful to others. For more information on one of these modules,
use \texttt{\textquotedbl{}pydoc <module name>\textquotedbl{}} or
read the source code. These modules include:
\begin{itemize}
\item \texttt{emc} provides access to the emc command, status, and error
channels
\item \texttt{gcode} provides access to the rs274ngc interpreter
\item \texttt{rs274} provides additional tools for working with rs274ngc
files
\item \texttt{hal} allows the creation of userspace HAL components written
in Python
\item \texttt{\_togl} provides an OpenGL widget that can be used in Tkinter
applications
\item \texttt{minigl} provides access to the subset of OpenGL used by AXIS
\end{itemize}
To use these modules in your own scripts, you must ensure that the
directory where they reside is on Python's module path. When running
an installed version of EMC2, this should happen automatically. When
running \textquotedbl{}in-place\textquotedbl{}, this can be done by
using \texttt{scripts/emc-environment}.


\section{Lathe Mode}

By including the line 
\begin{quote}
LATHE=1
\end{quote}
in the {[}DISPLAY{]} section of the ini file, AXIS selects lathe mode.
The \textquotedbl{}Y\textquotedbl{} axis is not shown in coordinate
readouts, the view is changed to show the Z axis extending to the
right and the X axis extending towards the bottom of the screen, and
several controls (such as those for preset views) are removed.

Pressing \textquotedbl{}V\textquotedbl{} zooms out to show the entire
file, if one is loaded.

When in lathe mode, the shape of the loaded tool (if any) is shown.

%
\begin{figure}[H]
\caption{Lathe Tool Shape\label{cap:Lathe-Tool-Shape}}


\centering{}\includegraphics[scale=0.8]{gui/axis-lathe-tool}
\end{figure}



\section{Advanced Configuration}

For more information on ini file settings that can change how AXIS
works see the INI File/Sections/{[}DISPLAY{]} Section of Configuration
chapter in the Integrators manual.


\subsection{Program Filters}

AXIS has the ability to send loaded files through a \textquotedbl{}filter
program\textquotedbl{}. This filter can do any desired task: Something
as simple as making sure the file ends with '\texttt{M2}', or something
as complicated as detecting whether the input is a depth image, and
generating g-code to mill the shape it defines.

The \texttt{{[}FILTER{]}} section of the ini file controls how filters
work. First, for each type of file, write a \texttt{PROGRAM\_EXTENSION}
line. Then, specify the program to execute for each type of file.
This program is given the name of the input file as its first argument,
and must write rs274ngc code to standard output. This output is what
will be displayed in the text area, previewed in the display area,
and executed by EMC when \textquotedbl{}Run\textquotedbl{}. The following
lines add support for the \textquotedbl{}image-to-gcode\textquotedbl{}
converter included with EMC2:
\begin{quote}
{[}FILTER{]}\\
PROGRAM\_EXTENSION = .png,.gif Greyscale Depth Image\\
png = image-to-gcode\\
gif = image-to-gcode
\end{quote}
It is also possible to specify an interpreter:
\begin{quote}
PROGRAM\_EXTENSION = .py Python Script\\
py = python
\end{quote}
In this way, any Python script can be opened, and its output is treated
as g-code. One such example script is available at \texttt{nc\_files/holecircle.py}.
This script creates g-code for drilling a series of holes along the
circumference of a circle.

%
\begin{figure}[H]
\caption{Circular Holes\label{cap:Circular-Holes}}


\centering{}\includegraphics[scale=0.8]{gui/holes}
\end{figure}


If the environment variable AXIS\_PROGRESS\_BAR is set, then lines
written to stderr of the form
\begin{quote}
FILTER\_PROGRESS=\%d
\end{quote}
will set the AXIS progress bar to the given percentage. This feature
should be used by any filter that runs for a long time.


\subsection{The X Resource Database}

The colors of most elements of the AXIS user interface can be customized
through the X Resource Database. The sample file \texttt{axis\_light\_background}
changes the colors of the backplot window to a \textquotedbl{}dark
lines on white background\textquotedbl{} scheme, and also serves as
a reference for the configurable items in the display area. The sample
file \texttt{axis\_big\_dro} changes the position readout to a larger
size font. To use these files:
\begin{quote}
xrdb -merge /usr/share/doc/emc2/axis\_light\_background

xrdb -merge /usr/share/doc/emc2/axis\_big\_dro
\end{quote}
For information about the other items which can be configured in Tk
applications, see the Tk man pages.

Because modern desktop environments automatically make some settings
in the X Resource Database that adversely affect AXIS, by default
these settings are ignored. To make the X Resource Database items
override AXIS defaults, include the following line in your X Resources:
\begin{quote}
{*}Axis{*}optionLevel: widgetDefault
\end{quote}
this causes the built-in options to be created at the option level
\textquotedbl{}widgetDefault\textquotedbl{}, so that X Resources (which
are level \textquotedbl{}userDefault\textquotedbl{}) can override
them.


\subsection{\label{sub:Physical-jog-wheels}Physical jog wheels}

To improve the interaction of AXIS with physical jog wheels, the axis
currently selected in the GUI is also reported on a pin with a name
like \texttt{axisui.jog.x}. Except for a short time when the active
axis has just been changed, exactly one of these pins is \texttt{TRUE}
at one time, and the rest are \texttt{FALSE}.

After AXIS has created these HAL pins, it executes the halfile named
in \texttt{{[}HAL{]}POSTGUI\_HALFILE}. Unlike \texttt{{[}HAL{]}HALFILE},
only one such file may be used.


\subsection{axisrc\index{.axisrc}}

If it exists, the contents of \texttt{\textasciitilde{}/.axisrc} are
executed as Python source code just before the AXIS gui is displayed.
The details of what may be written in the axisrc are subject to change
during the development cycle.

The following adds Control-Q as a keyboard shortcut for Quit and turns
on \textquotedbl{}Distance to go\textquotedbl{} by default.
\begin{quote}
root\_window.bind(\textquotedbl{}<Control-q>\textquotedbl{}, \textquotedbl{}destroy
.\textquotedbl{})\\
help2.append((\textquotedbl{}Control-Q\textquotedbl{}, \textquotedbl{}Quit\textquotedbl{}))\\
vars.show\_distance\_to\_go.set(1)
\end{quote}

\subsection{External Editor\index{External Editor}}

The menu options File > Edit... and File > Edit Tool Table... become
available after defining the editor in the ini section {[}DISPLAY{]}.
Useful values include EDITOR=gedit and EDITOR=gnome-terminal -e vim.
For more information, see the DISPLAY section of the INI Configuration
Chapter in the Integrators Manual.


\subsection{Virtual Control Panel\index{Virtual Control Panel}}

AXIS can display a custom virtual control panel in the right-hand
pane. You can program buttons, indicators, data displays and more.
For more information, see the Integrators Manual.


\subsection{Special Comments\index{Special Comments}}

Special comments can be inserted into the G Code file to control how
the preview of AXIS behaves. In the case where you want to limit the
drawing of the preview use these special comments. Anything between
the (AXIS,hide) and (AXIS,show) will not be drawn during the preview.
The (AXIS,hide) and (AXIS,show) must be used in pairs with the (AXIS,hide)
being first. Anything after a (AXIS,stop) will not be drawn during
the preview.

These comments are useful to unclutter the preview display (for instance
while debugging a larger g-code file, one can disable the preview
on certain parts that are already working OK).
\begin{itemize}
\item (AXIS,hide) Stops the preview (must be first)
\item (AXIS,show) Resumes the preview (must follow a hide)
\item (AXIS, stop) Stops the preview from here to the end of the file.
\end{itemize}

