gmoccapy is a GUI for linuxcnc, designed to be used with a touch screen,
but can also be used on normal screens with a mouse or hardware buttons and MPG wheels,
as it presents HAL Pins for the most common needs. Please find more information in the following.
It offers the possibility to display up to 4 axis, support a lathe mode for normal and back tool lathe
and can be adapted to nearly every need, because gmoccapy supports embedded tabs and side panels. As a good example for that see [gmoccapy_plasma]
It has an integrated onboard keyboard, so there is no need for a hardware keyboard or mouse, but it can also be used with that hardware.
gmoccapy offers a separate settings page to configure most settings of the GUI without editing files.
gmoccapy can be localized very easy, because the corresponding files are separated from the linuxcnc.po files, so there is no need to translate unneeded stuff.
The files are placed in /src/po/gmoccapy. Just copy the gmoccapy.pot file to something like fr.po and translate that file with gtranslator or poedit. After a make you got the GUI in your referenced language
At the Moment it is available in English, German, Spanish and Serbian. Feel free to help me to introduce more languages.
If you need help, don't hesitate to ask.
in German [Peters CNC Ecke]
in English [gmoccapy on linuxcnc]
The minimum screen resolution for gmoccapy, using it without side panels is 979 x 750 Pixel, so it should fit to every standard screen.
If you want to get actual sources for development reasons, you should get a copy of the master git repository.
If you are not familiar with git and linux, please read: [git]
or trust me and do the following in a terminal:
For UBUNTU 10.04 do:
sudo apt-get install git-core gitk git-gui git config --global user.name "Your full name" git config --global user.email "you@example.com" git clone git://git.linuxcnc.org/git/linuxcnc.git linuxcnc-dev sudo apt-get install libboost-python-dev libmodbus-dev libusb-1.0-0-dev cd linuxcnc-dev cd src ./autogen.sh ./configure make sudo make setuid cd .. . ./scripts/rip-environment linuxcnc
If you are using the actual DEBIAN Wheesy Linuxcnc iso, you will have to install some more packages
sudo apt-get install git-core gitk git-gui git config --global user.name "Your full name" git config --global user.email "you@example.com" git clone git://git.linuxcnc.org/git/linuxcnc.git linuxcnc-dev sudo apt-get install libboost-python1.49-dev libmodbus-dev libusb-1.0-0-dev libxmu-dev libglu1-mesa-dev libgl1-mesa-dev libreadline-dev tcl8.5-dev tk8.5-dev cd linuxcnc-dev cd src ./autogen.sh ./configure make sudo make setuid cd .. . ./scripts/rip-environment linuxcnc
You will get the following screen if your locale settings is de (German):
cd linuxcnc-dev cd src git pull make cd .. . ./scripts/rip-environment linuxcnc
if there are mayor changes it can also be necessary to do the complete compiling like so:
cd linuxcnc-dev cd src make clean ./autogen.sh ./configure make sudo make setuid cd .. . ./scripts/rip-environment linuxcnc
You will find the following INI files included, just to show the basics:
gmoccapy.ini gmoccapy_4_axis.ini gmoccapy_jog_wheels.ini gmoccapy_lathe.ini gmoccapy_lathe_imperial.ini gmoccapy_left_panel.ini gmoccapy_right_panel.ini gmoccapy_sim_hardware_button.ini gmoccapy_tool_sensor.ini gmoccapy_with_user_tabs.ini gmoccapy_messages.ini gmoccapy_pendant.ini
The names should explain the main intention of the different INI Files.
If you use an existing configuration of your machine, just edit your INI according to this WIKI.
I you want to use [MACROS], don't forget to set the path to your macros or subroutines folder as described below.
So let us take a closer look to the the INI file and what you need to include to use gmoccapy on your machine:
[DISPLAY] DISPLAY = gmoccapy PREFERENCE_FILE_PATH = gmoccapy_preferences DEFAULT_LINEAR_VELOCITY = 166.666 MAX_LINEAR_VELOCITY = 166.666 MAX_FEED_OVERRIDE = 1.5 MAX_SPINDLE_OVERRIDE = 1.2 MIN_SPINDLE_OVERRIDE = 0.5 LATHE = 1 BACK_TOOL_LATHE = 1 PROGRAM_PREFIX = ../../nc_files/
The most important part is to tell linuxcnc to use gmoccapy, editing the [DISPLAY] section.
[DISPLAY] DISPLAY = gmoccapy
PREFERENCE_FILE_PATH = gmoccapy_preferences
The line PREFERENCE_FILE_PATH gives the location and name of the preferences file to be used.
This file is used by gmoccapy to store your settings of the GUI, like themes,
DRO units, colors, and keyboard settings, etc., see [SETTINGS] for more details.
If no path or file is given, gmoccapy will use as default <your_machinename>.pref, if no machine name is given in your INI File it will use gmoccapy.pref The file will be stored in your config dir, so the settings will not be mixed if you use several configs. If you only want to use one file for several machines, you need to include PREFERENCE_FILE_PATH in your INI.
DEFAULT_LINEAR_VELOCITY = 166.666
Sets the default linear velocity in machine units per second.
If no value is given, a value of 15 will be applied.
If you don't set max linear velocity, the default linear velocity will be reduced to the default value max linear velocity (60)
If you don't set max velocity in TRAJ, it may be reduced as well
see [TRAY section]
MAX_LINEAR_VELOCITY = 166.666
Sets the value of the max velocity for jogging in machine units per second.
If no value is given, a value of 60 will be applied.
MAX_FEED_OVERRIDE = 1.5
Sets the maximum feed override, in the example given, you will be allowed to override the feed by 150%
MAX_SPINDLE_OVERRIDE = 1.2 MIN_SPINDLE_OVERRIDE = 0.5
will allow you to change the spindle override within a limit from 50% to 120%
LATHE = 1 BACK_TOOL_LATHE = 1
the first line set the screen layout to control a lathe.
The second line is optional and will switch the X axis in a way you need for a back tool lathe.
Also the keyboard shortcuts will react in a different way.
See also [LATHE specific section]
PROGRAM_PREFIX = ../../nc_files/
Is the entry to tell linuxcnc/gmoccapy where to look for the ngc files, if not omitted we will look in the following range:
~/linuxcnc/nc_files ~/
EMBED_TAB_NAME = DRO EMBED_TAB_LOCATION = ntb_user_tabs EMBED_TAB_COMMAND = gladevcp -x {XID} dro.glade
EMBED_TAB_NAME = Second user tab EMBED_TAB_LOCATION = ntb_preview EMBED_TAB_COMMAND = gladevcp -x {XID} vcp_box.glade
all you have to take care off, is that you include for every tab or side panel the mentioned three lines,
EMBED_TAB_NAME
represents the name of the tab or side panel,
it is up to you what name you use, but it must be present!
EMBED_TAB_LOCATION
is the place where your program will be placed in the GUI.
valid values are:
* ntb_user_tabs (as main tab, covering the complete screen) * ntb_preview (as tab on the preview side) * box_left (on the left, complete high of the screen) * box_right (on the right, in between the normal screen and the button list) * box_coolant_and_spindle (will hide the coolant and spindle frames and introduce your glade file here) * box_cooling (will hide the cooling frame and introduce your glade file) * box_spindle (will hide the spindle frame and introduce your glade file) * box_vel_info (will hide the velocity frames and introduce your glade file) * box_custom_1 (will introduce your glade file left of vel_frame) * box_custom_2 (will introduce your glade file left of cooling_frame) * box_custom_3 (will introduce your glade file left of spindle_frame) * box_custom_4 (will introduce your glade file right of spindle_frame)
see the different INI files included to see the differences
EMBED_TAB_COMMAND
is the command to execute, i.e.
gladevcp -x {XID} dro.gladeincludes a custom glade file called dro.glade in the mentioned location
gladevcp h_buttonlist.gladewill just open a new user window called h_buttonlist.glade note the difference, this one is stand alone, and can be moved around independent from gmoccapy window
camview-emc -w {XID}will add a live image from a web cam to the location you specified.
here are some examples:
ntb_user_tabs - with integrated camview program
ntb_preview - as maximized version
ntb_preview
box_left - showing gmoccapy in edit mode
box_right - and gmoccapy in MDI mode
Now there is the ability to create user messages in the [DISPALY] section of the INI file similar to gscreen
Here is how to set up 3 user popup message dialogs the messages support pango markup language. Detailed information about the markup language can be found at https://developer.gnome.org/pango/stable/PangoMarkupFormat.html
MESSAGE_TEXT = The text to be displayed, may be pango markup formated MESSAGE_TYPE = "status" , "okdialog" , "yesnodialog"
status : Will just display a message as popup window, using the messsaging system of gmoccapy
okdialog : Will hold focus on the message dialog and will activate a "-waiting" Hal_Pin OUT. Closing the message will reset the waiting pin
yesnodialog : Will hold focus on the message dialog and will activate a "-waiting" Hal_Pin bit OUT it will also give access to an "-responce" Hal_Pin Bit Out, this pin will hold 1 if the user klicks OK, and in all other states it will be 0 Closing the message will reset the waiting pin The responce Hal Pin will remain 1 until the dialog is called again
MESSAGE_PINNAME = is the name of the hal pin group to be created
Example
MESSAGE_TEXT = This is a <span background="#ff0000" foreground="#ffffff">info-message</span> test MESSAGE_TYPE = status MESSAGE_PINNAME = statustest
MESSAGE_TEXT = This is a yes no dialog test MESSAGE_TYPE = yesnodialog MESSAGE_PINNAME = yesnodialog
MESSAGE_TEXT = Text can be <small>small</small>, <big>big</big>, bold, italic, and even be <span color="red">colored</span>. MESSAGE_TYPE = okdialog MESSAGE_PINNAME = okdialog
The specific hal pin conventions for these can be found under the [hal pin section]
[RS274NGC] SUBROUTINE_PATH = macros
sets the path to search for macros and other subroutines.
[MACROS] MACRO = i_am_lost MACRO = halo_world MACRO = jog_around MACRO = increment xinc yinc MACRO = go_to_position X-pos Y-pos Z-pos
This will add 5 macros to the MDI button list.
Please note, that maximal 9 macros will appear in the GUI, due to place reasons. But it is no error placing more in your INI file.
Image showing gmoccapy with 4 axis layout in MDI mode and hidden keyboard
The name of the file must be exactly the same as the name given in the MACRO line.
So the macro i_am_lost will call the file i_am_lost.ngc.
The macro files must follow some rules:
Gmoccapy will also accept macros asking for parameters like:
go_to_position X-pos Y-pos Z-pos
the parameters must be separated by spaces.
this calls a file go_to_position.ngc with the following content:
; Testfile go to position ; will jog the machine to a given position
O<go_to_position> sub
G17 G21 G54 G61 G40 G49 G80 G90
;#1 = <X-Pos> ;#2 = <Y-Pos> ;#3 = <Z-Pos>
(DBG, Will now move machine to X = #1 , Y = #2 , Z = #3) G0 X #1 Y #2 Z #3
O<go_to_position> endsub M2
MAX_VELOCITY = 230.000
Sets the maximal velocity of the machine, this value will also take influence to default velocity.
The screen has two main button lists, one on the right side an one on the bottom.
The right handed buttons will not change during operation, but the bottom list will change very often.
The buttons are count from up to down and from left to right beginning with "0".
In hal_show you will see the right buttons are:
and the bottom buttons are:
as the buttons in the bottom list will change according the mode and other influences,
the hardware buttons will activate different functions, and you don't have to take care about switching functions around in hal, because that is done completely by gmoccapy!
The sens of this is to be able to use the screen without an touch panel, or protect it from excessive use by placing hardware buttons around the panel.
All sliders from gmoccapy can be connected to hardware encoders or potmeters.
To connect hardware encoderas the following hal pins are exported:
If you prefer potmeters to control the sliders you will need to connect to the following pin
all four taking a float input as percentage, meaning a value from 0.0 to 1.0, setting the corresponding sliders directly to the given value.
i.e. spindle override slider has min of 30 % and max 150 % and you set gmoccapy.spindle-override-value to 0.25 the slider will jump to 60 % , as the result of min + (max-min) * pin.value
if gmoccapy.analog.enable = True, the counts are handled as well, so please be careful if you connect to both pin types
It is strongly recommended not to mix both types for the same slider!
if you use a 4 axis INI file, there will be two additional pins
for a "C" axis you will see:
jog-inc-0 is unchangeable and represents continuous jogging
The settings page is unlocked if the pin is high.
To use this pin, you need to activate it on the settings page.
* gmoccapy.error * gmoccapy.delete-message
gmoccapy.error is an bit out pin, to indicate an error to the hardware, so a light can lit or even the machine can be stoped. It will be reseted with the pin gmoccapy.delete-message. gmoccapy.delete-message will delete the first error and reset the gmoccapy.error pin to False after the last error has been cleared.
Messages or user infos will not affect the gmoccapy.error pin, but the gmoccapy.delete-message pin will delete the last message if no error is shown!
Status
Yesnodialog
Okdialog
* gmoccapy.spindle_feedback_bar * gmoccapy.spindle_at_speed_led
gmoccapy.spindle_feedback_bar will accept an float input to show the spindle speed
gmoccapy.spindle_at_speed_led is an bit to lit the GUI led if spindle is at speed
* gmoccapy.program.length * gmoccapy.program.current-line * gmoccapy.program.progress
gmoccapy.program.length is an out pin (S32) showing the total number of lines of the program
gmoccapy.program.current-line is an out pin (S32) indicating the current working line of the program
gmoccapy.program.progress is an out pin (Float) giving the program progress in percentage
The values may not be very accurate, if you are working with subroutines or large remap procedures, also loops will cause different values.
* gmoccapy.toolchange-number * gmoccapy.toolchange-change * gmoccapy.toolchange-changed
usually they are connected like this for a manual tool change:
net tool-change gmoccapy.toolchange-change <= iocontrol.0.tool-change net tool-changed gmoccapy.toolchange-changed <= iocontrol.0.tool-changed net tool-prep-number gmoccapy.toolchange-number <= iocontrol.0.tool-prep-number net tool-prep-loop iocontrol.0.tool-prepare <= iocontrol.0.tool-prepared
* gmoccapy.tooloffset-x * gmoccapy.tooloffset-z
just connect them like so in your postgui hal.
net tooloffset-x gmoccapy.tooloffset-x <= motion.tooloffset.x net tooloffset-z gmoccapy.tooloffset-z <= motion.tooloffset.z
Please note, that gmoccapy takes care of its own to update the offsets,
sending an G43 after any tool change, but not in auto mode!
So writing a program makes you responsible to include an G43 after each tool change!
Gmoccapy offers an integrated auto tool measurement.
To use this feature, you will need to do some additional settings and you may want to use the offered hal pin to get values in your own ngc remap procedure.
Before starting the first test, do not forget to enter the Probe height and probe velocities on the settings page!
(see [Settings Page Tool Measurement])
It might be also a good idea to take a look at the tool measurement video:(see [Tool Measurement video])
Tool Measurement in gmoccapy is done a little bit different to many other GUI. You should follow the following steps:
* touch of you workpiece in X and Y * measure the hight of your block from the base where your tool switch is located, to the upper face of the block (including chuck etc.) * Push the button block height and enter the measured value * Go to auto mode and start your program
here is a small sketch:
With the first given tool change the tool will be measured and the offset will be set automatically to fit the block height. The advantage of the gmoccapy way is, that you do not need a reference tool.
Please note:
Your program must contain a tool change at the beginning!
The tool will be measured, even it has been used before, so there is no danger, if the block height has changed.
There will be a video showing the way to do that on you tube
* gmoccapy.toolmeasurement = bit, enable or not tool measurement * gmoccapy.blockheight = float, the measured value of the top face of the workpiece * gmoccapy.probeheight = float, the probe switch height * gmoccapy.searchvel = float, the velocity to search for the tool probe switch * gmoccapy.probevel = float, the velocity to probe tool length
[RS274NGC] # Enables the reading of INI and HAL values from gcode FEATURES=12
# is the sub, with is called when a error during tool change happens ON_ABORT_COMMAND=O <on_abort> call
# The remap code REMAP=M6 modalgroup=6 prolog=change_prolog ngc=change epilog=change_epilog
[TOOLSENSOR] X = 10 Y = 10 Z = -20 MAXPROBE = -20
[CHANGE_POSITION] X = 10 Y = 10 Z = -2
[PYTHON] # The path to start a search for user modules PATH_PREPEND = python # The start point for all. TOPLEVEL = python/toplevel.py
First make a directory "python" in your config folder
from <your_linuxcnc-dev_directory>/configs/sim/gmoccapy/python
Copy toplevel.py to your config_dir/python folder
Copy remap.py to your config_dir/python folder
Copy stdglue.py to your config_dir/python folder
from <your_linuxcnc-dev_directory>/configs/sim/gmoccapy/macros
copy on_abort.ngc to the directory specified as SUBROUTINE_PATH (see [RS274NGC Section])
from <your_linuxcnc-dev_directory>/configs/sim/gmoccapy/macros
copy change.ngc to the directory specified as SUBROUTINE_PATH (see [RS274NGC Section])
open change.ngc with a editor and uncomment the following lines (49 and 50):
F #<_hal[gmoccapy.probevel]> G38.2 Z-4You may want to modify this file to fit more your needs, feel free, but do not ask for support ;-)
net probe motion.probe-input <= <your_input_pin>The line might look like this:
net probe motion.probe-input <= parport.0.pin-15-in
In your postgui.hal file add:
# The next two lines are only needed if the pins had been connected before unlinkp iocontrol.0.tool-change unlinkp iocontrol.0.tool-changed
# link to gmoccapy toolchange, so you get the advantage of tool description on change dialog net tool-change gmoccapy.toolchange-change <= iocontrol.0.tool-change net tool-changed gmoccapy.toolchange-changed <= iocontrol.0.tool-changed net tool-prep-number gmoccapy.toolchange-number <= iocontrol.0.tool-prep-number net tool-prep-loop iocontrol.0.tool-prepare <= iocontrol.0.tool-prepared
and give an unlock code, witch is "123" as default. If you want to change it at this time you will
have to edit the hidden preference file. (see [the preference file path])
The page looks at the moment like so:
The page is separated in three main tabs:
on this tab you will find the following options:
If you select start as window the spinboxes to set the position and size will get active. One time set, the GUI will start every time on the place and with the size selected. Nevertheless the user can change the size and position using the mouse, but that will not have any influence on the settings.
You will find in this frame also a checkbox allowing you to hide the cursor, what is very useful if you use a touch screen.
The check-boxes allows the user to select if he want the on board keyboard to be shown immediately, when
entering the MDI Mode, when entering the offset page, the tooledit widget or when open a program in the EDIT mode.
The keyboard button on the bottom button list will not been affected by this settings, so you be able to show or hide the keyboard by pressing the button. The default behavior will be set by the check-boxes.
Default are :
If the keyboard layout is not correct, i.e. clicking X gives Z, than the layout has not been set properly, related to your locale settings.
It can be solved with a small batch file with the following content:
#!/bin/bash setxkbmap -model pc105 -layout de -variant basic
the letters "de" are for German, you will have to set them according to your locale settings
Just execute this file before starting linuxcnc, it can be done also adding a starter to your local folder
./config/autostartso that the layout is set automatically on starting.
* show preview * show offsets
As the notebook tabs are shown, you are able to switch between both views in any case.
* Relative mode = black * Absolute mode = blue * Distance to go = yellowand the foreground color of the DRO can be selected with:
* homed color = green * unhomed color = redso users suffering from protanopia (red/green weakness) are able to select proper colors
If you activate:
show dro in preview, the DRO will be shown also in the preview window
and the checkboxes to select if the offsets and / or the DTG should be displayed also in the preview window will get sensitive.
The checkbox show the DRO Button will allow you to display additional buttons on the left side of the DRO.
It will display:
one button to switch from relative to absolute coordinates,
one button to toggle between distance to go and the other states
and one button to toggle the units from metric to imperial and vice versa.
It is not recommended to use this option, because the user will loose the auto unit option, which will toggle the units according to the active gcode G20 / G21
You can change through the DRO modes (absolute, relative, distance to go) by clicking on the DRO!
The checkbox Use Auto Units allows to disable the auto units option of the display, so you can run a programm in inches and watch the DRO in mm.
The adjustment size allows you to set the size of the DRO font, default is 28, if you use a bigger screen you may want to increase the size up to 56.
If you do use 4 axis, the DRO font size will be 3/4 of the value you select here, because of space reason.
Grid SizeSets the grid size of the preview window. Unfortunately the size has to be set in inches, even if your machine units are metric. We do hope to fix that in a future release. The grid will not be shown in perspective view.
Show DROWill show the a DRO also in the preview window, it will be shown automatically in fullsize preview
Show DTGWill show also the DTG (direct distance to end point) in the preview, only if Show DRO is active and not fullsize preview.
Show OffsetsWill show the offsets in the preview window, if you only check this option and leave the others unchecked, you will get in fullsize preview a offset page
Mouse Button ModeWith this combobox you can select the button behavior of the mouse to rotate, move or zoom within the preview. add property 'mouse_btn_mode'
Default is left move, middle zoom, right rotate
The mouse wheel will still zoom the preview in every mode.
If you select an element in the preview, the selected element will be taken as rotation center point.
The file selection screen will use the filters you have set in the INI File,
if there aren't any filters given, you will only see ngc files.
The path will be set according to the INI settings in [DISPLAY] PROGRAM_PREFIX
By default all scales are set using the calculation:
(MAX - MIN)/100
Default is to use keyboard shortcuts.
Please take care if you use a lathe, than the shortcuts will be different. See [the Lathe section]
you have three options to unlock the settings page:
Default is use unlock code (123)
MAX = 6000
You can allow or disallow the run from line. This will set the corresponding button insensitive (grayed out),
so the user will not be able to use this option.
I do not recommend to use run from line, as linuxcnc will note take care of any previous lines in the code before the starting line.
So errors or crashes are very probably.
Default is disable run from line
As you see the R DRO has a black background and the D DRO is gray. This will change according to the active G-Code G7 or G8. The active mode is visible by the black background, meaning in the shown images G8 is active.
The next difference to the standard screen is the location of the Jog Button.
X and Z have changed places and Y is gone.
You will note that the X+ and X- buttons changes there places according to normal or back tool lathe.
Also the keyboard behavior will change:
Normal Lathe:
Back Tool Lathe:
The tool information frame will show not only the Z offset, but also the X offset and the tool table is showing all lathe relevant information.
There is a very good WIKI, which is actually growing, maintained by Marius