diff --git a/linuxcnc/Turner.2ms/#lathe_macros.ini# b/linuxcnc/Turner.2ms/#lathe_macros.ini#
new file mode 100644
index 0000000..ca358f6
--- /dev/null
+++ b/linuxcnc/Turner.2ms/#lathe_macros.ini#
@@ -0,0 +1,165 @@
+# EMC controller parameters for a simulated machine.
+# General note: Comments can either be preceded with a # or ; - either is
+# acceptable, although # is in keeping with most linux config files.
+
+# General section -------------------------------------------------------------
+[EMC]
+VERSION = 1.1
+MACHINE = gmoccapy_lathe
+#DEBUG = 0x7FFFFFFF
+DEBUG = 0
+
+# for details see nc_files/subroutines/maco_instructions.txt
+[DISPLAY]
+DISPLAY = gmoccapy
+LATHE = 1
+BACK_TOOL_LATHE = 0
+
+# Cycle time, in milliseconds, that display will sleep between polls
+CYCLE_TIME = 100
+
+# Highest value that will be allowed for feed override, 1.0 = 100%
+MAX_FEED_OVERRIDE = 1.5
+MAX_SPINDLE_OVERRIDE = 1.2
+MIN_SPINDLE_OVERRIDE = .5
+
+
+# Prefix to be used
+PROGRAM_PREFIX = /home/debian/linuxcnc/nc_files
+
+# Introductory graphic
+INTRO_GRAPHIC = linuxcnc.gif
+INTRO_TIME = 5
+
+# list of selectable jog increments
+INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm
+
+EMBED_TAB_NAME = Cycles
+EMBED_TAB_LOCATION = ntb_preview
+#EMBED_TAB_LOCATION = ntb_user_tabs
+EMBED_TAB_COMMAND = halcmd loadusr -Wn gladevcp gladevcp -c gladevcp -U notouch=1 -U norun=0 -u lathehandler.py -x {XID} lathemacro.ui
+
+[FILTER]
+PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
+PROGRAM_EXTENSION = .py Python Script
+png = image-to-gcode
+gif = image-to-gcode
+jpg = image-to-gcode
+py = python
+
+# Task controller section -----------------------------------------------------
+[RS274NGC]
+RS274NGC_STARTUP_CODE = G18 G21 G40 G49 G54 G80 G90 G94 G8 M9 M5 G64 P0.005
+PARAMETER_FILE = sim.var
+SUBROUTINE_PATH = macros:./
+
+# Motion control section ------------------------------------------------------
+[EMCMOT]
+EMCMOT = motmod
+COMM_TIMEOUT = 1.0
+BASE_PERIOD = 100000
+SERVO_PERIOD = 1000000
+
+# Hardware Abstraction Layer section --------------------------------------------------
+[TASK]
+TASK = milltask
+CYCLE_TIME = 0.001
+
+# Part program interpreter section --------------------------------------------
+[HAL]
+HALFILE = core_sim_lathe.hal
+HALFILE = spindle_sim.hal
+HALFILE = simulated_home_lathe.hal
+
+# Single file that is executed after the GUI has started.
+#POSTGUI_HALFILE = gmoccapy_postgui.hal
+
+HALUI = halui
+
+# Trajectory planner section --------------------------------------------------
+[HALUI]
+#No Content
+
+[TRAJ]
+COORDINATES = X Z
+LINEAR_UNITS = mm
+ANGULAR_UNITS = degree
+DEFAULT_LINEAR_VELOCITY = 50
+MAX_LINEAR_VELOCITY = 234
+POSITION_FILE = position.txt
+#NO_FORCE_HOMING = 1
+
+# First axis
+[EMCIO]
+EMCIO = io
+CYCLE_TIME = 0.100
+
+# tool table file
+TOOL_TABLE = lathe.tbl
+
+[KINS]
+KINEMATICS = trivkins coordinates=XZ
+JOINTS = 2
+
+[AXIS_X]
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_0]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 0.0
+HOME = 10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+HOME_IS_SHARED = 1
+
+# Third axis
+[AXIS_Z]
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_1]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 1.0
+HOME = -10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 0
+HOME_IS_SHARED = 1
+
+# section for main IO controller parameters -----------------------------------
+[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
+
+
diff --git a/linuxcnc/Turner.2ms/LatheMacro.svg b/linuxcnc/Turner.2ms/LatheMacro.svg
new file mode 100644
index 0000000..dc974c4
--- /dev/null
+++ b/linuxcnc/Turner.2ms/LatheMacro.svg
@@ -0,0 +1,3057 @@
+
+
diff --git a/linuxcnc/Turner.2ms/README b/linuxcnc/Turner.2ms/README
new file mode 100644
index 0000000..da5d6cf
--- /dev/null
+++ b/linuxcnc/Turner.2ms/README
@@ -0,0 +1,72 @@
+This folder contains a number of simulated lathe configs.
+
+the "lathemacro" config offers a number of simple macros to perform
+the most common lathe operations.
+
+The GUI that controls the macros can be viewed by clicking the "Cycles"
+tab top left of the graphical preview window.
+
+There are two load-time options to control the tab behaviour:
+1) norun will hide the action button, use this if you want to use only
+a physical button (connected to gladevcp.cycle-start) to start the macros
+(Strongly recommended, especially with Touchy)
+2) notouch will allow keyboard editing of the spinboxes. Otherwise the
+custom numeric keyboard will be shown.
+
+An example loadrt line, as used here in the Gmoccapy demo is:
+
+[DISPLAY]
+EMBED_TAB_COMMAND = halcmd loadusr -Wn gladevcp gladevcp -c gladevcp -U notouch=1 -U norun=0 -u lathehandler.py -x {XID} lathemacro.ui
+
+The window will resize slowly if you grab the corner and move the mouse
+inside the window. It's not as bad as it was, but still needs work.
+You may need to click the unmaximise button in the toolbar to get a
+window border to be able to use the resize handles.
+
+Notes on the keyboard:
+As well as the obvious functions and unit conversions, it can be used to
+enter fractions. For example if you type 1.1/2 it will automatically
+update to display 1.5000 and 16.17/64 will show 16.2656.
+This can be used in a limited way to halve the onscreen value eg for
+entering radius instead of diameter.
+However it only works for whole numbers: 100/2 will become 50 but
+3.14149/2 is interpreted as 3 and 14 thousand halves so won't work.
+
+Notes on adding your own cycles:
+Create a new G-code subroutine in the same format as the existing ones.
+In Glade add a new tab to the 'tabs1' notebook and give it a name matching
+the new cycle.
+Edit the action button (inside an eventbox) to call the new G-code sub.
+Rename the action button to match the tab name and append '.action' eg
+MyCycle.action
+
+Create new artwork. I used Fusion360, the models are here:
+https://a360.co/3uFPZNv
+and the drawings are here:
+https://a360.co/3uFPZNv
+Esport the drawing page as PDF and import into the lathemacro.svg file in
+Inkscape. You will need to resize. Add your own arrows and annotations.
+
+Save the new layer in a layer named "layerN" (lower case) where N is the
+tab number, starting at zero. You will need to invoke the XML editor for
+this (Shift-Cmd-X on Mac)
+
+The entry boxes are positioned relative to a 1500 x 1000 image; the
+original size of the SVG. So you can hover your mouse over the image in
+Inkscape to determine the coordinates.
+In the in the case of on-drawing controls the coordinates are entered as
+an XML comment in the Tooltip for the control in x,y format (The surface speed,
+tool and coolant do not need this, they are in a fixed table)
+
+An example:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/linuxcnc/Turner.2ms/ethercat-conf.xml~ b/linuxcnc/Turner.2ms/ethercat-conf.xml~
new file mode 100644
index 0000000..eb752b4
--- /dev/null
+++ b/linuxcnc/Turner.2ms/ethercat-conf.xml~
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/linuxcnc/Turner.2ms/facing.ngc b/linuxcnc/Turner.2ms/facing.ngc
new file mode 100644
index 0000000..341bc61
--- /dev/null
+++ b/linuxcnc/Turner.2ms/facing.ngc
@@ -0,0 +1,45 @@
+;Facing
+O sub
+
+G7 ; Lathe Diameter Mode
+G18 ; XZ Plane
+G21 ; Metric Units
+G90 ; Absolute Distance
+
+M6 T#7 G43
+
+O90 IF [#8 GT 0.5]
+ M8
+O90 ENDIF
+
+O10 IF [#6 NE 0]
+ (MSG, Angled facing isn't supported yet)
+O10 ENDIF
+
+#14 = [#<_x> * 2] (starting X)
+#13 = #<_z> (starting Z)
+
+G96 D2500 S#2 ; Constant Surface Speed Mode
+M3
+g95 F#4 ; Feed-Per-Rev Mode
+
+g4p1 ; Wait to reach speed
+
+ O200 WHILE [#13 GT #5 + #3]
+
+ #13=[#13-#3]
+ G1 Z#13
+ G1 X#1
+ G0 Z[#13+#3]
+ G0 X#14
+ G0 Z#13
+ O200 ENDWHILE
+
+ G1 Z#5
+ G1 X#1
+ G0 Z[#13+#3]
+ G0 X[#14+#3]
+ G0 Z#5 ; For touch-off
+ M5 M9
+O endsub
+M2
diff --git a/linuxcnc/Turner.2ms/gmoccapy_lathe.pref b/linuxcnc/Turner.2ms/gmoccapy_lathe.pref
new file mode 100644
index 0000000..b008a3f
--- /dev/null
+++ b/linuxcnc/Turner.2ms/gmoccapy_lathe.pref
@@ -0,0 +1,83 @@
+[DEFAULT]
+dro_size = 28
+abs_color = #0000FF
+rel_color = #000000
+dtg_color = #FFFF00
+homed_color = #00FF00
+unhomed_color = #FF0000
+spindle_bar_min = 0.0
+spindle_bar_max = 6000.0
+unlock_code = 123
+view = y
+blockheight = 0.0
+spindle_start_rpm = 300.0
+scale_jog_vel = 140.4
+scale_spindle_override = 1
+scale_feed_override = 1
+scale_rapid_override = 1
+hide_turtle_jog_button = False
+turtle_jog_factor = 20
+open_file =
+screen1 = window
+x_pos = 40
+y_pos = 30
+width = 979
+height = 750
+gtk_theme = Follow System Theme
+audio_alert = /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
+audio_error = /usr/share/sounds/freedesktop/stereo/dialog-error.oga
+grid_size = 1.0
+mouse_btn_mode = 4
+hide_cursor = False
+system_name_tool = Tool
+system_name_g5x = G5x
+system_name_rot = Rot
+system_name_g92 = G92
+system_name_g54 = G54
+system_name_g55 = G55
+system_name_g56 = G56
+system_name_g57 = G57
+system_name_g58 = G58
+system_name_g59 = G59
+system_name_g59.1 = G59.1
+system_name_g59.2 = G59.2
+system_name_g59.3 = G59.3
+jump_to_dir = /home/emcmesa
+show_keyboard_on_offset = False
+show_keyboard_on_tooledit = False
+show_keyboard_on_edit = False
+show_keyboard_on_mdi = False
+show_keyboard_on_file_selection = False
+x_pos_popup = 45.0
+y_pos_popup = 55
+width_popup = 250.0
+max_messages = 10
+message_font = sans 10
+use_frames = True
+reload_tool = True
+blockdel = False
+opstop = False
+enable_dro = False
+show_offsets = False
+show_dtg = False
+view_tool_path = True
+view_dimension = True
+run_from_line = no_run
+unlock_way = no
+show_preview_on_offset = False
+use_keyboard_shortcuts = True
+dro_digits = 3
+toggle_readout = True
+tool_in_spindle = 3
+diameter offset_axis_x = 0
+offset_axis_x = 0.0
+offset_axis_z = 0.0
+offset_axis_r = 50.0
+radius offset_axis_x = 0
+use_toolmeasurement = False
+kbd_height = 250
+icon_theme = None
+hide_tooltips = False
+hide_titlebar = False
+audio_enabled = True
+
diff --git a/linuxcnc/Turner.2ms/gmoccapy_lathe_c.pref b/linuxcnc/Turner.2ms/gmoccapy_lathe_c.pref
new file mode 100644
index 0000000..483f557
--- /dev/null
+++ b/linuxcnc/Turner.2ms/gmoccapy_lathe_c.pref
@@ -0,0 +1,72 @@
+[DEFAULT]
+dro_size = 28
+abs_color = #0000FF
+rel_color = #000000
+dtg_color = #FFFF00
+homed_color = #00FF00
+unhomed_color = #FF0000
+spindle_bar_min = 0.0
+spindle_bar_max = 6000.0
+unlock_code = 123
+view = y
+blockheight = 0.0
+spindle_start_rpm = 300.0
+scale_jog_vel = 140.4
+scale_spindle_override = 1
+scale_feed_override = 1
+scale_rapid_override = 1
+hide_turtle_jog_button = False
+turtle_jog_factor = 20
+open_file =
+screen1 = window
+x_pos = 40
+y_pos = 30
+width = 979
+height = 750
+gtk_theme = Follow System Theme
+audio_alert = /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
+audio_error = /usr/share/sounds/freedesktop/stereo/dialog-error.oga
+grid_size = 1.0
+mouse_btn_mode = 4
+hide_cursor = False
+system_name_tool = Tool
+system_name_g5x = G5x
+system_name_rot = Rot
+system_name_g92 = G92
+system_name_g54 = G54
+system_name_g55 = G55
+system_name_g56 = G56
+system_name_g57 = G57
+system_name_g58 = G58
+system_name_g59 = G59
+system_name_g59.1 = G59.1
+system_name_g59.2 = G59.2
+system_name_g59.3 = G59.3
+jump_to_dir = /home/emcmesa
+show_keyboard_on_offset = False
+show_keyboard_on_tooledit = False
+show_keyboard_on_edit = True
+show_keyboard_on_mdi = True
+show_keyboard_on_file_selection = False
+x_pos_popup = 45.0
+y_pos_popup = 55
+width_popup = 250.0
+max_messages = 10
+message_font = sans 10
+use_frames = True
+reload_tool = True
+blockdel = False
+opstop = False
+enable_dro = False
+show_offsets = False
+show_dtg = False
+view_tool_path = True
+view_dimension = True
+run_from_line = no_run
+unlock_way = use
+show_preview_on_offset = False
+use_keyboard_shortcuts = False
+dro_digits = 3
+toggle_readout = True
+tool_in_spindle = 0
+
diff --git a/linuxcnc/Turner.2ms/gmoccapy_postgui.hal b/linuxcnc/Turner.2ms/gmoccapy_postgui.hal
new file mode 100644
index 0000000..aa8a9d7
--- /dev/null
+++ b/linuxcnc/Turner.2ms/gmoccapy_postgui.hal
@@ -0,0 +1,23 @@
+###################################################################
+# moccapy_postgui.hal file from Norbert Schechner #
+###################################################################
+
+loadrt abs names=abs_spindle_feedback
+addf abs_spindle_feedback servo-thread
+
+net spindle-speed-limited => abs_spindle_feedback.in
+net spindle-abs abs_spindle_feedback.out => gmoccapy.spindle_feedback_bar
+net spindle-at-speed gmoccapy.spindle_at_speed_led
+
+# the unlink pin commands are only used, because they are connected
+# in core_sim.hal and we use this file to simulate
+unlinkp iocontrol.0.tool-change
+unlinkp iocontrol.0.tool-changed
+unlinkp iocontrol.0.tool-prep-number
+
+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 tooloffset-x gmoccapy.tooloffset-x <= motion.tooloffset.x
+net tooloffset-z gmoccapy.tooloffset-z <= motion.tooloffset.z
\ No newline at end of file
diff --git a/linuxcnc/Turner.2ms/grooving.ngc b/linuxcnc/Turner.2ms/grooving.ngc
new file mode 100644
index 0000000..475da84
--- /dev/null
+++ b/linuxcnc/Turner.2ms/grooving.ngc
@@ -0,0 +1,32 @@
+;grooving
+
+O sub
+
+G8 ; Radius mode (easier maths)
+G18 ; XZ Plane
+G21 ; Metric Units
+G90 ; Absolute Distance
+G91.1 ; but not for arcs
+
+M6 T#4 G43
+
+#1 = [#1 / 2] ; because of radius mode
+
+#14 = [#<_x>] (starting X)
+
+G96 D1500 S#2 ; Constant Surface Speed Mode
+m3 ;Start Spindle
+g95 F#3 ; Feed-Per-Rev Mode
+
+O90 IF [#5 GT 0.5]
+ M8
+O90 ENDIF
+
+g4p1 ; Wait to reach speed
+G1 F#3 X#1
+G0 X#14
+M5 M9
+G7
+O endsub
+
+M2
diff --git a/linuxcnc/Turner.2ms/halshow.preferences b/linuxcnc/Turner.2ms/halshow.preferences
new file mode 100644
index 0000000..fcba0e7
--- /dev/null
+++ b/linuxcnc/Turner.2ms/halshow.preferences
@@ -0,0 +1,22 @@
+# Halshow settings
+# This file is generated automatically.
+wm geometry . 700x475+1121+46
+placeFrames 0.3
+set ::ratio 0.3
+set ::old_w_leftf 160
+set ::watchlist {
+ pin+lcec.0.0.DiffT
+ pin+lcec.0.0.D1
+ pin+lcec.0.0.D2
+ pin+lcec.0.0.D3
+ pin+lcec.0.0.D4
+ pin+lcec.0.0.commanded-position-2
+ pin+lcec.0.0.actual-position-2
+}
+set ::workmode watchhal
+set ::watchInterval 100
+set ::col1_width 100
+set ::ffmts
+set ::ifmts
+set ::alwaysOnTop 0
+set ::autoSaveWatchlist 1
diff --git a/linuxcnc/Turner.2ms/lathe.ini b/linuxcnc/Turner.2ms/lathe.ini
new file mode 100644
index 0000000..86ba1c3
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe.ini
@@ -0,0 +1,159 @@
+# EMC controller parameters for a simulated machine.
+# General note: Comments can either be preceded with a # or ; - either is
+# acceptable, although # is in keeping with most linux config files.
+
+# General section -------------------------------------------------------------
+[EMC]
+VERSION = 1.1
+MACHINE = gmoccapy_lathe
+#DEBUG = 0x7FFFFFFF
+DEBUG = 0
+
+# for details see nc_files/subroutines/maco_instructions.txt
+[DISPLAY]
+DISPLAY = gmoccapy
+LATHE = 1
+BACK_TOOL_LATHE = 0
+
+# Cycle time, in milliseconds, that display will sleep between polls
+CYCLE_TIME = 100
+
+# Highest value that will be allowed for feed override, 1.0 = 100%
+MAX_FEED_OVERRIDE = 1.5
+MAX_SPINDLE_OVERRIDE = 1.2
+MIN_SPINDLE_OVERRIDE = .5
+
+# Prefix to be used
+PROGRAM_PREFIX = /home/debian/linuxcnc/nc_files
+
+# Introductory graphic
+INTRO_GRAPHIC = linuxcnc.gif
+INTRO_TIME = 5
+
+# list of selectable jog increments
+INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm
+
+[FILTER]
+PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
+PROGRAM_EXTENSION = .py Python Script
+png = image-to-gcode
+gif = image-to-gcode
+jpg = image-to-gcode
+py = python
+
+# Task controller section -----------------------------------------------------
+[RS274NGC]
+RS274NGC_STARTUP_CODE = G18 G21 G40 G49 G54 G80 G90 G94 G8 M9 M5 G64 P0.005
+PARAMETER_FILE = sim.var
+SUBROUTINE_PATH = macros
+
+# Motion control section ------------------------------------------------------
+[EMCMOT]
+EMCMOT = motmod
+COMM_TIMEOUT = 1.0
+BASE_PERIOD = 100000
+SERVO_PERIOD = 1000000
+
+# Hardware Abstraction Layer section --------------------------------------------------
+[TASK]
+TASK = milltask
+CYCLE_TIME = 0.001
+
+# Part program interpreter section --------------------------------------------
+[HAL]
+HALFILE = core_sim_lathe.hal
+HALFILE = spindle_sim.hal
+HALFILE = simulated_home_lathe.hal
+
+# Single file that is executed after the GUI has started.
+POSTGUI_HALFILE = gmoccapy_postgui.hal
+
+HALUI = halui
+
+# Trajectory planner section --------------------------------------------------
+[HALUI]
+#No Content
+
+[TRAJ]
+COORDINATES = X Z
+LINEAR_UNITS = mm
+ANGULAR_UNITS = degree
+DEFAULT_LINEAR_VELOCITY = 50
+MAX_LINEAR_VELOCITY = 234
+POSITION_FILE = position.txt
+#NO_FORCE_HOMING = 1
+
+# First axis
+[EMCIO]
+EMCIO = io
+CYCLE_TIME = 0.100
+
+# tool table file
+TOOL_TABLE = lathe.tbl
+
+[KINS]
+KINEMATICS = trivkins coordinates=XZ
+JOINTS = 2
+
+[AXIS_X]
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_0]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 0.0
+HOME = 100
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+HOME_IS_SHARED = 1
+
+# Third axis
+[AXIS_Z]
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_1]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 1.0
+HOME = 250
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 0
+HOME_IS_SHARED = 1
+
+# section for main IO controller parameters -----------------------------------
+[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
+
+
diff --git a/linuxcnc/Turner.2ms/lathe.pref b/linuxcnc/Turner.2ms/lathe.pref
new file mode 100644
index 0000000..d58a1da
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe.pref
@@ -0,0 +1,74 @@
+[DEFAULT]
+dro_size = 28
+abs_color = #0000FF
+rel_color = #000000
+dtg_color = #FFFF00
+homed_color = #00FF00
+unhomed_color = #FF0000
+spindle_bar_min = 0.0
+spindle_bar_max = 6000.0
+unlock_code = 123
+gremlin_view = rbt_view_y2
+blockheight = 0.0
+spindle_start_rpm = 300.0
+scale_jog_vel = 140.4
+scale_spindle_override = 1
+scale_feed_override = 1
+scale_rapid_override = 1
+hide_turtle_jog_button = False
+turtle_jog_factor = 20
+open_file =
+screen1 = window
+x_pos = 40
+y_pos = 30
+width = 979
+height = 750
+use_screen2 = False
+gtk_theme = Follow System Theme
+audio_alert = /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
+audio_error = /usr/share/sounds/freedesktop/stereo/dialog-error.oga
+grid_size = 1.0
+view = p
+mouse_btn_mode = 4
+hide_cursor = False
+system_name_tool = Tool
+system_name_g5x = G5x
+system_name_rot = Rot
+system_name_g92 = G92
+system_name_g54 = G54
+system_name_g55 = G55
+system_name_g56 = G56
+system_name_g57 = G57
+system_name_g58 = G58
+system_name_g59 = G59
+system_name_g59.1 = G59.1
+system_name_g59.2 = G59.2
+system_name_g59.3 = G59.3
+jump_to_dir = /home/emcmesa
+show_keyboard_on_offset = False
+show_keyboard_on_tooledit = False
+show_keyboard_on_edit = True
+show_keyboard_on_mdi = True
+show_keyboard_on_file_selection = False
+x_pos_popup = 45.0
+y_pos_popup = 55
+width_popup = 250.0
+max_messages = 10
+message_font = sans 10
+use_frames = True
+reload_tool = True
+blockdel = False
+opstop = False
+enable_dro = False
+show_offsets = False
+show_dtg = False
+view_tool_path = True
+view_dimension = True
+run_from_line = no_run
+unlock_way = use
+show_preview_on_offset = False
+use_keyboard_shortcuts = False
+dro_digits = 3
+toggle_readout = True
+tool_in_spindle = 0
+
diff --git a/linuxcnc/Turner.2ms/lathe.tbl b/linuxcnc/Turner.2ms/lathe.tbl
new file mode 100644
index 0000000..bd538b5
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe.tbl
@@ -0,0 +1,5 @@
+T1 P1 X-12.0 Y0.0 Z-25.0 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.4 I26.0 J86.0 Q2.0 ;60 Grad vorn
+T2 P2 X-10.356 Y0.0 Z12.123 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.1 I50.0 J85.0 Q2.0 ;35 Grad vorn
+T3 P3 X1.123 Y0.0 Z25.456 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.4 I-80.0 J-25.0 Q3.0 ;55 Grad vorn
+T4 P4 X0.0 Y0.0 Z0.0 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.1 I94.0 J154.0 Q1.0 ;60 Grad Rück
+T5 P5 X5.737 Y0.0 Z12.2399 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.1 I0.0 J0.0 Q6.0 ;Einstichstahl
diff --git a/linuxcnc/Turner.2ms/lathe_C.ini b/linuxcnc/Turner.2ms/lathe_C.ini
new file mode 100644
index 0000000..6adbccb
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe_C.ini
@@ -0,0 +1,182 @@
+# EMC controller parameters for a simulated machine.
+# General note: Comments can either be preceded with a # or ; - either is
+# acceptable, although # is in keeping with most linux config files.
+
+# General section -------------------------------------------------------------
+[EMC]
+VERSION = 1.1
+MACHINE = lathe_c
+#DEBUG = 0x7FFFFFFF
+DEBUG = 0
+
+# for details see nc_files/subroutines/maco_instructions.txt
+[DISPLAY]
+DISPLAY = gmoccapy
+LATHE = 1
+BACK_TOOL_LATHE = 0
+
+# Cycle time, in milliseconds, that display will sleep between polls
+CYCLE_TIME = 100
+
+# Highest value that will be allowed for feed override, 1.0 = 100%
+MAX_FEED_OVERRIDE = 1.5
+MAX_SPINDLE_OVERRIDE = 1.2
+MIN_SPINDLE_OVERRIDE = .5
+
+
+# Prefix to be used
+PROGRAM_PREFIX = /home/debian/linuxcnc/nc_files
+
+# Introductory graphic
+INTRO_GRAPHIC = linuxcnc.gif
+INTRO_TIME = 5
+
+# list of selectable jog increments
+INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm
+
+[FILTER]
+PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
+PROGRAM_EXTENSION = .py Python Script
+png = image-to-gcode
+gif = image-to-gcode
+jpg = image-to-gcode
+py = python
+
+# Task controller section -----------------------------------------------------
+[RS274NGC]
+RS274NGC_STARTUP_CODE = G18 G21 G40 G49 G54 G80 G90 G94 G8 M9 M5 G64 P0.005
+PARAMETER_FILE = sim.var
+SUBROUTINE_PATH = macros
+
+# Motion control section ------------------------------------------------------
+[EMCMOT]
+EMCMOT = motmod
+COMM_TIMEOUT = 1.0
+BASE_PERIOD = 100000
+SERVO_PERIOD = 1000000
+
+# Hardware Abstraction Layer section --------------------------------------------------
+[TASK]
+TASK = milltask
+CYCLE_TIME = 0.001
+
+# Part program interpreter section --------------------------------------------
+[HAL]
+HALFILE = core_sim_lathe_C.hal
+HALFILE = spindle_sim.hal
+HALFILE = simulated_home_lathe.hal
+
+# Single file that is executed after the GUI has started.
+POSTGUI_HALFILE = gmoccapy_postgui.hal
+
+HALUI = halui
+
+# Trajectory planner section --------------------------------------------------
+[HALUI]
+#No Content
+
+[TRAJ]
+COORDINATES = X Z C
+LINEAR_UNITS = mm
+ANGULAR_UNITS = degree
+DEFAULT_LINEAR_VELOCITY = 50
+MAX_LINEAR_VELOCITY = 234
+POSITION_FILE = position.txt
+#NO_FORCE_HOMING = 1
+
+# First axis
+[EMCIO]
+EMCIO = io
+CYCLE_TIME = 0.100
+
+# tool table file
+TOOL_TABLE = lathe.tbl
+
+[KINS]
+KINEMATICS = trivkins coordinates=XZC
+JOINTS = 3
+
+[AXIS_X]
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_0]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 0.0
+HOME = 10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+HOME_IS_SHARED = 1
+
+# Third axis
+[AXIS_Z]
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_1]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 1.0
+HOME = -10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 0
+HOME_IS_SHARED = 1
+
+
+[AXIS_C]
+MAX_VELOCITY = 90.0
+MAX_ACCELERATION = 1200.0
+
+[JOINT_2]
+TYPE = ANGULAR
+HOME = 0.0
+MAX_VELOCITY = 90.0
+MAX_ACCELERATION = 1200.0
+BACKLASH = 0.000
+INPUT_SCALE = 40
+OUTPUT_SCALE = 1.000
+FERROR = 5.0
+MIN_FERROR = 1.0
+HOME_OFFSET = 0.0
+HOME_SEARCH_VEL = 0.0
+HOME_LATCH_VEL = 0.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+
+# section for main IO controller parameters -----------------------------------
+[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
+
+
diff --git a/linuxcnc/Turner.2ms/lathe_CW.ini b/linuxcnc/Turner.2ms/lathe_CW.ini
new file mode 100644
index 0000000..7b16666
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe_CW.ini
@@ -0,0 +1,210 @@
+# EMC controller parameters for a simulated machine.
+# General note: Comments can either be preceded with a # or ; - either is
+# acceptable, although # is in keeping with most linux config files.
+
+# General section -------------------------------------------------------------
+[EMC]
+VERSION = 1.1
+MACHINE = lathe_cw
+#DEBUG = 0x7FFFFFFF
+DEBUG = 0
+
+# for details see nc_files/subroutines/maco_instructions.txt
+[DISPLAY]
+DISPLAY = gmoccapy
+LATHE = 1
+BACK_TOOL_LATHE = 0
+
+# Cycle time, in milliseconds, that display will sleep between polls
+CYCLE_TIME = 100
+
+# Highest value that will be allowed for feed override, 1.0 = 100%
+MAX_FEED_OVERRIDE = 1.5
+MAX_SPINDLE_OVERRIDE = 1.2
+MIN_SPINDLE_OVERRIDE = .5
+
+
+# Prefix to be used
+PROGRAM_PREFIX = /home/debian/linuxcnc/nc_files
+
+# Introductory graphic
+INTRO_GRAPHIC = linuxcnc.gif
+INTRO_TIME = 5
+
+# list of selectable jog increments
+INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm
+
+[FILTER]
+PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
+PROGRAM_EXTENSION = .py Python Script
+png = image-to-gcode
+gif = image-to-gcode
+jpg = image-to-gcode
+py = python
+
+# Task controller section -----------------------------------------------------
+[RS274NGC]
+RS274NGC_STARTUP_CODE = G18 G21 G40 G49 G54 G80 G90 G94 G8 M9 M5 G64 P0.005
+PARAMETER_FILE = sim.var
+SUBROUTINE_PATH = macros
+
+# Motion control section ------------------------------------------------------
+[EMCMOT]
+EMCMOT = motmod
+COMM_TIMEOUT = 1.0
+BASE_PERIOD = 100000
+SERVO_PERIOD = 1000000
+
+# Hardware Abstraction Layer section --------------------------------------------------
+[TASK]
+TASK = milltask
+CYCLE_TIME = 0.001
+
+# Part program interpreter section --------------------------------------------
+[HAL]
+HALFILE = core_sim_lathe_CW.hal
+HALFILE = spindle_sim.hal
+HALFILE = simulated_home_lathe.hal
+
+# Single file that is executed after the GUI has started.
+POSTGUI_HALFILE = gmoccapy_postgui.hal
+
+HALUI = halui
+
+# Trajectory planner section --------------------------------------------------
+[HALUI]
+#No Content
+
+[TRAJ]
+COORDINATES = X Z C W
+LINEAR_UNITS = mm
+ANGULAR_UNITS = degree
+DEFAULT_LINEAR_VELOCITY = 50
+MAX_LINEAR_VELOCITY = 234
+POSITION_FILE = position.txt
+#NO_FORCE_HOMING = 1
+
+# First axis
+[EMCIO]
+EMCIO = io
+CYCLE_TIME = 0.100
+
+# tool table file
+TOOL_TABLE = lathe.tbl
+
+[KINS]
+KINEMATICS = trivkins coordinates=XZCW
+JOINTS = 4
+
+[AXIS_X]
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_0]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 0.0
+HOME = 10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+HOME_IS_SHARED = 1
+
+# Third axis
+[AXIS_Z]
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_1]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 1.0
+HOME = -10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 0
+HOME_IS_SHARED = 1
+
+
+[AXIS_C]
+MAX_VELOCITY = 90.0
+MAX_ACCELERATION = 1200.0
+
+[JOINT_2]
+TYPE = ANGULAR
+HOME = 0.0
+MAX_VELOCITY = 90.0
+MAX_ACCELERATION = 1200.0
+BACKLASH = 0.000
+INPUT_SCALE = 40
+OUTPUT_SCALE = 1.000
+FERROR = 5.0
+MIN_FERROR = 1.0
+HOME_OFFSET = 0.0
+HOME_SEARCH_VEL = 0.0
+HOME_LATCH_VEL = 0.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+
+
+[AXIS_W]
+MIN_LIMIT = -200.0
+MAX_LIMIT = 0.0
+MAX_VELOCITY = 66
+MAX_ACCELERATION = 150.0
+
+[JOINT_3]
+TYPE = LINEAR
+MAX_VELOCITY = 66
+MAX_ACCELERATION = 150.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -200.0
+MAX_LIMIT = 0.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 0.0
+HOME = 0.0
+HOME_SEARCH_VEL = 0.0
+HOME_LATCH_VEL = 0.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+
+
+
+# section for main IO controller parameters -----------------------------------
+[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
+
+
diff --git a/linuxcnc/Turner.2ms/lathe_backtool.ini b/linuxcnc/Turner.2ms/lathe_backtool.ini
new file mode 100644
index 0000000..3ec2f6a
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe_backtool.ini
@@ -0,0 +1,160 @@
+# EMC controller parameters for a simulated machine.
+# General note: Comments can either be preceded with a # or ; - either is
+# acceptable, although # is in keeping with most linux config files.
+
+# General section -------------------------------------------------------------
+[EMC]
+VERSION = 1.1
+MACHINE = gmoccapy_lathe
+#DEBUG = 0x7FFFFFFF
+DEBUG = 0
+
+# for details see nc_files/subroutines/maco_instructions.txt
+[DISPLAY]
+DISPLAY = gmoccapy
+LATHE = 1
+BACK_TOOL_LATHE = 1
+
+# Cycle time, in milliseconds, that display will sleep between polls
+CYCLE_TIME = 100
+
+# Highest value that will be allowed for feed override, 1.0 = 100%
+MAX_FEED_OVERRIDE = 1.5
+MAX_SPINDLE_OVERRIDE = 1.2
+MIN_SPINDLE_OVERRIDE = .5
+
+
+# Prefix to be used
+PROGRAM_PREFIX = /home/debian/linuxcnc/nc_files
+
+# Introductory graphic
+INTRO_GRAPHIC = linuxcnc.gif
+INTRO_TIME = 5
+
+# list of selectable jog increments
+INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm
+
+[FILTER]
+PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
+PROGRAM_EXTENSION = .py Python Script
+png = image-to-gcode
+gif = image-to-gcode
+jpg = image-to-gcode
+py = python
+
+# Task controller section -----------------------------------------------------
+[RS274NGC]
+RS274NGC_STARTUP_CODE = G18 G21 G40 G49 G54 G80 G90 G94 G8 M9 M5 G64 P0.005
+PARAMETER_FILE = sim.var
+SUBROUTINE_PATH = macros
+
+# Motion control section ------------------------------------------------------
+[EMCMOT]
+EMCMOT = motmod
+COMM_TIMEOUT = 1.0
+BASE_PERIOD = 100000
+SERVO_PERIOD = 1000000
+
+# Hardware Abstraction Layer section --------------------------------------------------
+[TASK]
+TASK = milltask
+CYCLE_TIME = 0.001
+
+# Part program interpreter section --------------------------------------------
+[HAL]
+HALFILE = core_sim_lathe.hal
+HALFILE = spindle_sim.hal
+HALFILE = simulated_home_lathe.hal
+
+# Single file that is executed after the GUI has started.
+POSTGUI_HALFILE = gmoccapy_postgui.hal
+
+HALUI = halui
+
+# Trajectory planner section --------------------------------------------------
+[HALUI]
+#No Content
+
+[TRAJ]
+COORDINATES = X Z
+LINEAR_UNITS = mm
+ANGULAR_UNITS = degree
+DEFAULT_LINEAR_VELOCITY = 50
+MAX_LINEAR_VELOCITY = 234
+POSITION_FILE = position.txt
+#NO_FORCE_HOMING = 1
+
+# First axis
+[EMCIO]
+EMCIO = io
+CYCLE_TIME = 0.100
+
+# tool table file
+TOOL_TABLE = lathe.tbl
+
+[KINS]
+KINEMATICS = trivkins coordinates=XZ
+JOINTS = 2
+
+[AXIS_X]
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_0]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 0.0
+HOME = 10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+HOME_IS_SHARED = 1
+
+# Third axis
+[AXIS_Z]
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_1]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 1.0
+HOME = -10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 0
+HOME_IS_SHARED = 1
+
+# section for main IO controller parameters -----------------------------------
+[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
+
+
diff --git a/linuxcnc/Turner.2ms/lathe_c.pref b/linuxcnc/Turner.2ms/lathe_c.pref
new file mode 100644
index 0000000..c4dadc1
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe_c.pref
@@ -0,0 +1,73 @@
+[DEFAULT]
+dro_size = 28
+abs_color = #0000FF
+rel_color = #000000
+dtg_color = #FFFF00
+homed_color = #00FF00
+unhomed_color = #FF0000
+spindle_bar_min = 0.0
+spindle_bar_max = 6000.0
+unlock_code = 123
+open_file =
+screen1 = window
+x_pos = 40
+y_pos = 30
+width = 979
+height = 750
+reload_tool = True
+enable_dro = False
+show_offsets = False
+show_dtg = False
+view_tool_path = True
+view_dimension = True
+mouse_btn_mode = 4
+x_pos_popup = 45.0
+y_pos_popup = 55
+width_popup = 250.0
+max_messages = 10
+message_font = sans 10
+use_frames = True
+show_keyboard_on_offset = False
+show_keyboard_on_tooledit = False
+show_keyboard_on_edit = True
+show_keyboard_on_mdi = False
+show_keyboard_on_file_selection = False
+system_name_tool = Tool
+system_name_g5x = G5x
+system_name_rot = Rotation of Z
+system_name_g92 = G92
+system_name_g54 = G54
+system_name_g55 = G55
+system_name_g56 = G56
+system_name_g57 = G57
+system_name_g58 = G58
+system_name_g59 = G59
+system_name_g59.1 = G59.1
+system_name_g59.2 = G59.2
+system_name_g59.3 = G59.3
+unlock_way = no
+grid_size = 1.0
+view = y2
+gremlin_view = rbt_view_y
+tool_in_spindle = 0
+blockheight = 0.0
+spindle_start_rpm = 300.0
+scale_jog_vel = 140.4
+scale_spindle_override = 1
+scale_feed_override = 1
+scale_rapid_override = 1
+hide_turtle_jog_button = False
+turtle_jog_factor = 20
+gtk_theme = Follow System Theme
+audio_alert = /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
+audio_error = /usr/share/sounds/freedesktop/stereo/dialog-error.oga
+hide_cursor = False
+jump_to_dir = /home/emcmesa
+blockdel = False
+opstop = False
+run_from_line = run
+show_preview_on_offset = True
+use_keyboard_shortcuts = True
+dro_digits = 3
+toggle_readout = True
+
diff --git a/linuxcnc/Turner.2ms/lathe_cw.pref b/linuxcnc/Turner.2ms/lathe_cw.pref
new file mode 100644
index 0000000..6ca7186
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe_cw.pref
@@ -0,0 +1,72 @@
+[DEFAULT]
+dro_size = 28
+abs_color = #0000FF
+rel_color = #000000
+dtg_color = #FFFF00
+homed_color = #00FF00
+unhomed_color = #FF0000
+spindle_bar_min = 0.0
+spindle_bar_max = 6000.0
+unlock_code = 123
+view = y2
+blockheight = 0.0
+spindle_start_rpm = 300.0
+scale_jog_vel = 140.4
+scale_spindle_override = 1
+scale_feed_override = 1
+scale_rapid_override = 1
+hide_turtle_jog_button = False
+turtle_jog_factor = 20
+open_file =
+screen1 = window
+x_pos = 40
+y_pos = 30
+width = 979
+height = 750
+gtk_theme = Follow System Theme
+audio_alert = /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
+audio_error = /usr/share/sounds/freedesktop/stereo/dialog-error.oga
+grid_size = 1.0
+mouse_btn_mode = 4
+hide_cursor = False
+system_name_tool = Tool
+system_name_g5x = G5x
+system_name_rot = Rot
+system_name_g92 = G92
+system_name_g54 = G54
+system_name_g55 = G55
+system_name_g56 = G56
+system_name_g57 = G57
+system_name_g58 = G58
+system_name_g59 = G59
+system_name_g59.1 = G59.1
+system_name_g59.2 = G59.2
+system_name_g59.3 = G59.3
+jump_to_dir = /home/emcmesa
+show_keyboard_on_offset = False
+show_keyboard_on_tooledit = False
+show_keyboard_on_edit = False
+show_keyboard_on_mdi = False
+show_keyboard_on_file_selection = False
+x_pos_popup = 45.0
+y_pos_popup = 55
+width_popup = 250.0
+max_messages = 10
+message_font = sans 10
+use_frames = True
+reload_tool = True
+blockdel = False
+opstop = False
+enable_dro = False
+show_offsets = False
+show_dtg = False
+view_tool_path = True
+view_dimension = True
+run_from_line = no_run
+unlock_way = no
+show_preview_on_offset = False
+use_keyboard_shortcuts = True
+dro_digits = 3
+toggle_readout = True
+tool_in_spindle = 2
+
diff --git a/linuxcnc/Turner.2ms/lathe_imperial.ini b/linuxcnc/Turner.2ms/lathe_imperial.ini
new file mode 100644
index 0000000..4629d00
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe_imperial.ini
@@ -0,0 +1,160 @@
+# EMC controller parameters for a simulated machine.
+# General note: Comments can either be preceded with a # or ; - either is
+# acceptable, although # is in keeping with most linux config files.
+
+# General section -------------------------------------------------------------
+[EMC]
+VERSION = 1.1
+MACHINE = lathe_imperial
+#DEBUG = 0x7FFFFFFF
+DEBUG = 0
+
+# for details see nc_files/subroutines/maco_instructions.txt
+[DISPLAY]
+DISPLAY = gmoccapy
+
+LATHE = 1
+BACK_TOOL_LATHE = 0
+
+# Cycle time, in milliseconds, that display will sleep between polls
+CYCLE_TIME = 100
+
+# Highest value that will be allowed for feed override, 1.0 = 100%
+MAX_FEED_OVERRIDE = 1.5
+MAX_SPINDLE_OVERRIDE = 1.2
+MIN_SPINDLE_OVERRIDE = .5
+
+# Prefix to be used
+PROGRAM_PREFIX = /home/debian/linuxcnc/nc_files
+
+# Introductory graphic
+INTRO_GRAPHIC = linuxcnc.gif
+INTRO_TIME = 5
+
+# list of selectable jog increments
+INCREMENTS = 0.4 inch, 0.04 inch , 0.004 inch, 0.0004 inch
+
+[FILTER]
+PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
+PROGRAM_EXTENSION = .py Python Script
+png = image-to-gcode
+gif = image-to-gcode
+jpg = image-to-gcode
+py = python
+
+# Task controller section -----------------------------------------------------
+[RS274NGC]
+RS274NGC_STARTUP_CODE = G18 G20 G40 G49 G54 G80 G90 G94 G8 M9 M5 G64 P0.001
+PARAMETER_FILE = sim.var
+SUBROUTINE_PATH = macros
+
+# Motion control section ------------------------------------------------------
+[EMCMOT]
+EMCMOT = motmod
+COMM_TIMEOUT = 1.0
+BASE_PERIOD = 100000
+SERVO_PERIOD = 1000000
+
+# Hardware Abstraction Layer section --------------------------------------------------
+[TASK]
+TASK = milltask
+CYCLE_TIME = 0.001
+
+# Part program interpreter section --------------------------------------------
+[HAL]
+HALFILE = core_sim_lathe.hal
+HALFILE = spindle_sim.hal
+HALFILE = simulated_home_lathe.hal
+
+# Single file that is executed after the GUI has started.
+POSTGUI_HALFILE = gmoccapy_postgui.hal
+
+HALUI = halui
+
+# Trajectory planner section --------------------------------------------------
+[HALUI]
+#No Content
+
+[TRAJ]
+COORDINATES = X Z
+LINEAR_UNITS = inch
+ANGULAR_UNITS = degree
+DEFAULT_LINEAR_VELOCITY = 1.6
+MAX_LINEAR_VELOCITY = 10
+POSITION_FILE = position.txt
+
+# First axis
+[EMCIO]
+EMCIO = io
+CYCLE_TIME = 0.100
+
+# tool table file
+TOOL_TABLE = lathe.tbl
+
+[KINS]
+KINEMATICS = trivkins coordinates=XZ
+JOINTS = 2
+
+[AXIS_X]
+MIN_LIMIT = -2.0
+MAX_LIMIT = 40.0
+MAX_VELOCITY = 6.5
+MAX_ACCELERATION = 59.0
+
+[JOINT_0]
+TYPE = LINEAR
+MAX_VELOCITY = 6.5
+MAX_ACCELERATION = 59.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -2.0
+MAX_LIMIT = 40.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 0.0
+HOME = 4
+HOME_SEARCH_VEL = 40.0
+HOME_LATCH_VEL = 2.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+HOME_IS_SHARED = 1
+
+
+# Third axis
+[AXIS_Z]
+MIN_LIMIT = -3.0
+MAX_LIMIT = 400.0
+MAX_VELOCITY = 6.5
+MAX_ACCELERATION = 59.0
+
+[JOINT_1]
+TYPE = LINEAR
+MAX_VELOCITY = 6.5
+MAX_ACCELERATION = 59.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -3.0
+MAX_LIMIT = 400.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 1.0
+HOME = -4
+HOME_SEARCH_VEL = 40.0
+HOME_LATCH_VEL = 2.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 0
+HOME_IS_SHARED = 1
+
+# section for main IO controller parameters -----------------------------------
+[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
+
+# Sections for display options ------------------------------------------------
diff --git a/linuxcnc/Turner.2ms/lathe_imperial.pref b/linuxcnc/Turner.2ms/lathe_imperial.pref
new file mode 100644
index 0000000..d261f5c
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe_imperial.pref
@@ -0,0 +1,71 @@
+[DEFAULT]
+dro_size = 28
+abs_color = #0000FF
+rel_color = #000000
+dtg_color = #FFFF00
+homed_color = #00FF00
+unhomed_color = #FF0000
+spindle_bar_min = 0.0
+spindle_bar_max = 6000.0
+unlock_code = 123
+blockheight = 0.0
+spindle_start_rpm = 300.0
+scale_jog_vel = 6.0
+scale_spindle_override = 1
+scale_feed_override = 1
+scale_rapid_override = 1
+hide_turtle_jog_button = False
+turtle_jog_factor = 20
+open_file =
+screen1 = window
+x_pos = 40
+y_pos = 30
+width = 979
+height = 750
+gtk_theme = Follow System Theme
+audio_alert = /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
+audio_error = /usr/share/sounds/freedesktop/stereo/dialog-error.oga
+grid_size = 1.0
+mouse_btn_mode = 4
+hide_cursor = False
+system_name_tool = Tool
+system_name_g5x = G5x
+system_name_rot = Rot
+system_name_g92 = G92
+system_name_g54 = G54
+system_name_g55 = G55
+system_name_g56 = G56
+system_name_g57 = G57
+system_name_g58 = G58
+system_name_g59 = G59
+system_name_g59.1 = G59.1
+system_name_g59.2 = G59.2
+system_name_g59.3 = G59.3
+jump_to_dir = /home/emcmesa
+show_keyboard_on_offset = False
+show_keyboard_on_tooledit = False
+show_keyboard_on_edit = True
+show_keyboard_on_mdi = True
+show_keyboard_on_file_selection = False
+x_pos_popup = 45.0
+y_pos_popup = 55
+width_popup = 250.0
+max_messages = 10
+message_font = sans 10
+use_frames = True
+reload_tool = True
+blockdel = False
+opstop = False
+enable_dro = False
+show_offsets = False
+show_dtg = False
+view_tool_path = True
+view_dimension = True
+run_from_line = no_run
+unlock_way = use
+show_preview_on_offset = False
+use_keyboard_shortcuts = False
+dro_digits = 4
+toggle_readout = True
+view = y
+
diff --git a/linuxcnc/Turner.2ms/lathe_macros.ini b/linuxcnc/Turner.2ms/lathe_macros.ini
new file mode 100644
index 0000000..ca358f6
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathe_macros.ini
@@ -0,0 +1,165 @@
+# EMC controller parameters for a simulated machine.
+# General note: Comments can either be preceded with a # or ; - either is
+# acceptable, although # is in keeping with most linux config files.
+
+# General section -------------------------------------------------------------
+[EMC]
+VERSION = 1.1
+MACHINE = gmoccapy_lathe
+#DEBUG = 0x7FFFFFFF
+DEBUG = 0
+
+# for details see nc_files/subroutines/maco_instructions.txt
+[DISPLAY]
+DISPLAY = gmoccapy
+LATHE = 1
+BACK_TOOL_LATHE = 0
+
+# Cycle time, in milliseconds, that display will sleep between polls
+CYCLE_TIME = 100
+
+# Highest value that will be allowed for feed override, 1.0 = 100%
+MAX_FEED_OVERRIDE = 1.5
+MAX_SPINDLE_OVERRIDE = 1.2
+MIN_SPINDLE_OVERRIDE = .5
+
+
+# Prefix to be used
+PROGRAM_PREFIX = /home/debian/linuxcnc/nc_files
+
+# Introductory graphic
+INTRO_GRAPHIC = linuxcnc.gif
+INTRO_TIME = 5
+
+# list of selectable jog increments
+INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm
+
+EMBED_TAB_NAME = Cycles
+EMBED_TAB_LOCATION = ntb_preview
+#EMBED_TAB_LOCATION = ntb_user_tabs
+EMBED_TAB_COMMAND = halcmd loadusr -Wn gladevcp gladevcp -c gladevcp -U notouch=1 -U norun=0 -u lathehandler.py -x {XID} lathemacro.ui
+
+[FILTER]
+PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
+PROGRAM_EXTENSION = .py Python Script
+png = image-to-gcode
+gif = image-to-gcode
+jpg = image-to-gcode
+py = python
+
+# Task controller section -----------------------------------------------------
+[RS274NGC]
+RS274NGC_STARTUP_CODE = G18 G21 G40 G49 G54 G80 G90 G94 G8 M9 M5 G64 P0.005
+PARAMETER_FILE = sim.var
+SUBROUTINE_PATH = macros:./
+
+# Motion control section ------------------------------------------------------
+[EMCMOT]
+EMCMOT = motmod
+COMM_TIMEOUT = 1.0
+BASE_PERIOD = 100000
+SERVO_PERIOD = 1000000
+
+# Hardware Abstraction Layer section --------------------------------------------------
+[TASK]
+TASK = milltask
+CYCLE_TIME = 0.001
+
+# Part program interpreter section --------------------------------------------
+[HAL]
+HALFILE = core_sim_lathe.hal
+HALFILE = spindle_sim.hal
+HALFILE = simulated_home_lathe.hal
+
+# Single file that is executed after the GUI has started.
+#POSTGUI_HALFILE = gmoccapy_postgui.hal
+
+HALUI = halui
+
+# Trajectory planner section --------------------------------------------------
+[HALUI]
+#No Content
+
+[TRAJ]
+COORDINATES = X Z
+LINEAR_UNITS = mm
+ANGULAR_UNITS = degree
+DEFAULT_LINEAR_VELOCITY = 50
+MAX_LINEAR_VELOCITY = 234
+POSITION_FILE = position.txt
+#NO_FORCE_HOMING = 1
+
+# First axis
+[EMCIO]
+EMCIO = io
+CYCLE_TIME = 0.100
+
+# tool table file
+TOOL_TABLE = lathe.tbl
+
+[KINS]
+KINEMATICS = trivkins coordinates=XZ
+JOINTS = 2
+
+[AXIS_X]
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_0]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -50.0
+MAX_LIMIT = 200.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 0.0
+HOME = 10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 1
+HOME_IS_SHARED = 1
+
+# Third axis
+[AXIS_Z]
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+
+[JOINT_1]
+TYPE = LINEAR
+MAX_VELOCITY = 166
+MAX_ACCELERATION = 1500.0
+BACKLASH = 0.000
+INPUT_SCALE = 4000
+OUTPUT_SCALE = 1.000
+MIN_LIMIT = -75.0
+MAX_LIMIT = 1000.0
+FERROR = 0.050
+MIN_FERROR = 0.010
+HOME_OFFSET = 1.0
+HOME = -10
+HOME_SEARCH_VEL = 200.0
+HOME_LATCH_VEL = 20.0
+HOME_USE_INDEX = NO
+HOME_IGNORE_LIMITS = NO
+HOME_SEQUENCE = 0
+HOME_IS_SHARED = 1
+
+# section for main IO controller parameters -----------------------------------
+[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
+
+
diff --git a/linuxcnc/Turner.2ms/lathehandler.py b/linuxcnc/Turner.2ms/lathehandler.py
new file mode 100755
index 0000000..86a2091
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathehandler.py
@@ -0,0 +1,217 @@
+#!/usr/bin/env python3
+# vim: sts=4 sw=4 et
+# This is a component of EMC
+# savestate.py copyright 2013 Andy Pugh
+# based on code from
+# probe.py Copyright 2010 Michael Haberler
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA''''''
+
+import os,sys
+from gladevcp.persistence import IniFile,widget_defaults,set_debug,select_widgets
+import hal
+import hal_glib
+import glib
+import linuxcnc
+import cairo
+import signal
+import re
+import gi
+gi.require_version('Rsvg', '2.0')
+gi.require_version('Gtk', '3.0')
+from gi.repository import Gtk
+from gi.repository import Gdk
+from gi.repository import GObject
+from gi.repository import Pango
+from gi.repository import Rsvg
+from gi.repository import GdkPixbuf
+debug = 0
+notouch = 0
+norun = 0
+
+class HandlerClass:
+ active = False
+ tab_num = 0
+
+ def on_expose(self,nb,data=None):
+ tab_num = nb.get_current_page()
+ tab = nb.get_nth_page(tab_num)
+ alloc = tab.get_allocation()
+ x, y, w, h = (alloc.x, alloc.y, alloc.width, alloc.height)
+ pixbuf = self.svg.get_pixbuf_sub(f'#layer{tab_num}').scale_simple(w-10, h-10, GdkPixbuf.InterpType.BILINEAR)
+ im = self.builder.get_object(f'Image{tab_num}')
+ im.set_from_pixbuf(pixbuf)
+ for c in im.get_parent().get_children():
+ if c.get_has_tooltip():
+ m = re.findall(r'', c.get_tooltip_markup())
+ if len(m) > 0:
+ x1 = int(m[0][0]); y1 = int(m[0][1])
+ c.set_margin_left(max(0, w * x1/1500))
+ c.set_margin_top(max(0, h * y1/1000))
+
+
+ # decide if our window is active to mask the cycle-start hardware button
+ # FIXME: This is probably not as reliable as one might wish.
+ def event(self,w,event):
+ if w.is_active():
+ if w.has_toplevel_focus() :
+ self.active = True
+ else:
+ self.active = False
+
+ # Capture notify events
+ def on_map_event(self, widget, data=None):
+ top = widget.get_toplevel()
+ top.connect('notify', self.event)
+
+ def on_destroy(self,obj,data=None):
+ self.ini.save_state(self)
+
+ def on_restore_defaults(self,button,data=None):
+ '''
+ example callback for 'Reset to defaults' button
+ currently unused
+ '''
+ self.ini.create_default_ini()
+ self.ini.restore_state(self)
+
+ def __init__(self, halcomp,builder,useropts):
+ self.halcomp = halcomp
+ self.builder = builder
+ self.ini_filename = 'savestate.sav'
+ self.defaults = { IniFile.vars: dict(),
+ IniFile.widgets : widget_defaults(select_widgets(self.builder.get_objects(),
+ hal_only=False,output_only = True))
+ }
+ self.ini = IniFile(self.ini_filename,self.defaults,self.builder)
+ self.ini.restore_state(self)
+
+ # A pin to use a physical switch to start the cycle
+ self.cycle_start = hal_glib.GPin(halcomp.newpin('cycle-start', hal.HAL_BIT, hal.HAL_IN))
+ self.cycle_start.connect('value-changed', self.cycle_pin)
+
+ # This catches the signal from Touchy to say that the tab is exposed
+ t = self.builder.get_object('macrobox')
+ t.connect('map-event',self.on_map_event)
+ t.add_events(Gdk.EventMask.STRUCTURE_MASK)
+
+ self.cmd = linuxcnc.command()
+
+ # This connects the expose event to re-draw and scale the SVG frames
+ t = self.builder.get_object('tabs1')
+ t.connect_after("draw", self.on_expose)
+ t.connect("destroy", Gtk.main_quit)
+ t.add_events(Gdk.EventMask.STRUCTURE_MASK)
+ self.svg = Rsvg.Handle().new_from_file('LatheMacro.svg')
+ self.active = True
+
+ # handle Useropts
+ if norun:
+ for c in range(0,6):
+ print(c)
+ print( f'tab{c}.action')
+ self.builder.get_object(f'tab{c}.action').set_visible(False)
+
+ def show_keyb(self, obj, data=None):
+ if notouch: return False
+ self.active_ctrl = obj
+ self.keyb = self.builder.get_object('keyboard')
+ self.entry = self.builder.get_object('entry1')
+ self.entry.modify_font(Pango.FontDescription("courier 42"))
+ self.entry.set_text("")
+ resp = self.keyb.run()
+ return True
+
+ def keyb_prev_click(self, obj, data=None):
+ self.entry.set_text(self.active_ctrl.get_text())
+
+ def keyb_number_click(self, obj, data=None):
+ data = self.entry.get_text()
+ data = data + obj.get_label()
+ if any( x in data for x in [ '/2', '/4', '/8', '/16', '/32', '/64', '/128']):
+ v = [0] + [float(x) for x in data.replace('/','.').split('.')]
+ data = f'{v[-3] + v[-2]/v[-1]:6.7}'
+ self.entry.set_text(data)
+
+ def keyb_pm_click(self, obj, data=None):
+ data = self.entry.get_text()
+ if data[0] == '-':
+ data = data[1:]
+ else:
+ data = '-' + data
+ self.entry.set_text(data)
+
+ def keyb_convert_click(self, obj, data=None):
+ v = float(self.entry.get_text())
+ op = obj.get_label()
+ if op == 'in->mm':
+ self.entry.set_text(f'{v * 25.4:6.4}')
+ elif op == 'mm->in':
+ self.entry.set_text(f'{v / 25.4:6.4}')
+ elif op == 'tpi->pitch':
+ self.entry.set_text(f'{25.4 / v:6.4}')
+ elif op == 'pitch->tpi':
+ self.entry.set_text(f'{25.4 / v:6.4}')
+
+ def keyb_del_click(self, obj, data=None):
+ data = self.entry.get_text()
+ data = data[:-1]
+ self.entry.set_text(data)
+
+ def keyb_clear_click(self, obj, data=None):
+ self.entry.set_text('')
+
+ def keyb_cancel_click(self, obj, data=None):
+ self.keyb.hide()
+
+ def keyb_ok_click(self, obj, data=None):
+ if self.entry.get_text() != '':
+ self.active_ctrl.set_value(float(self.entry.get_text()))
+ self.keyb.hide()
+
+ def set_alpha(self, obj, data = None):
+ cr = obj.get_property('window').cairo_create()
+ cr.set_source_rgba(1.0, 1.0, 1.0, 0.0)
+
+ def cycle_pin(self, pin, data = None):
+ if pin.get() == 0:
+ return
+ if self.active:
+ nb = self.builder.get_object('tabs1')
+ print('current tab', nb.get_current_page())
+ c = self.builder.get_object(f"tab{nb.get_current_page()}.action")
+ if c is not None:
+ self.cmd.abort()
+ self.cmd.mode(linuxcnc.MODE_MDI)
+ self.cmd.wait_complete()
+ c.emit('clicked')
+ print(c.get_name(), "clicked")
+
+ def testing(self, obj, data = None):
+ print('event', data)
+
+def get_handlers(halcomp,builder,useropts):
+
+ global debug
+ for cmd in useropts:
+ print(cmd)
+ exec(cmd, globals())
+
+ set_debug(debug)
+ return [HandlerClass(halcomp,builder,useropts)]
+
+
+
diff --git a/linuxcnc/Turner.2ms/lathemacro.ui b/linuxcnc/Turner.2ms/lathemacro.ui
new file mode 100644
index 0000000..f9261e8
--- /dev/null
+++ b/linuxcnc/Turner.2ms/lathemacro.ui
@@ -0,0 +1,2937 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ O<radius> call [${radius.x-f}] [${radius.sf-f}] [0.5] [0][${radius.z-f}] [${radius.tool-s}] [0] [${radius.rad-f}] [${radius.fo}] [${radius.fi}] [${radius.bo}] [${radius.coolant}]
+
+
+ Set Tool
+ M61 Q${radius.tool-s} G43 H${radius.tool-s}
+
+
+ O<threading>call [${thread.x-f}] [${thread.sf-f}] [${thread.tool-s}] [${thread.pitch-f}] [${thread.z-f}] [${thread.internal}] [${thread.external}] [${thread.coolant}]
+
+
+ M61 Q${thread.tool-s} G43 H${thread.tool-s}
+
+
+ O<turning> call [${turn.x-f}] [${turn.sf-f}] [${turn.cut-f}] [${turn.feed-f}] [${turn.z-f}] [${turn.rad-f}] [${turn.angle-f}] [${turn.tool-s}] [${turn.coolant}]
+
+
+ Set Tool
+ M61 Q${turn.tool-s} G43 H${turn.tool-s}
+
+
+ False
+ GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK
+ 200
+ 100
+ False
+
+
+
+
+
+ True
+ False
+
+ False
+
+
+ True
+ True
+ GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK | GDK_SUBSTRUCTURE_MASK | GDK_SCROLL_MASK
+ left
+
+
+
+ True
+ False
+
+
+ True
+ False
+ gtk-missing-image
+
+
+ -1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1000,654-->Finish Diameter
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ False
+ TurnXAdj
+ 4
+ True
+
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--635,687-->Feed per Rev
+ start
+ start
+ ●
+ 5
+ 0.000
+ False
+ False
+ TurnFeedAdj
+ 3
+ True
+
+
+
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--800,230-->End Radius
+ start
+ start
+ ●
+ 5
+ 0.000
+ False
+ False
+ TurnRadAdj
+ 4
+ True
+
+
+
+ 2
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--821,863-->Cut per pass
+ start
+ start
+ ●
+ 5
+ 0.000
+ False
+ False
+ TurnCutAdj
+ 3
+ True
+
+
+
+ 3
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--125,424-->Finish Z
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ TurnZAdj
+ 4
+ True
+
+
+
+ 4
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--520,474-->Taper angle
+ start
+ start
+ ●
+ 5
+ 0.0000
+ False
+ False
+ False
+ TurnAngAdj
+ 3
+ True
+
+
+
+ 5
+
+
+
+
+ 100
+ 40
+ True
+ False
+ end
+ end
+
+
+ gtk-media-play
+ False
+ turn.go
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+
+
+ 10
+
+
+
+
+ True
+ False
+ end
+ start
+
+
+ 50
+ 20
+ True
+ True
+ ●
+ 0
+ False
+ False
+ TurnToolAdj
+
+
+
+ 1
+ 0
+
+
+
+
+ Set Tool
+ turn.toolchange
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ 0
+ 0
+
+
+
+
+ True
+ False
+ center
+ Speed
+ 1
+
+
+ 0
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ end
+ start
+ ●
+ 5
+ 20
+ False
+ False
+ TurnSFAdj
+ 20
+
+
+
+ 1
+ 1
+
+
+
+
+ Coolant
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+
+
+
+
+
+
+
+ 11
+
+
+
+
+ False
+
+
+
+
+ True
+ False
+ Turning
+
+
+ False
+
+
+
+
+ True
+ False
+
+
+ True
+ False
+ gtk-missing-image
+
+
+ -1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--700,280-->Taper Angle
+ start
+ start
+ ●
+ 5
+ 0.0000
+ False
+ False
+ BoreAngleAdj
+ 3
+
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--421,520-->Run-out radius
+ start
+ start
+ ●
+ 5
+ 0.000
+ False
+ False
+ BoreRadAdj
+ 4
+
+
+
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1080,616-->Finish Diameter
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ BoreXAdj
+ 4
+
+
+
+ 2
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--900,825-->Diameter Increment
+ start
+ start
+ ●
+ 5
+ 0.000
+ False
+ False
+ BoreCutAdj
+ 4
+
+
+
+ 3
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--530,820-->Feed per rev
+ start
+ start
+ ●
+ 5
+ 0.000
+ False
+ False
+ BoreFeedAdj
+ 4
+
+
+
+ 4
+
+
+
+
+ 100
+ 40
+ True
+ False
+ end
+ end
+
+
+ gtk-media-play
+ False
+ bore.go
+ 50
+ 20
+ True
+ True
+ True
+ True
+ True
+
+
+
+
+ 7
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--273,267-->Finish Z
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ BoreZAdj
+ 4
+
+
+
+ 9
+
+
+
+
+ True
+ False
+ end
+ start
+
+
+ 50
+ 20
+ True
+ True
+ end
+ start
+ ●
+ 5
+ 0
+ False
+ False
+ BoreSFAdj
+
+
+
+ 1
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ ●
+ 0
+ False
+ False
+ BoreToolAdj
+
+
+
+ 1
+ 0
+
+
+
+
+ Set Tool
+ bore.toolchange
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ 0
+ 0
+
+
+
+
+ True
+ False
+ center
+ Speed
+ 1
+
+
+ 0
+ 1
+
+
+
+
+ Coolant
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+
+
+
+
+
+
+
+ 11
+
+
+
+
+ 1
+ False
+
+
+
+
+ True
+ False
+ Boring
+
+
+ 1
+ False
+
+
+
+
+ True
+ False
+
+
+ True
+ False
+ gtk-missing-image
+
+
+ -1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--156,404-->Finish Z
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ FaceZAdj
+ 4
+
+
+
+ 2
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1115,626-->Finish Diameter
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ FaceXAdj
+ 4
+
+
+
+ 3
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--876,886-->Feed per Rev
+ start
+ start
+ ●
+ 5
+ 0.0000
+ False
+ False
+ FaceFeedAdj
+ 3
+
+
+
+ 4
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--408,760-->Cut per pass
+ start
+ start
+ ●
+ 5
+ 0.000
+ False
+ False
+ FaceCutAdj
+ 3
+
+
+
+ 5
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1044,364-->Face Angle
+ start
+ start
+ ●
+ 5
+ 0.0000
+ False
+ False
+ FaceAngleAdj
+ 3
+
+
+
+ 6
+
+
+
+
+ 100
+ 40
+ True
+ False
+ end
+ end
+ False
+
+
+ gtk-media-play
+ False
+ face.go
+ 50
+ 20
+ True
+ True
+ True
+ True
+ True
+
+
+
+
+ 9
+
+
+
+
+ True
+ False
+ end
+ start
+
+
+ 50
+ 20
+ True
+ True
+ end
+ start
+ ●
+ 5
+ 0
+ False
+ False
+ FaceSFAdj
+
+
+
+ 1
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ ●
+ 0
+ False
+ False
+ FaceToolAdj
+
+
+
+ 1
+ 0
+
+
+
+
+ Set Tool
+ face.toolchange
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ 0
+ 0
+
+
+
+
+ True
+ False
+ center
+ Speed
+ 1
+
+
+ 0
+ 1
+
+
+
+
+ Coolant
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+
+
+
+
+
+
+
+ 10
+
+
+
+
+ Face
+ 2
+ False
+
+
+
+
+ True
+ False
+ Facing
+
+
+ 2
+ False
+
+
+
+
+ True
+ False
+
+
+ True
+ False
+ gtk-missing-image
+
+
+ -1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1018,674-->Radius Inner or Outer Diameter
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ RadXAdj
+ 4
+
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--202,334-->Radius Z position
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ RadiusZAdj
+ 4
+
+
+
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--848,451-->Radius
+ start
+ start
+ ●
+ 5
+ 0.000
+ False
+ False
+ RadRadAdj
+ 3
+
+
+
+ 2
+
+
+
+
+ 100
+ 40
+ True
+ False
+ <!--863,629-->Front Inside Radius
+ start
+ start
+
+
+ 50
+ 20
+ True
+ True
+ False
+ True
+ True
+
+
+
+
+ 3
+
+
+
+
+ 100
+ 40
+ True
+ False
+ <!--763,680-->Front Outside Radius
+ start
+ start
+
+
+ 50
+ 20
+ True
+ True
+ False
+ True
+ radius.fi
+
+
+
+
+ 4
+
+
+
+
+ 100
+ 40
+ True
+ False
+ <!--335,448-->Back Outside Radius
+ start
+ start
+
+
+ 50
+ 20
+ True
+ True
+ False
+ True
+ radius.fi
+
+
+
+
+ 5
+
+
+
+
+ 100
+ 40
+ True
+ False
+ end
+ end
+
+
+ radius.go
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-media-play
+
+
+
+
+
+
+ 10
+
+
+
+
+ True
+ False
+ end
+ start
+
+
+ 50
+ 20
+ True
+ True
+ end
+ start
+ ●
+ 5
+ 0
+ False
+ False
+ RadiusSFAdj
+
+
+
+ 1
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ ●
+ 5
+ 0
+ False
+ False
+ RadiusToolAdj
+
+
+
+ 1
+ 0
+
+
+
+
+ Set Tool
+ radius.toolchange
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ 0
+ 0
+
+
+
+
+ True
+ False
+ center
+ Speed
+ 1
+
+
+ 0
+ 1
+
+
+
+
+ Coolant
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+
+
+
+
+
+
+
+ 11
+
+
+
+
+ Radius
+ 3
+ False
+
+
+
+
+ True
+ False
+ Radius
+
+
+ 3
+ False
+
+
+
+
+ True
+ False
+
+
+ True
+ False
+ gtk-missing-image
+
+
+ -1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--202,334-->Chamfer Z position
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ ChamferZAdj
+ 4
+
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1112,287-->Chamfer size
+ start
+ start
+ ●
+ 5
+ 0.0000
+ False
+ False
+ ChamChamAdj
+ 3
+
+
+
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1033,678-->Chamfer Diametric position
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ ChamXAdj
+ 4
+
+
+
+ 2
+
+
+
+
+ 100
+ 40
+ True
+ False
+ <!--335,448-->Back outside chamfer
+ start
+ start
+
+
+ 50
+ 20
+ True
+ True
+ False
+ <!--335,448-->Chamfer Z position
+ True
+ True
+
+
+
+
+ 3
+
+
+
+
+ 100
+ 40
+ True
+ False
+ <!--763,680-->Front Outside Chamfer
+ start
+ start
+
+
+ 50
+ 20
+ True
+ True
+ False
+ True
+ chamfer.bo
+
+
+
+
+ 4
+
+
+
+
+ 100
+ 40
+ True
+ False
+ <!--863,629-->Front Inside Chamfer
+ start
+ start
+
+
+ 50
+ 16
+ True
+ True
+ False
+ 0
+ True
+ chamfer.bo
+
+
+
+
+ 5
+
+
+
+
+ 100
+ 40
+ True
+ False
+ end
+ end
+
+
+ False
+ chamfer.go
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-media-play
+
+
+
+
+
+
+ 10
+
+
+
+
+ True
+ False
+ end
+ start
+
+
+ True
+ False
+ center
+ Speed
+ 1
+
+
+ 0
+ 1
+
+
+
+
+ Coolant
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+
+
+
+
+ Set Tool
+ False
+ chamfer.toolchange
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ 0
+ 0
+
+
+
+
+ 50
+ 20
+ True
+ True
+ start
+ start
+ ●
+ 5
+ 0
+ False
+ False
+ ChamferSFAdj
+
+
+
+ 1
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ start
+ start
+ ●
+ 0
+ False
+ False
+ ChamferToolAdj
+
+
+
+ 1
+ 0
+
+
+
+
+
+
+
+ 11
+
+
+
+
+ Chamfer
+ 4
+ False
+
+
+
+
+ True
+ False
+ Chamfer
+
+
+ 4
+ False
+
+
+
+
+ True
+ False
+
+
+ True
+ False
+ gtk-missing-image
+
+
+ -1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--268,341-->Finish Z position
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ ThreadZAdj
+ 4
+
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1010,753-->Radius Z position
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ ThreadXAdj
+ 4
+
+
+
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ False
+ <!--652,737-->External Thread
+ start
+ start
+
+
+ True
+ True
+ False
+ True
+ True
+
+
+
+
+ 2
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--192,616-->Radius Z position
+ start
+ start
+ ●
+ 7
+ 0.0000
+ False
+ False
+ ThreadPitchAdj
+ 4
+
+
+
+ 4
+
+
+
+
+ 50
+ 20
+ True
+ False
+ <!--754,603-->Internal Thread
+ start
+ start
+
+
+ True
+ True
+ False
+ True
+ thread.external
+
+
+
+
+ 6
+
+
+
+
+ 50
+ 20
+ True
+ False
+ end
+ end
+
+
+ False
+ thread.go
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-media-play
+
+
+
+
+
+
+ 7
+
+
+
+
+ True
+ False
+ end
+ start
+
+
+ True
+ False
+ center
+ Speed
+ 1
+
+
+ 0
+ 1
+
+
+
+
+ Coolant
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+
+
+
+
+ 50
+ 20
+ True
+ True
+ start
+ start
+ ●
+ 5
+ 20
+ False
+ False
+ ThreadSFAdj
+ 20
+
+
+
+ 1
+ 1
+
+
+
+
+ Set Tool
+ False
+ thread.toolchange
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ 0
+ 0
+
+
+
+
+ 50
+ 20
+ True
+ True
+ start
+ start
+ ●
+ 0
+ False
+ False
+ ThreadToolAdj
+
+
+
+ 1
+ 0
+
+
+
+
+
+
+
+ 9
+
+
+
+
+ 5
+ False
+
+
+
+
+ True
+ False
+ Thread
+
+
+ 5
+ False
+
+
+
+
+ True
+ False
+
+
+ True
+ False
+ gtk-missing-image
+
+
+ -1
+
+
+
+
+ 100
+ 40
+ True
+ False
+ end
+ end
+
+
+ False
+ groove.go
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-media-play
+
+
+
+
+
+
+ 4
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1084,672-->Finish Diameter
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ GrooveXAdj
+ 4
+
+
+
+ 5
+
+
+
+
+ True
+ False
+ end
+ start
+
+
+ 50
+ 20
+ True
+ True
+ ●
+ 0
+ False
+ False
+ GrooveToolAdj
+
+
+
+ 1
+ 0
+
+
+
+
+ Set Tool
+ groove.toolchange
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ 0
+ 0
+
+
+
+
+ True
+ False
+ center
+ Speed
+ 1
+
+
+ 0
+ 1
+
+
+
+
+ Coolant
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+
+
+
+
+ 50
+ 20
+ True
+ True
+ end
+ start
+ ●
+ 5
+ 20
+ False
+ False
+ GrooveSFAdj
+ 20
+
+
+
+ 1
+ 1
+
+
+
+
+
+
+
+ 8
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--648,864-->Feed per rev
+ start
+ start
+ ●
+ 5
+ 0.0000
+ False
+ False
+ GrooveFeedAdj
+ 3
+
+
+
+ 4
+
+
+
+
+ 6
+
+
+
+
+ True
+ False
+ Groove
+
+
+ 6
+ False
+
+
+
+
+ True
+ False
+
+
+ True
+ False
+ gtk-missing-image
+
+
+ -1
+
+
+
+
+ 100
+ 40
+ True
+ False
+ end
+ end
+
+
+ False
+ drill.go
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-media-play
+
+
+
+
+
+
+ 3
+
+
+
+
+ True
+ False
+ end
+ start
+
+
+ 50
+ 20
+ True
+ True
+ end
+ start
+ ●
+ 5
+ 0
+ False
+ False
+ DrillSFAdj
+
+
+
+ 1
+ 1
+
+
+
+
+ 50
+ 20
+ True
+ True
+ ●
+ 0
+ False
+ False
+ DrillToolAdj
+
+
+
+ 1
+ 0
+
+
+
+
+ Set Tool
+ drill.toolchange
+ 50
+ 20
+ True
+ True
+ True
+ True
+
+
+ 0
+ 0
+
+
+
+
+ True
+ False
+ center
+ Speed
+ 1
+
+
+ 0
+ 1
+
+
+
+
+ Coolant
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+
+
+
+
+
+
+
+ 3
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--770,900-->Feed per Rev
+ start
+ start
+ ●
+ 5
+ 0.0000
+ False
+ False
+ DrillFeedAdj
+ 3
+
+
+
+ 2
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--260,250-->Finish Z
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ DrillZAdj
+ 4
+
+
+
+ 3
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--1200,270-->Drill Diameter
+ start
+ start
+ ●
+ 7
+ 0.000
+ False
+ False
+ DrillDiaAdj
+ 4
+
+
+
+ 4
+
+
+
+
+ 50
+ 20
+ True
+ True
+ <!--300,711-->Peck distance
+ start
+ start
+ ●
+ 5
+ 0.000
+ False
+ False
+ DrillPeckAdj
+ 0.25
+ 3
+ 2
+
+
+
+ 5
+
+
+
+
+ 7
+
+
+
+
+ True
+ False
+ Drill
+
+
+ 7
+ False
+
+
+
+
+
+
+
+
diff --git a/linuxcnc/Turner.2ms/linuxcnc.var b/linuxcnc/Turner.2ms/linuxcnc.var
new file mode 100644
index 0000000..7afb217
--- /dev/null
+++ b/linuxcnc/Turner.2ms/linuxcnc.var
@@ -0,0 +1,119 @@
+5161 0.000000
+5162 0.000000
+5163 0.000000
+5164 0.000000
+5165 0.000000
+5166 0.000000
+5167 0.000000
+5168 0.000000
+5169 0.000000
+5181 0.000000
+5182 0.000000
+5183 0.000000
+5184 0.000000
+5185 0.000000
+5186 0.000000
+5187 0.000000
+5188 0.000000
+5189 0.000000
+5210 0.000000
+5211 0.000000
+5212 0.000000
+5213 0.000000
+5214 0.000000
+5215 0.000000
+5216 0.000000
+5217 0.000000
+5218 0.000000
+5219 0.000000
+5220 1.000000
+5221 0.000000
+5222 0.000000
+5223 -138.733334
+5224 0.000000
+5225 0.000000
+5226 0.000000
+5227 0.000000
+5228 0.000000
+5229 0.000000
+5230 0.000000
+5241 0.000000
+5242 0.000000
+5243 0.000000
+5244 0.000000
+5245 0.000000
+5246 0.000000
+5247 0.000000
+5248 0.000000
+5249 0.000000
+5250 0.000000
+5261 0.000000
+5262 0.000000
+5263 0.000000
+5264 0.000000
+5265 0.000000
+5266 0.000000
+5267 0.000000
+5268 0.000000
+5269 0.000000
+5270 0.000000
+5281 0.000000
+5282 0.000000
+5283 0.000000
+5284 0.000000
+5285 0.000000
+5286 0.000000
+5287 0.000000
+5288 0.000000
+5289 0.000000
+5290 0.000000
+5301 0.000000
+5302 0.000000
+5303 0.000000
+5304 0.000000
+5305 0.000000
+5306 0.000000
+5307 0.000000
+5308 0.000000
+5309 0.000000
+5310 0.000000
+5321 0.000000
+5322 0.000000
+5323 0.000000
+5324 0.000000
+5325 0.000000
+5326 0.000000
+5327 0.000000
+5328 0.000000
+5329 0.000000
+5330 0.000000
+5341 0.000000
+5342 0.000000
+5343 0.000000
+5344 0.000000
+5345 0.000000
+5346 0.000000
+5347 0.000000
+5348 0.000000
+5349 0.000000
+5350 0.000000
+5361 0.000000
+5362 0.000000
+5363 0.000000
+5364 0.000000
+5365 0.000000
+5366 0.000000
+5367 0.000000
+5368 0.000000
+5369 0.000000
+5370 0.000000
+5381 0.000000
+5382 0.000000
+5383 0.000000
+5384 0.000000
+5385 0.000000
+5386 0.000000
+5387 0.000000
+5388 0.000000
+5389 0.000000
+5390 0.000000
diff --git a/linuxcnc/Turner.2ms/linuxcnc.var.bak b/linuxcnc/Turner.2ms/linuxcnc.var.bak
new file mode 100644
index 0000000..7afb217
--- /dev/null
+++ b/linuxcnc/Turner.2ms/linuxcnc.var.bak
@@ -0,0 +1,119 @@
+5161 0.000000
+5162 0.000000
+5163 0.000000
+5164 0.000000
+5165 0.000000
+5166 0.000000
+5167 0.000000
+5168 0.000000
+5169 0.000000
+5181 0.000000
+5182 0.000000
+5183 0.000000
+5184 0.000000
+5185 0.000000
+5186 0.000000
+5187 0.000000
+5188 0.000000
+5189 0.000000
+5210 0.000000
+5211 0.000000
+5212 0.000000
+5213 0.000000
+5214 0.000000
+5215 0.000000
+5216 0.000000
+5217 0.000000
+5218 0.000000
+5219 0.000000
+5220 1.000000
+5221 0.000000
+5222 0.000000
+5223 -138.733334
+5224 0.000000
+5225 0.000000
+5226 0.000000
+5227 0.000000
+5228 0.000000
+5229 0.000000
+5230 0.000000
+5241 0.000000
+5242 0.000000
+5243 0.000000
+5244 0.000000
+5245 0.000000
+5246 0.000000
+5247 0.000000
+5248 0.000000
+5249 0.000000
+5250 0.000000
+5261 0.000000
+5262 0.000000
+5263 0.000000
+5264 0.000000
+5265 0.000000
+5266 0.000000
+5267 0.000000
+5268 0.000000
+5269 0.000000
+5270 0.000000
+5281 0.000000
+5282 0.000000
+5283 0.000000
+5284 0.000000
+5285 0.000000
+5286 0.000000
+5287 0.000000
+5288 0.000000
+5289 0.000000
+5290 0.000000
+5301 0.000000
+5302 0.000000
+5303 0.000000
+5304 0.000000
+5305 0.000000
+5306 0.000000
+5307 0.000000
+5308 0.000000
+5309 0.000000
+5310 0.000000
+5321 0.000000
+5322 0.000000
+5323 0.000000
+5324 0.000000
+5325 0.000000
+5326 0.000000
+5327 0.000000
+5328 0.000000
+5329 0.000000
+5330 0.000000
+5341 0.000000
+5342 0.000000
+5343 0.000000
+5344 0.000000
+5345 0.000000
+5346 0.000000
+5347 0.000000
+5348 0.000000
+5349 0.000000
+5350 0.000000
+5361 0.000000
+5362 0.000000
+5363 0.000000
+5364 0.000000
+5365 0.000000
+5366 0.000000
+5367 0.000000
+5368 0.000000
+5369 0.000000
+5370 0.000000
+5381 0.000000
+5382 0.000000
+5383 0.000000
+5384 0.000000
+5385 0.000000
+5386 0.000000
+5387 0.000000
+5388 0.000000
+5389 0.000000
+5390 0.000000
diff --git a/linuxcnc/Turner.2ms/metalmusings_encoder.comp b/linuxcnc/Turner.2ms/metalmusings_encoder.comp
new file mode 100644
index 0000000..80c146e
--- /dev/null
+++ b/linuxcnc/Turner.2ms/metalmusings_encoder.comp
@@ -0,0 +1,14 @@
+component metalmusings_encoder;
+pin io bit index-c-enable;
+pin in u32 index-status;
+pin out u32 index-latch-enable;
+
+function _;
+license "GPL";
+;;
+
+//main function
+FUNCTION(_) {
+ index_latch_enable = index_c_enable;
+ index_c_enable = index_status;
+}
diff --git a/linuxcnc/Turner.2ms/nc_files/M101 b/linuxcnc/Turner.2ms/nc_files/M101
new file mode 100755
index 0000000..db40680
--- /dev/null
+++ b/linuxcnc/Turner.2ms/nc_files/M101
@@ -0,0 +1,6 @@
+#!/bin/bash
+R=0.1923
+MAXRPM=380
+halcmd setp scale.0.gain $R
+halcmd setp scale.1.gain $(echo "scale=5;1.0 / $R"| bc -q)
+exit 0
diff --git a/linuxcnc/Turner.2ms/nc_files/M102 b/linuxcnc/Turner.2ms/nc_files/M102
new file mode 100755
index 0000000..a846012
--- /dev/null
+++ b/linuxcnc/Turner.2ms/nc_files/M102
@@ -0,0 +1,6 @@
+#!/bin/bash
+R=0.3189
+MAXRPM=630
+halcmd setp scale.0.gain $R
+halcmd setp scale.1.gain $(echo "scale=5;1.0 / $R"| bc -q)
+exit 0
diff --git a/linuxcnc/Turner.2ms/nc_files/M103 b/linuxcnc/Turner.2ms/nc_files/M103
new file mode 100755
index 0000000..7789473
--- /dev/null
+++ b/linuxcnc/Turner.2ms/nc_files/M103
@@ -0,0 +1,6 @@
+#!/bin/bash
+R=0.4638
+MAXRPM=920
+halcmd setp scale.0.gain $R
+halcmd setp scale.1.gain $(echo "scale=5;1.0 / $R"| bc -q)
+exit 0
diff --git a/linuxcnc/Turner.2ms/nc_files/M104 b/linuxcnc/Turner.2ms/nc_files/M104
new file mode 100755
index 0000000..ab7f331
--- /dev/null
+++ b/linuxcnc/Turner.2ms/nc_files/M104
@@ -0,0 +1,6 @@
+#!/bin/bash
+R=0.8846
+MAXRPM=1770
+halcmd setp scale.0.gain $R
+halcmd setp scale.1.gain $(echo "scale=5;1.0 / $R"| bc -q)
+exit 0
diff --git a/linuxcnc/Turner.2ms/nc_files/M105 b/linuxcnc/Turner.2ms/nc_files/M105
new file mode 100755
index 0000000..d9c332f
--- /dev/null
+++ b/linuxcnc/Turner.2ms/nc_files/M105
@@ -0,0 +1,6 @@
+#!/bin/bash
+R=1.4672
+MAXRPM=2930
+halcmd setp scale.0.gain $R
+halcmd setp scale.1.gain $(echo "scale=5;1.0 / $R"| bc -q)
+exit 0
diff --git a/linuxcnc/Turner.2ms/nc_files/M106 b/linuxcnc/Turner.2ms/nc_files/M106
new file mode 100755
index 0000000..c53798f
--- /dev/null
+++ b/linuxcnc/Turner.2ms/nc_files/M106
@@ -0,0 +1,6 @@
+#!/bin/bash
+R=2.1334
+MAXRPM=4260
+halcmd setp scale.0.gain $R
+halcmd setp scale.1.gain $(echo "scale=5;1.0 / $R"| bc -q)
+exit 0
diff --git a/linuxcnc/Turner.2ms/nc_files/M111 b/linuxcnc/Turner.2ms/nc_files/M111
new file mode 100755
index 0000000..b2bf19f
--- /dev/null
+++ b/linuxcnc/Turner.2ms/nc_files/M111
@@ -0,0 +1,10 @@
+%
+(1)
+#1 = 0
+o100 while [#1 LT 10]
+G0 X-200 Z-200
+G0 X200 Z200
+#1 = [#1+1]
+o100 endwhile
+M2
+%
diff --git a/linuxcnc/Turner.2ms/position.txt b/linuxcnc/Turner.2ms/position.txt
new file mode 100644
index 0000000..f4dfc40
--- /dev/null
+++ b/linuxcnc/Turner.2ms/position.txt
@@ -0,0 +1,16 @@
+0.55999995357589616
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
+0.00000000000000000
diff --git a/linuxcnc/Turner.2ms/postgui_call_list.hal b/linuxcnc/Turner.2ms/postgui_call_list.hal
new file mode 100644
index 0000000..c048069
--- /dev/null
+++ b/linuxcnc/Turner.2ms/postgui_call_list.hal
@@ -0,0 +1,3 @@
+# These files are loaded post GUI, in the order they appear
+
+source custom_postgui.hal
diff --git a/linuxcnc/Turner.2ms/radius.ngc b/linuxcnc/Turner.2ms/radius.ngc
new file mode 100644
index 0000000..4ba6e52
--- /dev/null
+++ b/linuxcnc/Turner.2ms/radius.ngc
@@ -0,0 +1,76 @@
+;radius
+
+O sub
+
+G8 ; Lathe radius Mode
+G18 ; XZ Plane
+G21 ; Metric Units
+G90 ; Absolute Distance
+
+
+M6 T#6 G43
+
+#1 = [#1 / 2] ; because of radius mode
+#14 = [#<_x>] (starting X)
+#13 = [#<_z>] (starting Z)
+
+G96 D2400 S#2 ; Constant Surface Speed Mode
+M3
+g95 F0.1 ; Feed-Per-Rev Mode
+
+O90 IF [#12 GT 0.5]
+ M8
+O90 ENDIF
+
+#20 = 0
+O101 if [#9 GT 0.5] ; Front outside
+ o100 while [[#20 + #3] lt #8]
+ #20 = [#20 + #3]
+ g0 x[#1 - #20] z#13
+ g1 z#5
+ g3 x#1 z[#5 - #20] K[-#20]
+ g1 x #14
+ g0 z#13
+ o100 endwhile
+ g0 x#14 z#13
+ g0 x[#1 - #8]
+ g1 z#5
+ g3 x#1 z[#5 - #8] K[-#8]
+ g1 x #14
+ g0 z#13
+O101 elseif [#10 GT 0.5] ; front inside
+ o102 while [[#20 + #3] lt #8]
+ #20 = [#20 + #3]
+ g0 x[#1 + #20] z#13
+ g1 z#5
+ g2 x#1 z[#5 - #20] K[-#20]
+ g1 x #14
+ g0 z#13
+ o102 endwhile
+ g0 x#14 z#13
+ g0 x[#1 + #8]
+ g1 z#5
+ g2 x#1 z[#5 - #8] K[-#8]
+ g1 x #14
+ g0 z#13
+O101 elseif [#11 GT 0.5] ; back outside
+ o103 while [[#20 + #3] lt #8]
+ #20 = [#20 + #3]
+ g0 x[#1 - #20] z#13
+ g1 z#5
+ g2 x#1 z[#5 + #20] K#20
+ g1 x #14
+ g0 z#13
+ o103 endwhile
+ g0 x#14 z#13
+ g0 x[#1 - #8]
+ g1 z#5
+ g2 x#1 z[#5 + #8] K#8
+ g1 x #14
+ g0 z#13
+O101 endif
+M5 M9
+G7
+O endsub
+m2
+%
diff --git a/linuxcnc/Turner.2ms/savestate.sav b/linuxcnc/Turner.2ms/savestate.sav
new file mode 100644
index 0000000..55ca705
--- /dev/null
+++ b/linuxcnc/Turner.2ms/savestate.sav
@@ -0,0 +1,71 @@
+# generated by gladevcp.persistence.create_default_ini() on Tue Jul 12 01:49:47 2022
+[ini]
+ signature = a9fe768b61bb9201e86d89ad226616650f20e7ac
+ version = 1
+[vars]
+[widgets]
+ chamfer.fi = False
+ chamfer.fo = False
+ turn.rad = 3.0
+ groove.coolant = True
+ turn.z = 120.0
+ turn.x = 15.0
+ drill.dia = 10.0
+ radius.x = 0.0
+ radius.z = 0.0
+ thread.pitch = 1.0
+ turn.feed = 0.15
+ thread.x = 6.0
+ bore.rad = 0.0
+ radius.coolant = False
+ radius.bo = False
+ thread.z = 0.0
+ face.coolant = False
+ drill.peck = 2.0
+ face.cut = 2.8999999999999977
+ radius.rad = 1.0
+ thread.internal = False
+ face.sf = 0.0
+ bore.sf = 100.0
+ turn.tool = 1.0
+ face.feed = 0.15
+ chamfer.tool = 1.0
+ chamfer.bo = True
+ groove.sf = 100.0
+ thread.tool = 5.0
+ groove.feed = 0.03
+ bore.feed = 0.15
+ radius.sf = 100.0
+ chamfer.x = 0.0
+ chamfer.z = 0.0
+ thread.external = True
+ turn.coolant = True
+ face.z = 0.0
+ bore.x = 0.0
+ bore.z = 0.0
+ groove.x = 0.0
+ face.tool = 1.0
+ face.x = 0.0
+ chamfer.size = 1.0
+ turn.cut = 1.0
+ drill.coolant = True
+ chamfer.sf = 100.0
+ bore.tool = 1.0
+ groove.tool = 4.0
+ face.angle = 0.0
+ bore.coolant = True
+ drill.feed = 0.020000000000000004
+ drill.z = 0.0
+ turn.sf = 60.0
+ thread.sf = 60.0
+ radius.fo = False
+ turn.angle = 0.0
+ thread.coolant = False
+ bore.cut = 1.0
+ radius.fi = True
+ drill.tool = 3.0
+ drill.sf = 100.0
+ radius.tool = 1.0
+ bore.angle = 0.0
+ chamfer.coolant = False
+# last update by gladevcp.persistence.save_state() on Wed Mar 20 16:28:06 2024
diff --git a/linuxcnc/Turner.2ms/shutdown.hal b/linuxcnc/Turner.2ms/shutdown.hal
new file mode 100644
index 0000000..8766c9e
--- /dev/null
+++ b/linuxcnc/Turner.2ms/shutdown.hal
@@ -0,0 +1,2 @@
+# Include your shutdown HAL commands here
+# This file will not be overwritten when you run PNCconf again
diff --git a/linuxcnc/Turner.2ms/sim.var b/linuxcnc/Turner.2ms/sim.var
new file mode 100644
index 0000000..1776377
--- /dev/null
+++ b/linuxcnc/Turner.2ms/sim.var
@@ -0,0 +1,119 @@
+5161 0.000000
+5162 0.000000
+5163 0.000000
+5164 0.000000
+5165 0.000000
+5166 0.000000
+5167 0.000000
+5168 0.000000
+5169 0.000000
+5181 0.000000
+5182 0.000000
+5183 0.000000
+5184 0.000000
+5185 0.000000
+5186 0.000000
+5187 0.000000
+5188 0.000000
+5189 0.000000
+5210 0.000000
+5211 0.000000
+5212 0.000000
+5213 0.000000
+5214 0.000000
+5215 0.000000
+5216 0.000000
+5217 0.000000
+5218 0.000000
+5219 0.000000
+5220 1.000000
+5221 0.000000
+5222 0.000000
+5223 0.000000
+5224 0.000000
+5225 0.000000
+5226 0.000000
+5227 0.000000
+5228 0.000000
+5229 0.000000
+5230 0.000000
+5241 0.000000
+5242 0.000000
+5243 0.000000
+5244 0.000000
+5245 0.000000
+5246 0.000000
+5247 0.000000
+5248 0.000000
+5249 0.000000
+5250 0.000000
+5261 0.000000
+5262 0.000000
+5263 0.000000
+5264 0.000000
+5265 0.000000
+5266 0.000000
+5267 0.000000
+5268 0.000000
+5269 0.000000
+5270 0.000000
+5281 0.000000
+5282 0.000000
+5283 0.000000
+5284 0.000000
+5285 0.000000
+5286 0.000000
+5287 0.000000
+5288 0.000000
+5289 0.000000
+5290 0.000000
+5301 0.000000
+5302 0.000000
+5303 0.000000
+5304 0.000000
+5305 0.000000
+5306 0.000000
+5307 0.000000
+5308 0.000000
+5309 0.000000
+5310 0.000000
+5321 0.000000
+5322 0.000000
+5323 0.000000
+5324 0.000000
+5325 0.000000
+5326 0.000000
+5327 0.000000
+5328 0.000000
+5329 0.000000
+5330 0.000000
+5341 0.000000
+5342 0.000000
+5343 0.000000
+5344 0.000000
+5345 0.000000
+5346 0.000000
+5347 0.000000
+5348 0.000000
+5349 0.000000
+5350 0.000000
+5361 0.000000
+5362 0.000000
+5363 0.000000
+5364 0.000000
+5365 0.000000
+5366 0.000000
+5367 0.000000
+5368 0.000000
+5369 0.000000
+5370 0.000000
+5381 0.000000
+5382 0.000000
+5383 0.000000
+5384 0.000000
+5385 0.000000
+5386 0.000000
+5387 0.000000
+5388 0.000000
+5389 0.000000
+5390 0.000000
diff --git a/linuxcnc/Turner.2ms/sim.var.bak b/linuxcnc/Turner.2ms/sim.var.bak
new file mode 100644
index 0000000..1776377
--- /dev/null
+++ b/linuxcnc/Turner.2ms/sim.var.bak
@@ -0,0 +1,119 @@
+5161 0.000000
+5162 0.000000
+5163 0.000000
+5164 0.000000
+5165 0.000000
+5166 0.000000
+5167 0.000000
+5168 0.000000
+5169 0.000000
+5181 0.000000
+5182 0.000000
+5183 0.000000
+5184 0.000000
+5185 0.000000
+5186 0.000000
+5187 0.000000
+5188 0.000000
+5189 0.000000
+5210 0.000000
+5211 0.000000
+5212 0.000000
+5213 0.000000
+5214 0.000000
+5215 0.000000
+5216 0.000000
+5217 0.000000
+5218 0.000000
+5219 0.000000
+5220 1.000000
+5221 0.000000
+5222 0.000000
+5223 0.000000
+5224 0.000000
+5225 0.000000
+5226 0.000000
+5227 0.000000
+5228 0.000000
+5229 0.000000
+5230 0.000000
+5241 0.000000
+5242 0.000000
+5243 0.000000
+5244 0.000000
+5245 0.000000
+5246 0.000000
+5247 0.000000
+5248 0.000000
+5249 0.000000
+5250 0.000000
+5261 0.000000
+5262 0.000000
+5263 0.000000
+5264 0.000000
+5265 0.000000
+5266 0.000000
+5267 0.000000
+5268 0.000000
+5269 0.000000
+5270 0.000000
+5281 0.000000
+5282 0.000000
+5283 0.000000
+5284 0.000000
+5285 0.000000
+5286 0.000000
+5287 0.000000
+5288 0.000000
+5289 0.000000
+5290 0.000000
+5301 0.000000
+5302 0.000000
+5303 0.000000
+5304 0.000000
+5305 0.000000
+5306 0.000000
+5307 0.000000
+5308 0.000000
+5309 0.000000
+5310 0.000000
+5321 0.000000
+5322 0.000000
+5323 0.000000
+5324 0.000000
+5325 0.000000
+5326 0.000000
+5327 0.000000
+5328 0.000000
+5329 0.000000
+5330 0.000000
+5341 0.000000
+5342 0.000000
+5343 0.000000
+5344 0.000000
+5345 0.000000
+5346 0.000000
+5347 0.000000
+5348 0.000000
+5349 0.000000
+5350 0.000000
+5361 0.000000
+5362 0.000000
+5363 0.000000
+5364 0.000000
+5365 0.000000
+5366 0.000000
+5367 0.000000
+5368 0.000000
+5369 0.000000
+5370 0.000000
+5381 0.000000
+5382 0.000000
+5383 0.000000
+5384 0.000000
+5385 0.000000
+5386 0.000000
+5387 0.000000
+5388 0.000000
+5389 0.000000
+5390 0.000000
diff --git a/linuxcnc/Turner.2ms/simulated_home_lathe.hal b/linuxcnc/Turner.2ms/simulated_home_lathe.hal
new file mode 100644
index 0000000..24410d8
--- /dev/null
+++ b/linuxcnc/Turner.2ms/simulated_home_lathe.hal
@@ -0,0 +1,21 @@
+loadrt comp names=comp_x,comp_z
+
+addf comp_x servo-thread
+addf comp_z servo-thread
+
+net Xhomeswpos => comp_x.in0
+net Zhomeswpos => comp_z.in0
+
+sets Xhomeswpos 1
+sets Zhomeswpos 2
+
+net Xpos => comp_x.in1
+net Zpos => comp_z.in1
+
+setp comp_x.hyst .02
+setp comp_z.hyst .02
+
+net Xhomesw <= comp_x.out => joint.0.home-sw-in
+net Zhomesw <= comp_z.out => joint.1.home-sw-in
+
+
diff --git a/linuxcnc/Turner.2ms/simulated_home_lathe_CW.hal b/linuxcnc/Turner.2ms/simulated_home_lathe_CW.hal
new file mode 100644
index 0000000..24410d8
--- /dev/null
+++ b/linuxcnc/Turner.2ms/simulated_home_lathe_CW.hal
@@ -0,0 +1,21 @@
+loadrt comp names=comp_x,comp_z
+
+addf comp_x servo-thread
+addf comp_z servo-thread
+
+net Xhomeswpos => comp_x.in0
+net Zhomeswpos => comp_z.in0
+
+sets Xhomeswpos 1
+sets Zhomeswpos 2
+
+net Xpos => comp_x.in1
+net Zpos => comp_z.in1
+
+setp comp_x.hyst .02
+setp comp_z.hyst .02
+
+net Xhomesw <= comp_x.out => joint.0.home-sw-in
+net Zhomesw <= comp_z.out => joint.1.home-sw-in
+
+
diff --git a/linuxcnc/Turner.2ms/spindle_sim.hal b/linuxcnc/Turner.2ms/spindle_sim.hal
new file mode 100644
index 0000000..7b97c3d
--- /dev/null
+++ b/linuxcnc/Turner.2ms/spindle_sim.hal
@@ -0,0 +1,69 @@
+# counting the spindle encoder in software
+loadrt encoder names=encoder_0
+# simulate the encoder
+loadrt sim_encoder names=sim_encoder_0
+loadrt limit2 names=limit_speed
+
+addf limit_speed servo-thread
+
+#######################################################
+# Beginning of threading related stuff
+#######################################################
+
+# spindle speed control
+net spindle-speed-cmd spindle.0.speed-out => limit_speed.in
+net spindle-speed-limited limit_speed.out => sim_encoder_0.speed
+
+# simulate spindle mass
+setp limit_speed.maxv 3000.0 # rpm/second
+
+# spindle encoder
+# connect encoder signals to encoder counter
+net spindle-phase-A sim_encoder_0.phase-A => encoder_0.phase-A
+net spindle-phase-B sim_encoder_0.phase-B => encoder_0.phase-B
+net spindle-phase-Z sim_encoder_0.phase-Z => encoder_0.phase-Z
+
+# assume 120 ppr = 480 counts/rev for the spindle
+setp sim_encoder_0.ppr 12
+# iocontrol output is in rpm, but sim-encoder speed is rps
+setp sim_encoder_0.scale 60
+# scale encoder output to read in revolutions
+# (that way thread pitches can be straightforward,
+# a 20 tpi thread would multiply the encoder output
+# by 1/20, etc)
+setp encoder_0.position-scale 48
+
+# encoder reset control
+# hook up motion controller's sync output
+net spindle-index-enable spindle.0.index-enable <=> encoder_0.index-enable
+
+# report our revolution count to the motion controller
+net spindle-pos encoder_0.position => spindle.0.revs
+
+# for spindle velocity estimate
+loadrt lowpass names=lowpass_velocity
+loadrt scale names=scale_to_rpm
+net spindle-rps-raw encoder_0.velocity lowpass_velocity.in
+net spindle-rps-filtered lowpass_velocity.out scale_to_rpm.in spindle.0.speed-in
+net spindle-rpm-filtered scale_to_rpm.out
+setp scale_to_rpm.gain 60
+setp lowpass_velocity.gain .07
+addf lowpass_velocity servo-thread
+addf scale_to_rpm servo-thread
+
+# for at-speed detection
+loadrt near names=near_speed
+addf near_speed servo-thread
+setp near_speed.scale 1.1
+setp near_speed.difference 10
+net spindle-speed-cmd => near_speed.in1
+net spindle-rpm-filtered => near_speed.in2
+net spindle-at-speed near_speed.out spindle.0.at-speed
+
+net spindle-fwd <= spindle.0.forward
+
+addf encoder.capture-position servo-thread
+addf sim-encoder.update-speed servo-thread
+
+addf sim-encoder.make-pulses base-thread
+addf encoder.update-counters base-thread
diff --git a/linuxcnc/Turner.2ms/threading.ngc b/linuxcnc/Turner.2ms/threading.ngc
new file mode 100644
index 0000000..71c05ef
--- /dev/null
+++ b/linuxcnc/Turner.2ms/threading.ngc
@@ -0,0 +1,59 @@
+;threading
+
+O sub
+
+G7 ; Lathe Diameter Mode
+G18 ; XZ Plane
+G21 ; Metric Units
+G90 ; Absolute Distance
+
+
+M6 T#3 G43
+
+#14 = [#<_x> * 2] (starting X)
+#13 = #<_z> (starting Z)
+
+G96 D200 S#2 ; Constant Surface Speed Mode
+M3
+g95 F0.25 ; Feed-Per-Rev Mode
+
+O90 IF [#8 GT 0.5]
+ M8
+O90 ENDIF
+
+g4p1 ; Wait to reach speed
+
+;Threading
+ O51 IF [#6 GT 0.5]
+ # = [#1]
+ # = [#1 - 1.3 * #4]
+ ;g1X [# - 1] ;thread truncation
+ ;g0 Z #13
+ ;g1 X #
+ ;g1 Z #5
+ G0 X[# - 1]
+ g0 Z #13
+ #3 = [#4 * 1.3]
+ (debug, INTERNAL Threading thread dia-#1 start-#13 finish-#5 Pitch-#4 Depth-#3)
+ g1X [# - 1]
+ g76 p#4 z#5 i1 j1 k#3 h3 r1.5 q29.5 e0 l0
+
+ O51 ELSE
+ # = [#1 - 0.108 * #4]
+ # = [#1 - 1.0825 * #4]
+ (debug, EXTERNAL Threading OD = # ID = #)
+ #3 = [#4 * 1.0825]
+ g1X [# + 1] ;final thread truncation
+ g0 z#13
+ g1 X #
+ g1 Z #5
+ G0 X[# +1]
+ G0 Z #13
+ g76 p#4 z#5 i-1 j1 k#3 h3 r1.5 q29.5 e0 l0
+
+ O51 ENDIF
+ G0 Z #13
+ m5 M9
+O endsub
+
+M2
diff --git a/linuxcnc/Turner.2ms/tool.tbl b/linuxcnc/Turner.2ms/tool.tbl
new file mode 100644
index 0000000..32d8777
--- /dev/null
+++ b/linuxcnc/Turner.2ms/tool.tbl
@@ -0,0 +1,19 @@
+T1 P1 X0.0 Y0.0 Z0.0 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I0.0 J0.0 Q9.0 ;# rh turning
+T2 P2 X-25.3242 Y0.0 Z15.924 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I80.0 J20.0 Q3.0 ;
+T3 P3 X-15.4825 Y0.0 Z258.6854 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D3.0 I90.0 J90.0 Q6.0 ;
+T4 P4 X-0.5336 Y0.0 Z54.9583 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I87.0 J40.0 Q2.0 ;
+T5 P5 X-15.0582 Y0.0 Z117.9963 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.1 I60.0 J200.0 Q5.0 ;
+T6 P6 X2.6969 Y0.0 Z0.0 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.5 I120.0 J70.0 Q6.0 ;# threading
+T7 P7 X-8.408 Y0.0 Z13.7459 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.8 I107.5 J77.5 Q6.0 ;# vcmt110304
+T8 P8 X-11.16 Y0.0 Z-31.05 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.1 I200.0 J300.0 Q8.0 ;
+T9 P9 X0.0 Y0.0 Z0.0 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.1 I0.0 J0.0 Q9.0 ;
+T10 P10 X-0.07 Y0.0 Z0.0 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I0.0 J0.0 Q9.0 ;
+T11 P11 X-23.0718 Y0.0 Z-3.7292 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I0.0 J0.0 Q9.0 ;
+T12 P12 X-1.8392 Y0.0 Z-3.8279 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I0.0 J0.0 Q9.0 ;
+T13 P13 X-10.8533 Y0.0 Z-6.2652 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I0.0 J0.0 Q9.0 ;
+T14 P14 X0.0 Y0.0 Z0.0 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I300.0 J200.0 Q4.0 ;
+T15 P15 X0.0 Y0.0 Z0.0 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I200.0 J200.0 Q5.0 ;
+T16 P16 X-15.13 Y0.0 Z14.91 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I100.0 J60.0 Q6.0 ;
+T17 P17 X-15.14 Y0.0 Z5.992 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I-30.0 J30.0 Q7.0 ;
+T18 P18 X0.0 Y0.0 Z0.0 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I200.0 J300.0 Q8.0 ;
+T19 P19 X29.7817 Y0.0 Z-21.8231 A0.0 B0.0 C0.0 U0.0 V0.0 W0.0 D0.0 I0.0 J0.0 Q9.0 ;
diff --git a/linuxcnc/Turner.2ms/turning.ngc b/linuxcnc/Turner.2ms/turning.ngc
new file mode 100644
index 0000000..8dc3ec0
--- /dev/null
+++ b/linuxcnc/Turner.2ms/turning.ngc
@@ -0,0 +1,66 @@
+;Turning
+
+O sub
+
+G8 ; Radius mode (easier maths)
+G18 ; XZ Plane
+G21 ; Metric Units
+G90 ; Absolute Distance
+G91.1 ; but not for arcs
+
+M6 T#8 G43
+
+#1 = [#1 / 2] ; because of radius mode
+#14 = [#<_x>] (starting X)
+#13 = #<_z> (starting Z)
+
+#20 = [#6 * SIN[#7]]
+#21 = [#6 * COS[#7]]
+#22 = [#6 / COS[#7]]
+#23 = [#5 + #6 - #20]
+#24 = [[#13 - #23] * TAN[#7]]
+
+G96 D2500 S#2 ; Constant Surface Speed Mode
+m3 ;Start Spindle
+g95 F#4 ; Feed-Per-Rev Mode
+
+O90 IF [#9 GT 0.5]
+ M8
+O90 ENDIF
+g4p1 ; Wait to reach speed
+
+ O100 WHILE [#14 GT [#1 + #3 / 2]]
+ g0 X #14
+ #14=[#14-#3 / 2]
+ G1 X #14
+ G1 Z #23 X[#14 + #24]
+ O101 IF [#6 GT 0]
+ G2 Z#5 X[#14 + #24 + #21] I#21 K#20
+ G1 X[#14 + #24 + #21 + #3/2]
+ O101 ELSE
+ G1 X[#14 + #24 + [#3 * .6]]
+ O101 ENDIF
+ O104 IF [#7 LT 0]
+ G0 X#14
+ O104 ENDIF
+ G0 Z[#13]
+ O100 ENDWHILE
+
+ G0 x#1
+ G1 Z #23 X[#1 + #24]
+ O102 IF [#6 GT 0]
+ G2 Z#5 X[#1 + #24 + #21] I#21 K#20
+ G1 X[#1 + #24 + #21 + #3]
+ O102 ELSE
+ G1 X[#1 + #24 + #3]
+ O102 ENDIF
+ O106 IF [#7 LT 0]
+ G0 X#14
+ O106 ENDIF
+ M9
+ G0 Z #13
+ G0 X #1 ; For touch-off
+ M5
+ G7
+O endsub
+M2