Import LinuxCNC source tree

This commit is contained in:
Wang Dequan
2026-08-20 06:17:39 +08:00
commit 2c814634c3
9429 changed files with 10556013 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
Sample configurations for remapped codes
This is what the example configs do:
getting-started: introduces defining new codes in NGC procedures and Python
extend-builtins: demonstrates remapping builtins T,M6,M61,S,F. This could be a starting point for your own configuration. Also shows how to refer to the builtin behaviour of codes.
manual-toolchange-with-tool-length-switch: extend M6 so it does a tool length probe after the change.
rack-toolchange: this tries to mimic the racktoolchanger patch - without a patch, but with remapping codes
cycles: a demo how new cycle codes can be created with O-word subroutines or in Python
iocontrol-removed: a 'research part' of the (now merged) remapping branch: It demonstrates removing iocontrol altogether, and replacing it by a Python plugin in task. Other than that, the rack-toolchanger example is used. Also, experimentally use sqlite3 for tooltable storage.
>>>>>>>>>>> Not suggested for production use. <<<<<<<<<<<<<<<<<<<<<<<<
python-stdglue contains embedded Python code supporting the above examples. This should eventually evolve into canned code which users need not touch except in more exotic circumstances. Note all examples above use the same glue code from remap.py.
common_nc_subs: this contains reset_state.ngc, which should be called from ON_ABORT procedure. Note that it is in particular important to reset the modal state after a failed remap procedure because this can lead to subsequent failures (e.g. bug ID 3437928). The demos use their own on_abort sub and call reset_state.
Remapping Documentation:
http://www.linuxcnc.org/docs/devel/html/remap/structure.html
see also:
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?RemappingStatus

View File

@@ -0,0 +1,43 @@
This shows how cycles can be made out of O-word subroutines or directly coded in Python.
# Assume G84.2 is remapped to Python g842 like so in the [RS274NGC] ini section:
# REMAP=G84.2 argspec=xyzqp python=g842 modalgroup=1
#
# then executing
#
# G84.2 x1 y1 (line1)
# x3 y3 (line2)
# y5 (line3)
# ...
#
# will execute like:
# *G84.2 x1 y1
# G84.2 x3 y3
# G84.2 x3 y5
#
# until motion is cleared with G80 or some other motion is executed.
#
# This enables writing cycles in Python, or as Oword procedures; in the
# latter case the self.motion_mode should be set in the Python epilog.
#
And the same thing as an Oword procedure:
# a cycle with an Oword sub
#REMAP=G84.3 modalgroup=1 argspec=xyzqp prolog=g843_prolog ngc=g843 epilog=g843_epilog
The examples only show they parameters they are fed, and dont do anything useful - "you get the idea".
Sticky parameters are handled properly.
Usage:
linuxcnc cycle.ini
hit run and see what happens.
To understand how things fit together:
- see the REMAP statements in cycle.ini
- python/remap.py contains the Python glue
- nc_subroutines/g843.ngc is an example 'cycle body'

View File

@@ -0,0 +1,239 @@
[EMC]
VERSION = 1.1
MACHINE = cycle.ini
DEBUG = 0
[DISPLAY]
DISPLAY = axis
OPEN_FILE=./nc_files/examples.ngc
CYCLE_TIME = 0.100
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
MAX_SPINDLE_OVERRIDE = 1.0
PROGRAM_PREFIX = ../../nc_files/
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
#EDITOR = geany
INCREMENTS = 1 mm, .01 in, .1mm, 1 mil, .1 mil, 1/8000 in
GEOMETRY = XYZBCUVW
[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 = python3
[RS274NGC]
PARAMETER_FILE = sim-9axis.var
SUBROUTINE_PATH = nc_subroutines:../../nc_files/remap_lib/common_nc_subs
LOG_LEVEL = 1
# A cycle in Python: G84.2 <X- Y- Z- Q- P->
REMAP=G84.2 argspec=xyzabcuvwqplr python=g842 modalgroup=1
# A cycle with an oword procedure: G84.3 <X- Y- Z- Q- P->
REMAP=G84.3 argspec=xyzabcuvwqplr prolog=cycle_prolog ngc=g843 epilog=cycle_epilog modalgroup=1
# this is important - read common_nc_subs/reset_state.ngc
ON_ABORT_COMMAND=O <reset_state> call
[EMCMOT]
EMCMOT = motmod unlock_joints_mask=0x10
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[HAL]
HALUI = halui
HALFILE = LIB:basic_sim.tcl
HALFILE = locking_indexer.hal
[TRAJ]
COORDINATES = X Y Z A B C U V W
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.0
DEFAULT_ANGULAR_VELOCITY = 45.0
POSITION_FILE = position9.txt
MAX_LINEAR_VELOCITY = 1.2
MAX_ANGULAR_VELOCITY = 90.0
NO_FORCE_HOMING = 1
[EMCIO]
TOOL_TABLE = tool.tbl
TOOL_CHANGE_POSITION = 0 0 2
[KINS]
KINEMATICS = trivkins
JOINTS = 9
[AXIS_X]
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 5.0
HOME_LATCH_VEL = 1.0
HOME_SEQUENCE = 1
[AXIS_Y]
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 5.0
HOME_LATCH_VEL = 1.0
HOME_SEQUENCE = 1
[AXIS_Z]
MIN_LIMIT = -2.0
MAX_LIMIT = 4.0
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
MIN_LIMIT = -2.0
MAX_LIMIT = 4.0
HOME_OFFSET = 1.0
HOME_SEARCH_VEL = 5.0
HOME_LATCH_VEL = 1.0
HOME_SEQUENCE = 0
[AXIS_A]
MAX_VELOCITY = 90.0
MAX_ACCELERATION = 1200.0
[JOINT_3]
TYPE = ANGULAR
HOME = 0.0
MAX_VELOCITY = 90.0
MAX_ACCELERATION = 1200.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_SEQUENCE = 1
[AXIS_B]
MAX_VELOCITY = 90.0
MAX_ACCELERATION = 1200.0
LOCKING_INDEXER_JOINT = 4
[JOINT_4]
TYPE = ANGULAR
HOME = 0.0
MAX_VELOCITY = 90.0
MAX_ACCELERATION = 1200.0
HOME_OFFSET = 45.0
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_SEQUENCE = 1
LOCKING_INDEXER = 1
[AXIS_C]
MAX_VELOCITY = 90.0
MAX_ACCELERATION = 1200.0
[JOINT_5]
TYPE = ANGULAR
HOME = 0.0
MAX_VELOCITY = 90.0
MAX_ACCELERATION = 1200.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_SEQUENCE = 1
[AXIS_U]
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
[JOINT_6]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_SEQUENCE = 0
[AXIS_V]
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
[JOINT_7]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_SEQUENCE = 0
[AXIS_W]
MIN_LIMIT = -2.0
MAX_LIMIT = 4.0
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
[JOINT_8]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 1.2
MAX_ACCELERATION = 20.0
MIN_LIMIT = -2.0
MAX_LIMIT = 4.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_SEQUENCE = 0
[PYTHON]
# code specific for this configuration
PATH_PREPEND=./python
# generic support code
PATH_APPEND=../../nc_files/remap_lib/python-stdglue
# import the following Python module
TOPLEVEL=python/toplevel.py
# the higher the more verbose tracing of the Python plugin
LOG_LEVEL = 0

View File

@@ -0,0 +1,14 @@
s300 f20
g84.2 x1 y2 z3 q5 r1
x321 y452 p12
z23 x10 q3
g84.3 x1 y2 z3 q5 r2
x321 y452 p12
z23 x10 q3
m2

View File

@@ -0,0 +1,13 @@
o<g843> sub
(debug, in g843 x=#<x> y=#<y> z=#<z> p=#<p> q=#<q>)
O100 if [exists[#<p>] NE 1.]
(debug, the P word was not set)
O100 endif
; signal success be returning a value > 0:
o<g843> endsub [1]
m2

View File

@@ -0,0 +1,79 @@
# This is a component of LinuxCNC
# Copyright 2012, 2013 Dewey Garrett <dgarrett@panix.com>, Michael
# Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from interpreter import *
from emccanon import MESSAGE
from stdglue import cycle_prolog, cycle_epilog, init_stdglue
# This shows how to create a remapped G-code which can be used as a cycle
# written in Python
#
# Example:
# Assume G84.2 is remapped to Python g842 like so in the [RS274NGC] ini section:
# REMAP=G84.2 argspec=xyzqp python=g842 modalgroup=1
#
# then executing
#
# G84.2 x1 y1 (line1)
# x3 y3 (line2)
# y5 (line3)
# ...
#
# will execute like:
# *G84.2 x1 y1
# G84.2 x3 y3
# G84.2 x3 y5
#
# until motion is cleared with G80 or some other motion is executed.
#
# This enables writing cycles in Python, or as Oword procedures; in the
# latter case the self.motion_mode should be set in the Python epilog.
#
# for a more through example of a cycle prolog, see cycle_prolog in stdglue.py
_sticky_params = dict()
def g842(self,**words):
global _sticky_params
firstcall = False
# determine whether this is the first or a subsequent call
c = self.blocks[self.remap_level]
r = c.executing_remap
if c.g_modes[1] == r.motion_code:
# this was the first call.
# clear the dict to remember all sticky parameters.
_sticky_params[r.name] = dict()
text = "*" + r.name
else:
text = r.name
# merge in new parameters
_sticky_params[r.name].update(words)
# insert your cycle actions here
for (key,value) in _sticky_params[r.name].items():
text += "%s%.1f " % (key, value)
MESSAGE(text)
# retain the current motion mode
self.motion_mode = c.executing_remap.motion_code
return INTERP_OK

View File

@@ -0,0 +1,29 @@
# This is a component of LinuxCNC
# Copyright 2011, 2012, 2013 Dewey Garrett <dgarrett@panix.com>,
# Michael Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import remap
import os
def __init__(self):
# handle any per-module initialisation tasks here
remap.init_stdglue(self)
print("interp __init__",self.task,os.getpid())
def __delete__(self):
# handle any per-module shutdown tasks here
print("interp __delete__",self.task,os.getpid())

View File

@@ -0,0 +1,4 @@
T1 P11 D0.125000 Z+0.511000 ;1/8 end mill
T2 P12 D0.062500 Z+0.100000 ;1/16 end mill
T3 P13 D0.201000 Z+1.273000 ;#7 tap drill
T4 P14 D0.345 Z+1.11 ;#random drill

View File

@@ -0,0 +1,24 @@
This shows how the builtin T,M6,M61,S,F codes can be redefined, optionally by referring to the builtin behaviour in the remap procedure.
The collection of prologs and epilogs in python-stdglue is intended to be a boilerplate set of Python glue which covers most use cases. Normally you shouldn't need to touch any of these.
The ngc remap routines in nc_subroutines have been set up to:
show the 'exposed parameters' with a debug statement
refer to the builtin codes within the remap procedure, such that execution effect is the same as not remapping that code (i.e. the remap result is idempotent)
to work with the stdglue prologs and epilogs
'exposed parameters' are local variables in the remap procedure which can be read, and changed - any changes will be picked up by the epilog and used to commit the result
update:
Remapping and extending of M0,M1,M60 added.
See also thread:
http://linuxcnc.org/index.php/english/component/kunena/?func=view&catid=38&id=17637&limit=6#17637
-mah

View File

@@ -0,0 +1,174 @@
[EMC]
VERSION = 1.1
MACHINE = extend-builtins.ini
# Debug level, 0 means no messages. See src/emc/nml_intf/debugflags.h for others
DEBUG = 0
[DISPLAY]
DISPLAY = axis
OPEN_FILE= ./nc_files/examples.ngc
GLADEVCP= -c gladevcp show.ui
CYCLE_TIME = 0.100
HELP_FILE = doc/help.txt
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
MAX_SPINDLE_OVERRIDE = 1.0
MAX_LINEAR_VELOCITY = 1.2
DEFAULT_LINEAR_VELOCITY = .25
PROGRAM_PREFIX = ../../nc_files/
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
#EDITOR = geany
TOOL_EDITOR = tooledit
INCREMENTS = 1 in, 0.1 in, 10 mil, 1 mil, 1mm, .1mm, 1/8000 in
[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 = python3
[RS274NGC]
PARAMETER_FILE = sim.var
SUBROUTINE_PATH = nc_subroutines:../../nc_files/remap_lib/common_nc_subs
LOG_LEVEL = 1
# parameters exposed by prepare_prolog/evaluated by prepare_epilog:
# #<tool>
# #<pocket>
REMAP= T prolog=prepare_prolog ngc=prepare epilog=prepare_epilog
# parameters exposed by change_prolog/evaluated by change_epilog:
# #<tool_in_spindle>
# #<selected_tool>
# #<current_pocket>
# #<selected_pocket>
REMAP= M6 modalgroup=6 prolog=change_prolog ngc=change epilog=change_epilog
# parameters exposed by settool_prolog/evaluated by settool_epilog:
# #<tool>
# #<pocket>
REMAP= M61 modalgroup=6 prolog=settool_prolog ngc=settool epilog=settool_epilog
# alternative for demonstration purposes: 'do it all in Python'
#REMAP= M61 modalgroup=6 python=set_tool_number
# parameters exposed by setspeed_prolog/evaluated by setspeed_epilog:
# #<speed>
REMAP= S prolog=setspeed_prolog ngc=setspeed epilog=setspeed_epilog
# parameters exposed by setfeed_prolog/evaluated by setfeed_epilog:
# #<feed>
REMAP= F prolog=setfeed_prolog ngc=setfeed epilog=setfeed_epilog
REMAP= M0 modalgroup=4 ngc=extend_m0
REMAP= M1 modalgroup=4 ngc=extend_m1
REMAP= M60 modalgroup=4 ngc=extend_m60
REMAP = M7 modalgroup=8 argspec=p ngc=extend_m7
REMAP = M8 modalgroup=8 argspec=p ngc=extend_m8
REMAP = M9 modalgroup=8 argspec=p ngc=extend_m9
# this is important - read common_nc_subs/reset_state.ngc
ON_ABORT_COMMAND= O <reset_state> call
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[HAL]
HALUI = halui
HALFILE = LIB:basic_sim.tcl
POSTGUI_HALFILE = gladevcp.hal
[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.2
POSITION_FILE = position.txt
MAX_LINEAR_VELOCITY = 1.2
NO_FORCE_HOMING = 1
[EMCIO]
TOOL_TABLE = tool.tbl
TOOL_CHANGE_POSITION = 0 0 0
TOOL_CHANGE_QUILL_UP = 1
[KINS]
KINEMATICS = trivkins
JOINTS = 3
[AXIS_X]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 20.0
HOME_LATCH_VEL = 20.0
HOME_SEQUENCE = 1
[AXIS_Y]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 20.0
HOME_LATCH_VEL = 20.0
HOME_SEQUENCE = 1
[AXIS_Z]
MIN_LIMIT = -8.0
MAX_LIMIT = 8.00
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -8.0
MAX_LIMIT = 8.00
HOME_OFFSET = 1.0
HOME_SEARCH_VEL = 20.0
HOME_LATCH_VEL = 20.0
HOME_SEQUENCE = 0
# section for main IO controller parameters -----------------------------------
[PYTHON]
# where to find Python code
# code specific for this configuration
PATH_PREPEND= ./python
# generic support code
PATH_APPEND= ../../nc_files/remap_lib/python-stdglue
# import the following Python module
TOPLEVEL= python/toplevel.py
# the higher the more verbose tracing of the Python plugin
LOG_LEVEL = 1

View File

@@ -0,0 +1,5 @@
net spindle-on spindle.0.on gladevcp.spindle-on
net spindle-speed-cmd spindle.0.speed-out gladevcp.spindle-speed
net mist iocontrol.0.coolant-mist gladevcp.mist
net flood iocontrol.0.coolant-flood gladevcp.flood

View File

@@ -0,0 +1,20 @@
m7 (mist on)
m8 (flood on)
t2
m6
m61q3
s300m3 f50
g1x0.5 y1 (some move)
(debug,before m1)
/m1
(debug,after m1)
x1z0.5 (more random moves)
g0x0y0z0
m2

View File

@@ -0,0 +1,9 @@
o<change> sub
(debug, in change tool_in_spindle=#<tool_in_spindle> current_pocket=#<current_pocket>)
(debug, selected_tool=#<selected_tool> selected_pocket=#<selected_pocket>)
; using the code being remapped here means 'use builtin behaviour'
M6
; signal success be returning a value > 0:
o<change> endsub [1]
m2

View File

@@ -0,0 +1,9 @@
o<extend_m0> sub
(debug, extend_m0:)
m0 (refer to builtin m0)
(debug, extend_m0 done)
o<extend_m0> endsub
m2

View File

@@ -0,0 +1,34 @@
; extend M1 to:
; turn off spindle, flood, mist if optional stop = 1 and block delete is off
;
; on cycle restart:
; turn on spindle
; turn mist on if it was on before the m1
; turn flood on if it was on before the m1
o<extend_m1> sub
(debug, extend_m1:)
; record whether mist/flood were on
#<mist> = #<_mist>
#<flood> = #<_flood>
/M5 M9 ; stop spindle, mist+flood off
/m1 (refer to builtin m1)
; restore mist, flood setting
/o100 if [#<mist>]
/ m7
/o100 endif
/o200 if [#<flood>]
/ m8
/o200 endif
/M3 ; spindle on
(debug, extend_m1 done)
o<extend_m1> endsub
m2

View File

@@ -0,0 +1,9 @@
o<extend_m60> sub
(debug, extend_m60:)
m60 (refer to builtin m60)
(debug, extend_m60 done)
o<extend_m60> endsub
m2

View File

@@ -0,0 +1,12 @@
o<extend_m7> sub
o2 if [#<_task> EQ 1]
o1 if [EXISTS [#<P>]]
(DEBUG,M7 P-word passed: #<P>)
o1 else
(DEBUG,M7 No P-word passed)
o1 endif
m7 (call built-in m7)
(DEBUG, extend_m7 done)
o2 endif
o<extend_m7> endsub
m2

View File

@@ -0,0 +1,12 @@
o<extend_m8> sub
o2 if [#<_task> EQ 1]
o1 if [EXISTS [#<P>]]
(DEBUG,M8 P-word passed: #<P>)
o1 else
(DEBUG,M8 No P-word passed)
o1 endif
m8 (call built-in m8)
(DEBUG, extend_m8 done)
o2 endif
o<extend_m8> endsub
m2

View File

@@ -0,0 +1,12 @@
o<extend_m9> sub
o2 if [#<_task> EQ 1]
o1 if [EXISTS [#<P>]]
(DEBUG,M9 P-word passed: #<P>)
o1 else
(DEBUG,M9 No P-word passed)
o1 endif
m9 (call built-in m9)
(DEBUG, extend_m9 done)
o2 endif
o<extend_m9> endsub
m2

View File

@@ -0,0 +1,8 @@
o<prepare> sub
(debug, in prepare tool=#<tool> pocket=#<pocket>)
; using the code being remapped here means 'use builtin behaviour'
T #<tool>
; signal success be returning a value > 0:
o<prepare> endsub [1]
m2

View File

@@ -0,0 +1,8 @@
o<setfeed> sub
(debug, in setfeed feed=#<feed>)
; using the code being remapped here means 'use builtin behaviour'
F#<feed>
; signal success be returning a value > 0:
o<setfeed> endsub [1]
m2

View File

@@ -0,0 +1,8 @@
o<setspeed> sub
(debug, in setspeed speed=#<speed>)
; using the code being remapped here means 'use builtin behaviour'
S#<speed>
; signal success be returning a value > 0:
o<setspeed> endsub [1]
m2

View File

@@ -0,0 +1,7 @@
o<settool> sub
(debug, in settool tool=#<tool>)
; using the code being remapped here means 'use builtin behaviour'
m61 q#<tool>
; signal success be returning a value > 0:
o<settool> endsub [1]
m2

View File

@@ -0,0 +1,20 @@
# This is a component of LinuxCNC
# Copyright 2011, 2012, 2013 Dewey Garrett <dgarrett@panix.com>,
# Michael Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from stdglue import *

View File

@@ -0,0 +1,19 @@
# This is a component of LinuxCNC
# Copyright 2011, 2012, 2013 Dewey Garrett <dgarrett@panix.com>,
# Michael Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import remap

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="width-request">400</property>
<property name="can-focus">False</property>
<property name="default-width">300</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">4</property>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="n-rows">3</property>
<property name="n-columns">2</property>
<property name="column-spacing">4</property>
<property name="row-spacing">4</property>
<child>
<object class="HAL_LED" id="flood">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Mist</property>
</object>
</child>
<child>
<object class="HAL_LED" id="spindle-on">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
<property name="top-attach">2</property>
<property name="bottom-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Flood</property>
</object>
<packing>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Spindle</property>
</object>
<packing>
<property name="top-attach">2</property>
<property name="bottom-attach">3</property>
</packing>
</child>
<child>
<object class="HAL_LED" id="mist">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HAL_HBar" id="spindle-speed">
<property name="width-request">300</property>
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="bg-color">#bebebebebebe</property>
<property name="max">2000</property>
<property name="z0-color">#0000ffff0000</property>
<property name="z1-color">#ffffffff0000</property>
<property name="z2-color">#ffff00000000</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,4 @@
T1 P11 D0.125000 Z+0.511000 ;1/8 end mill
T2 P12 D0.062500 Z+0.100000 ;1/16 end mill
T3 P13 D0.201000 Z+1.273000 ;#7 tap drill
T4 P14 D0.345 Z+1.11 ;#random drill

View File

@@ -0,0 +1,217 @@
[EMC]
VERSION = 1.1
MACHINE = getting-started:demo.ini
# Debug level, 0 means no messages. See src/emc/nml_intf/debugflags.h for others
DEBUG = 0
[DISPLAY]
DISPLAY = axis
OPEN_FILE= ./nc_files/examples.ngc
CYCLE_TIME = 0.100
HELP_FILE = doc/help.txt
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
MAX_SPINDLE_OVERRIDE = 1.0
MAX_LINEAR_VELOCITY = 1.2
DEFAULT_LINEAR_VELOCITY = .25
PROGRAM_PREFIX = ../../nc_files/
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
#EDITOR = geany
TOOL_EDITOR = tooledit
INCREMENTS = 1 in, 0.1 in, 10 mil, 1 mil, 1mm, .1mm, 1/8000 in
[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 = python3
[RS274NGC]
PARAMETER_FILE = sim.var
SUBROUTINE_PATH = nc_subroutines:../../nc_files/remap_lib/common_nc_subs
LOG_LEVEL = 0
# generalized remapping of RS274NGC codes
#-----------------------------------------
# currently only unused M- and G-codes may be activated as per below, plus the
# T,M6,M61,S and F codes.
# G: currently supported modal group: 1
# M:currently supported modal groups: 5,6,7,8,9,10
# for T,S,F remaps the modal group is fixed and any modalgroup= option is ignored
# An argument specification (keyword 'argspec') describes required and permitted words,
# and preconditions for that code to execute.
#
# It consists of 0-n characters of the class [@A-KMNP-Za-kmnp-z^>] .
#
# parameter words:
# an uppercase letter for each required parameter 'word'
# a lowercase letter for each optional parameter 'word'
#
# Preconditions:
# an '^' means: speed must be > 0
# an '>' means: feed must be > 0
#
# if calling an NGC oword function (ngc= <funcname>), the parameters are passed
# as local named parameters which are already set when the function starts
# optional words are passed if set in the block, and may be tested for existence
# by # EXISTS(#<..>) .
#
# example 1:
REMAP= M400 modalgroup=10 argspec=Pq ngc=m400
# see nc_subroutines/m400.ngc
# to exercise, try:
# M400
# M400 P123
# M400 P123 Q456
# ---------------
#
# Example 2:
#
# Calling with traditional positioal parameter lists:
#
# To do so, add the '@' character to the argspec.
# In this case, the arguments (required or optional) will be passed tradional-style
#
REMAP= M410 modalgroup=10 argspec=@Pq ngc=m410
# see nc_subroutines/m410.ngc
#
# to exercise, try:
# M410
# M410 P123
# M410 P123 Q456
#
# NB: you lose the capability to distinguish more than one optional parameter word!
# since you can't tell whether Q was passed as 'Q0' or no Q word was set.
#
# -------------------------------------------------------------------------
#
# up to here you wouldn't need the PYTHON section to be defined since no
# Python code was used.
# Examples below refer to Python handlers and hence need the plugin configured.
#
# instead of calling an NGC procedure, we call the remap.g886() Python function:
#
REMAP= G88.6 modalgroup=1 argspec=XYZp py=g886
# see python/remap.py function g886
# to exercise, try:
# g88.6 x1 y2 z3
# g88.6 x1 y2 z3 p33 (a comment here)
# a more complex example
# based on nc_files/involute.py example and can it as a G-code
# all checking is done in the Python procedure by directly accessing interpreter internals
#
REMAP= G88.1 modalgroup=1 py=involute
# see python/remap.py function involute
#
#
# pin wiggling example - equivalent of M62
# usgage : M462 P<pin-number> Q<0 or 1>
REMAP= M462 modalgroup=10 argspec=PQ py=m462
# pin wiggling example - equivalent of M65
# usgage : M465 P<pin-number> Q<0 or 1>
REMAP= M465 modalgroup=10 argspec=PQ py=m465
# this is important - read nc_subroutines/on_abort.ngc
ON_ABORT_COMMAND= O <on_abort> call
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[HAL]
HALUI = halui
HALFILE = LIB:basic_sim.tcl
[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.2
POSITION_FILE = position.txt
MAX_LINEAR_VELOCITY = 1.2
NO_FORCE_HOMING = 1
[EMCIO]
TOOL_TABLE = tool.tbl
TOOL_CHANGE_POSITION = 0 0 0
TOOL_CHANGE_QUILL_UP = 1
[KINS]
KINEMATICS = trivkins
JOINTS = 3
[AXIS_X]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 20.0
HOME_LATCH_VEL = 20.0
HOME_SEQUENCE = 1
[AXIS_Y]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 20.0
HOME_LATCH_VEL = 20.0
HOME_SEQUENCE = 1
[AXIS_Z]
MIN_LIMIT = -8.0
MAX_LIMIT = 8.00
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -8.0
MAX_LIMIT = 8.00
HOME_OFFSET = 1.0
HOME_SEARCH_VEL = 20.0
HOME_LATCH_VEL = 20.0
HOME_SEQUENCE = 0
[PYTHON]
PATH_PREPEND= python
# import the following Python module
TOPLEVEL= python/toplevel.py
# the higher the more verbose tracing of the Python plugin
LOG_LEVEL = 8

View File

@@ -0,0 +1,17 @@
; you might want to single step this file
; M400 will fail - try in MDI window
m400 p10
m400 p10 q43
m400p10
; M410 will fail - try in MDI window
m410 p10
m400 p10 q43
;
F60 S2000 M3
;
g88.1 x0
;
g88.1 x1 y2 z3 p4
;
m2

View File

@@ -0,0 +1,12 @@
o<change_min> sub
(debug, change_min: loaded tool=#<current_tool> selected_pocket=#<selected_pocket>)
; show aborting a change on tool 2 by returning a negative value
; o100 if [#<tool> EQ 2]
; o100 return [-1]
; o100 endif
; succeed by returning a positive value
; which will inspected by the epilog handler
o<change_min> endsub [1]
m2

View File

@@ -0,0 +1,14 @@
; configured by:
; [RS274NGC]
; REMAP=M400 modalgroup=10 argspec=Pq ngc=m400
;
o<m400> sub
#5599 = 1 (turn on debug, output)
(P is required since it's uppercase in the argspec)
(debug, P word=#<P>)
(the q argspec is optional since its lowercase in the argspec. Use as follows:)
o100 if [EXISTS[#<q>]]
(debug, Q word set: #<q>)
o100 endif
o<m400> endsub
M2

View File

@@ -0,0 +1,4 @@
o<m410> sub
(debug, m410.ngc: [1]=#1 [2]=#2)
o<m410> endsub
M2

View File

@@ -0,0 +1,13 @@
o<prepare_min> sub
(debug, prepare_min: loaded tool=#<current_tool>, selected pocket=#<selected_pocket>)
(debug, prepare tool #<new_tool> from pocket=#<new_pocket>)
; show aborting a prepare on tool 2 by returning a negative value
; o100 if [#<tool> EQ 2]
; o100 return [-1]
; o100 endif
; succeed by returning a positive value
; which will inspected by the epilog handler
o<prepare_min> endsub [1]
m2

View File

@@ -0,0 +1,35 @@
# This is a component of LinuxCNC
# Copyright 2011, 2013 Dewey Garrett <dgarrett@panix.com>, Michael
# Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from util import call_pydevd
def foo(*args):
print("foo!")
# make debugger available as oword procedure
def pydevd(self,*args):
call_pydevd()
# this would be defined in the oword module
def mysub(self, *args):
print("number of parameters passed:", len(args))
for a in args:
print(a)

View File

@@ -0,0 +1,114 @@
# This is a component of LinuxCNC
# Copyright 2011, 2013, 2014 Dewey Garrett <dgarrett@panix.com>,
# Michael Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import sys
import traceback
from math import sin,cos
from interpreter import *
from emccanon import MESSAGE, SET_MOTION_OUTPUT_BIT, CLEAR_MOTION_OUTPUT_BIT,SET_AUX_OUTPUT_BIT,CLEAR_AUX_OUTPUT_BIT
from util import lineno, call_pydevd
throw_exceptions = 1 # raises InterpreterException if execute() or read() fail
def g886(self, **words):
for key in words:
MESSAGE("word '%s' = %f" % (key, words[key]))
if words.has_key('p'):
MESSAGE("the P word was present")
MESSAGE("comment on this line: '%s'" % (self.blocks[self.remap_level].comment))
return INTERP_OK
def involute(self, **words):
""" remap function with raw access to Interpreter internals """
if self.debugmask & 0x20000000: call_pydevd() # USER2 debug flag
if equal(self.feed_rate,0.0):
self.set_errormsg("feedrate > 0 required")
return INTERP_ERROR
if equal(self.speed[0], 0.0):
self.set_errormsg("spindle speed > 0 required")
return INTERP_ERROR
plunge = 0.1 # if Z word was given, plunge - with reduced feed
# inspect controlling block for relevant words
c = self.blocks[self.remap_level]
x0 = c.x_number if c.x_flag else 0
y0 = c.y_number if c.y_flag else 0
a = c.p_number if c.p_flag else 10
old_z = self.current_z
if self.debugmask & 0x10000000: # USER1 debug flag
print("x0=%f y0=%f a=%f old_z=%f" % (x0,y0,a,old_z))
try:
#self.execute("G3456") # would raise InterpreterException
self.execute("G21",lineno())
self.execute("G64 P0.001",lineno())
self.execute("G0 X%f Y%f" % (x0,y0),lineno())
if c.z_flag:
feed = self.feed_rate
self.execute("F%f G1 Z%f" % (feed * plunge, c.z_number),lineno())
self.execute("F%f" % (feed),lineno())
for i in range(100):
t = i/10.
x = x0 + a * (cos(t) + t * sin(t))
y = y0 + a * (sin(t) - t * cos(t))
self.execute("G1 X%f Y%f" % (x,y),lineno())
if c.z_flag: # retract to starting height
self.execute("G0 Z%f" % (old_z),lineno())
except InterpreterException as e:
msg = "%d: '%s' - %s" % (e.line_number,e.line_text, e.error_message)
self.set_errormsg(msg) # replace builtin error message
return INTERP_ERROR
return INTERP_OK
def m462(self, **words):
""" remap function which does the equivalent of M62, but via Python """
p = int(words['p'])
q = int(words['q'])
if q:
SET_MOTION_OUTPUT_BIT(p)
else:
CLEAR_MOTION_OUTPUT_BIT(p)
return INTERP_OK
def m465(self, **words):
""" remap function which does the equivalent of M65, but via Python """
p = int(words['p'])
q = int(words['q'])
if q:
SET_AUX_OUTPUT_BIT(p)
else:
CLEAR_AUX_OUTPUT_BIT(p)
return INTERP_OK

View File

@@ -0,0 +1,20 @@
# This is a component of LinuxCNC
# Copyright 2011, 2013 Dewey Garrett <dgarrett@panix.com>, Michael
# Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import oword
import remap

View File

@@ -0,0 +1,68 @@
# This is a component of LinuxCNC
# Copyright 2011, 2013 Dewey Garrett <dgarrett@panix.com>, Michael
# Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import inspect
import emccanon
# O-word procedure to trap into the Pydevd debugger
# start debug server in Eclipse, then
# call as 'O<pydevd> call' from MDI
# example setup for debugging embedded Python code
# see http://pydev.org/manual_adv_remote_debugger.html
# if this points to a valid directory,
def call_pydevd():
""" trap into the pydevd debugger"""
import os,sys
pydevdir= '/home/mah/.eclipse/org.eclipse.platform_3.5.0_155965261/plugins/org.python.pydev.debug_2.0.0.2011040403/pysrc/'
# the 'emctask' module is present only in the milltask instance, otherwise both the UI and
# milltask would try to connect to the debug server.
if os.path.isdir(pydevdir) and 'emctask' in sys.builtin_module_names:
sys.path.append(pydevdir)
sys.path.insert(0,pydevdir)
try:
import pydevd
emccanon.MESSAGE("pydevd imported, connecting to Eclipse debug server...")
pydevd.settrace()
except:
emccanon.MESSAGE("no pydevd module found")
pass
def lineno():
""" return line number in the current Python script """
return inspect.currentframe().f_back.f_lineno
def error_stack(self):
""" print the Interpreters error stack (function names) """
print("error stack level=%d" % (self.stack_index))
for s in self.stack():
print("--'%s'" % (s))
def callstack(self):
""" print the O-Word call stack """
for i in range(self.call_level):
c = self.sub_context[i]
print("%d: pos=%d seq=%d filename=%s sub=%s" % (i,c.position, c.sequence_number,c.filename,c.subname))

View File

@@ -0,0 +1 @@
../tool.tbl

View File

@@ -0,0 +1,3 @@
Example for a manual toolchanger with automatic tool length probe after change

View File

@@ -0,0 +1,14 @@
net tool-change motion.digital-out-00 gladevcp.change-led
net tool-changed gladevcp.changed motion.digital-in-00
net toolno motion.analog-out-00 gladevcp.number
net probing motion.digital-out-01 gladevcp.probing-led
net enable motion.digital-out-02 gladevcp.enable
net probe-contact gladevcp.probe-contact motion.probe-input
net reftool gladevcp.reftool motion.digital-in-01
net reflen motion.analog-out-01 gladevcp.reflen
net currlen motion.analog-out-02 gladevcp.currlen

View File

@@ -0,0 +1,143 @@
<?xml version="1.0"?>
<glade-interface>
<!-- interface-requires gladevcp 0.0 -->
<!-- interface-requires gladevcp 0.0 -->
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy project-wide -->
<widget class="GtkWindow" id="window1">
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<widget class="HAL_Table" id="enable">
<property name="visible">True</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<child>
<widget class="HAL_Button" id="changed">
<property name="label" translatable="yes">Change complete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="HAL_ToggleButton" id="reftool">
<property name="label" translatable="yes">Reference Tool</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">probing:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="HAL_LED" id="probing-led">
<property name="visible">True</property>
<property name="pick_color_on">#1525ffff4fdc</property>
<property name="led_shape">2</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="HAL_LED" id="change-led">
<property name="visible">True</property>
<property name="pick_color_on">#fffff232127d</property>
<property name="led_shape">2</property>
<signal name="hal_pin_changed" handler="on_led_change"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="change-text">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="HAL_Button" id="probe-contact">
<property name="label" translatable="yes">Simulate probe
contact</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="HAL_Label" id="reflen">
<property name="visible">True</property>
<property name="label" translatable="yes">label</property>
<property name="label_pin_type">1</property>
<property name="text_template">Reference Z length: %f</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_padding">4</property>
</packing>
</child>
<child>
<widget class="HAL_Label" id="currlen">
<property name="visible">True</property>
<property name="label" translatable="yes">label</property>
<property name="label_pin_type">1</property>
<property name="text_template">Current Z length: %f</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_padding">4</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">3</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@@ -0,0 +1,8 @@
# in case they were linked already
unlinkp iocontrol.0.tool-change
unlinkp iocontrol.0.tool-changed
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
# rest is in gladevcp.hal

View File

@@ -0,0 +1,187 @@
[EMC]
VERSION = 1.1
MACHINE = manualtoolchange.ini
# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
DEBUG = 0
[DISPLAY]
DISPLAY = axis
GLADEVCP= -c gladevcp -u python/gladevcp-handler.py manualtoolchange.ui
OPEN_FILE= ./nc_files/tcdemo.ngc
CYCLE_TIME = 0.100
HELP_FILE = doc/help.txt
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
MAX_SPINDLE_OVERRIDE = 1.0
PROGRAM_PREFIX = ../../nc_files/
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
#EDITOR = geany
INCREMENTS = 1 mm, .01 in, .1mm, 1 mil, .1 mil, 1/8000 in
[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 = python3
[RS274NGC]
PARAMETER_FILE = sim_mm.var
SUBROUTINE_PATH = nc_subroutines:../../nc_files/remap_lib/common_nc_subs
LOG_LEVEL = 9
ON_ABORT_COMMAND= O <on_abort> call
# ------ remapping toolchange - related codes ----------------------
#
# see python/remap.py for the prolog and epilog handlers
# see nc_files/remap-subroutines for the NGC procedures
#
# the prepare_min.ngc and change_min.ngc are templates - fill in as needed
REMAP= M6 modalgroup=6 prolog=change_prolog ngc=manual_change epilog=change_epilog
# accessible in interp as #<_[section]name>
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[HAL]
HALUI = halui
HALFILE = LIB:basic_sim.tcl
POSTGUI_HALFILE= gladevcp.hal
[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 30.48
MAX_LINEAR_VELOCITY = 53.34
DEFAULT_LINEAR_ACCELERATION = 508
MAX_LINEAR_ACCELERATION = 508
POSITION_FILE = position_mm.txt
NO_FORCE_HOMING = 1
[EMCIO]
TOOL_TABLE = tool.tbl
[KINS]
KINEMATICS = trivkins
JOINTS = 3
[AXIS_X]
MIN_LIMIT = -254
MAX_LIMIT = 254
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
MIN_LIMIT = -254
MAX_LIMIT = 254
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 127
HOME_LATCH_VEL = 25.4
HOME_SEQUENCE = 1
[AXIS_Y]
MIN_LIMIT = -254
MAX_LIMIT = 254
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
[JOINT_1]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
MIN_LIMIT = -254
MAX_LIMIT = 254
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 127
HOME_LATCH_VEL = 25.4
HOME_SEQUENCE = 1
[AXIS_Z]
MIN_LIMIT = -50.8
MAX_LIMIT = 101.6
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
MIN_LIMIT = -50.8
MAX_LIMIT = 101.6
HOME_OFFSET = 25.4
HOME_SEARCH_VEL = 127
HOME_LATCH_VEL = 25.4
HOME_SEQUENCE = 0
[PYTHON]
# where to find Python code
# code specific for this configuration
PATH_PREPEND= ./python
# generic support code
PATH_APPEND= ../../nc_files/remap_lib/python-stdglue
# import the following Python module
TOPLEVEL= python/toplevel.py
# the higher the more verbose tracing of the Python plugin
LOG_LEVEL = 0
# Part program interpreter section --------------------------------------------
[TOOLSENSOR]
X = 10
Y = 10
Z = 10
# abort change if no toolsensor contact after this probe distance
MAXPROBE= -10
PROBEFEED= 50
# this is not named TOOL_CHANGE_POSITION on purpose - canon uses it and will
# interfere
[CHANGE_POSITION]
X = 10
Y = 20
Z = 30
# motion.digital-in/out-NN pins
[PINS]
# motion.digital-out-00
CHANGE = 0
# motion.digital-out-01
PROBING = 1
# motion.digital-out-02
ENABLE = 2
# motion.digital-in-00
CHANGED = 0
# motion.digital-in-01
REFTOOL = 1
# motion.analog-out-00
TOOLNO = 0
# motion.analog-out-01
REFLEN = 1
# motion.analog-out-02
CURRLEN = 2
[DWELL]
# timeout the change after 2 minutes
ACK_SECS= 120

View File

@@ -0,0 +1,247 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-bottom">8</property>
<property name="xpad">0</property>
<property name="ypad">5</property>
<property name="label" translatable="yes">Manual Toolchange
with Probing</property>
<attributes>
<attribute name="font-desc" value="Sans Bold 12"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_LED" id="change-led">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">20</property>
<property name="led-blink-rate">0</property>
<property name="led-shape">2</property>
<property name="off-color">black</property>
<property name="on-color">orange</property>
<property name="pick-color-off">#000000000000</property>
<property name="pick-color-on">#c6c646460000</property>
<signal name="hal-pin-changed" handler="on_led_change" swapped="no"/>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="change-text">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">10</property>
<property name="xpad">5</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<!-- n-columns=1 n-rows=3 -->
<object class="HAL_Table" id="enable">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<!-- n-columns=1 n-rows=2 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="row-spacing">5</property>
<child>
<object class="HAL_ToggleButton" id="reftool">
<property name="label" translatable="yes">Reference Tool</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-right">25</property>
<property name="image-position">top</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="HAL_Button" id="changed">
<property name="label" translatable="yes">Tool change complete</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-right">25</property>
<property name="image-position">top</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label-xalign">0</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="left-padding">12</property>
<child>
<!-- n-columns=2 n-rows=3 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_LED" id="probing-led">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-right">10</property>
<property name="led-blink-rate">5</property>
<property name="led-shape">2</property>
<property name="off-color">black</property>
<property name="pick-color-off"/>
<property name="pick-color-on">#1525ffff4fdc</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="HAL_Button" id="probe-contact">
<property name="label" translatable="yes">Simulate probe contact</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-right">5</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="HAL_Label" id="currlen">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="label-pin-type">1</property>
<property name="text-template">Current Z length: %f</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="HAL_Label" id="reflen">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="label-pin-type">1</property>
<property name="text-template">Reference Z length: %f</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xpad">10</property>
<property name="ypad">3</property>
<property name="label" translatable="yes">Tool probe</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">3</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1,143 @@
G20
T1 M6
(font: /usr/share/fonts/truetype/freefont/FreeSerifBoldItalic.ttf)
(text: t1)
#1=0.1 (SafeHeight)
#2=0.01 (Depth of Cut)
#3=0.000300 (XY Scale)
#4=10.0 (Feed)
#5=1.0 (X offset)
#6=1.0 (Y offset)
; (start of symbol t)
; (starting X offset: 0)
; G00 Z #1
; G00 X [1151*#3+#5] Y [1839*#3+#6] (moveto)
; G01 Z [0-#2] F#4
; G01 X [1151*#3+#5] Y [1667*#3+#6] (lineto)
; G01 X [811*#3+#5] Y [1667*#3+#6] (lineto)
; G01 X [676*#3+#5] Y [1184*#3+#6] (lineto)
; G5.1 X[455*#3+#5] Y[311*#3+#6] I[-221*#3] J[-791*#3]
; G5.1 X[475*#3+#5] Y[270*#3+#6] I[0*#3] J[-20*#3]
; G5.1 X[520*#3+#5] Y[250*#3+#6] I[21*#3] J[-20*#3]
; G5.1 X[831*#3+#5] Y[578*#3+#6] I[103*#3] J[0*#3]
; G01 X [922*#3+#5] Y [520*#3+#6] (lineto)
; G5.1 X[571*#3+#5] Y[84*#3+#6] I[-205*#3] J[-315*#3]
; G5.1 X[242*#3+#5] Y[-37*#3+#6] I[-145*#3] J[-121*#3]
; G5.1 X[35*#3+#5] Y[37*#3+#6] I[-127*#3] J[0*#3]
; G5.1 X[-45*#3+#5] Y[229*#3+#6] I[-80*#3] J[74*#3]
; G5.1 X[53*#3+#5] Y[692*#3+#6] I[0*#3] J[127*#3]
; G01 X [332*#3+#5] Y [1667*#3+#6] (lineto)
; G01 X [123*#3+#5] Y [1667*#3+#6] (lineto)
; G01 X [123*#3+#5] Y [1810*#3+#6] (lineto)
; G5.1 X[537*#3+#5] Y[2044*#3+#6] I[242*#3] J[95*#3]
; G5.1 X[872*#3+#5] Y[2433*#3+#6] I[172*#3] J[139*#3]
; G01 X [1016*#3+#5] Y [2433*#3+#6] (lineto)
; G01 X [856*#3+#5] Y [1839*#3+#6] (lineto)
; G01 X [1151*#3+#5] Y [1839*#3+#6] (lineto)
(symbol extents: X = 123 to 1151, Y = 520 to 2433)
(symbol advance: X = 1139, Y = 0)
(start of symbol 1)
(starting X offset: 1139)
G00 Z #1
G00 X [1159*#3+#5] Y [0*#3+#6] (moveto)
G01 Z [0-#2] F#4
G01 X [1159*#3+#5] Y [94*#3+#6] (lineto)
G5.1 X[1491*#3+#5] Y[161*#3+#6] I[222*#3] J[0*#3]
G5.1 X[1647*#3+#5] Y[397*#3+#6] I[111*#3] J[68*#3]
G01 X [2171*#3+#5] Y [2277*#3+#6] (lineto)
G5.1 X[2188*#3+#5] Y[2376*#3+#6] I[17*#3] J[74*#3]
G5.1 X[1999*#3+#5] Y[2511*#3+#6] I[0*#3] J[135*#3]
G5.1 X[1741*#3+#5] Y[2490*#3+#6] I[-119*#3] J[0*#3]
G01 X [1749*#3+#5] Y [2585*#3+#6] (lineto)
G5.1 X[2855*#3+#5] Y[2798*#3+#6] I[570*#3] J[81*#3]
G01 X [2224*#3+#5] Y [504*#3+#6] (lineto)
G5.1 X[2175*#3+#5] Y[283*#3+#6] I[-49*#3] J[-180*#3]
G5.1 X[2253*#3+#5] Y[133*#3+#6] I[0*#3] J[-115*#3]
G5.1 X[2573*#3+#5] Y[94*#3+#6] I[78*#3] J[-35*#3]
G01 X [2573*#3+#5] Y [0*#3+#6] (lineto)
G01 X [1159*#3+#5] Y [0*#3+#6] (lineto)
(symbol extents: X = 1159 to 2573, Y = 0 to 2585)
(symbol advance: X = 2048, Y = 0)
(final X offset: 3187)
(overall extents: X = 123 to 2573, Y = 0 to 2585)
G00 Z #1
T3 M6
(font: /usr/share/fonts/truetype/freefont/FreeSerifBoldItalic.ttf)
(text: t3)
#5=2.0 (X offset)
#6=1.0 (Y offset)
(start of symbol t)
; (starting X offset: 0)
; G00 Z #1
; G00 X [1151*#3+#5] Y [1839*#3+#6] (moveto)
; G01 Z [0-#2] F#4
; G01 X [1151*#3+#5] Y [1667*#3+#6] (lineto)
; G01 X [811*#3+#5] Y [1667*#3+#6] (lineto)
; G01 X [676*#3+#5] Y [1184*#3+#6] (lineto)
; G5.1 X[455*#3+#5] Y[311*#3+#6] I[-221*#3] J[-791*#3]
; G5.1 X[475*#3+#5] Y[270*#3+#6] I[0*#3] J[-20*#3]
; G5.1 X[520*#3+#5] Y[250*#3+#6] I[21*#3] J[-20*#3]
; G5.1 X[831*#3+#5] Y[578*#3+#6] I[103*#3] J[0*#3]
; G01 X [922*#3+#5] Y [520*#3+#6] (lineto)
; G5.1 X[571*#3+#5] Y[84*#3+#6] I[-205*#3] J[-315*#3]
; G5.1 X[242*#3+#5] Y[-37*#3+#6] I[-145*#3] J[-121*#3]
; G5.1 X[35*#3+#5] Y[37*#3+#6] I[-127*#3] J[0*#3]
; G5.1 X[-45*#3+#5] Y[229*#3+#6] I[-80*#3] J[74*#3]
; G5.1 X[53*#3+#5] Y[692*#3+#6] I[0*#3] J[127*#3]
; G01 X [332*#3+#5] Y [1667*#3+#6] (lineto)
; G01 X [123*#3+#5] Y [1667*#3+#6] (lineto)
; G01 X [123*#3+#5] Y [1810*#3+#6] (lineto)
; G5.1 X[537*#3+#5] Y[2044*#3+#6] I[242*#3] J[95*#3]
; G5.1 X[872*#3+#5] Y[2433*#3+#6] I[172*#3] J[139*#3]
; G01 X [1016*#3+#5] Y [2433*#3+#6] (lineto)
; G01 X [856*#3+#5] Y [1839*#3+#6] (lineto)
; G01 X [1151*#3+#5] Y [1839*#3+#6] (lineto)
; (symbol extents: X = 123 to 1151, Y = 520 to 2433)
; (symbol advance: X = 1139, Y = 0)
; (start of symbol 3)
; (starting X offset: 1139)
G00 Z #1
G00 X [2306*#3+#5] Y [774*#3+#6] (moveto)
G01 Z [0-#2] F#4
G5.1 X[1663*#3+#5] Y[1421*#3+#6] I[0*#3] J[619*#3]
G01 X [1680*#3+#5] Y [1511*#3+#6] (lineto)
G5.1 X[2265*#3+#5] Y[1747*#3+#6] I[397*#3] J[82*#3]
G5.1 X[2454*#3+#5] Y[2138*#3+#6] I[189*#3] J[154*#3]
G5.1 X[2357*#3+#5] Y[2406*#3+#6] I[0*#3] J[168*#3]
G5.1 X[2097*#3+#5] Y[2507*#3+#6] I[-96*#3] J[101*#3]
G5.1 X[1851*#3+#5] Y[2441*#3+#6] I[-143*#3] J[0*#3]
G5.1 X[1622*#3+#5] Y[2200*#3+#6] I[-102*#3] J[-65*#3]
G01 X [1536*#3+#5] Y [2253*#3+#6] (lineto)
G5.1 X[1925*#3+#5] Y[2669*#3+#6] I[193*#3] J[287*#3]
G5.1 X[2372*#3+#5] Y[2798*#3+#6] I[197*#3] J[129*#3]
G5.1 X[2808*#3+#5] Y[2638*#3+#6] I[262*#3] J[0*#3]
G5.1 X[2982*#3+#5] Y[2241*#3+#6] I[174*#3] J[-160*#3]
G5.1 X[2544*#3+#5] Y[1651*#3+#6] I[0*#3] J[-373*#3]
G01 X [2495*#3+#5] Y [1626*#3+#6] (lineto)
G5.1 X[2740*#3+#5] Y[1360*#3+#6] I[176*#3] J[-131*#3]
G5.1 X[2810*#3+#5] Y[1024*#3+#6] I[70*#3] J[-135*#3]
G5.1 X[2464*#3+#5] Y[260*#3+#6] I[0*#3] J[-451*#3]
G5.1 X[1622*#3+#5] Y[-53*#3+#6] I[-346*#3] J[-313*#3]
G5.1 X[1225*#3+#5] Y[35*#3+#6] I[-250*#3] J[0*#3]
G5.1 X[1078*#3+#5] Y[274*#3+#6] I[-147*#3] J[88*#3]
G5.1 X[1145*#3+#5] Y[440*#3+#6] I[0*#3] J[103*#3]
G5.1 X[1323*#3+#5] Y[504*#3+#6] I[68*#3] J[64*#3]
G5.1 X[1493*#3+#5] Y[442*#3+#6] I[103*#3] J[0*#3]
G5.1 X[1591*#3+#5] Y[307*#3+#6] I[68*#3] J[-61*#3]
G5.1 X[1689*#3+#5] Y[172*#3+#6] I[31*#3] J[-74*#3]
G5.1 X[1856*#3+#5] Y[111*#3+#6] I[68*#3] J[-61*#3]
G5.1 X[2175*#3+#5] Y[305*#3+#6] I[188*#3] J[0*#3]
G5.1 X[2306*#3+#5] Y[774*#3+#6] I[131*#3] J[195*#3]
(symbol extents: X = 1536 to 2495, Y = 774 to 2253)
(symbol advance: X = 2048, Y = 0)
(final X offset: 3187)
(overall extents: X = 123 to 2495, Y = 520 to 2433)
G00 Z #1
m2

View File

@@ -0,0 +1,95 @@
; manual toolchange with automatic tool length probe
o<manual_change> sub
(we change feed, metric/in and potentially G90)
(so record current modal state)
(M73 is not useful here because it reverts G43 on return too)
#<metric> = #<_metric>
#<absolute> = #<_absolute>
#<feed> = #<_feed>
G21 (TLO and toolchange position is in mm as per ini)
G90 (absolute)
; move to toolchange position: z, then xy
g53 g0 Z #<_ini[change_position]z>
g53 g0 X #<_ini[change_position]x> Y #<_ini[change_position]y>
; indicate tool number to be loaded
M68 E #<_ini[pins]toolno> Q #<_selected_tool>
; enable table
M64 P #<_ini[pins]enable>
; signal user to change tool
M64 P #<_ini[pins]change>
; and wait for acknowledgement
M66 P #<_ini[pins]changed> L1 Q#<_ini[dwell]ack_secs>
M65 P #<_ini[pins]change> ; drop change pin
;see if we timed out
O100 if [#5399 EQ -1]
M65 P #<_ini[pins]enable> ; disable table
O<restore> call [#<metric>] [#<absolute>] [#<feed>]
O100 return [-1] ; indicate timeout failure to epilog
O100 endif
O200 if [#<_selected_tool> EQ 0] ; an unload.
M65 P #<_ini[pins]enable> ; disable table
O<restore> call [#<metric>] [#<absolute>] [#<feed>]
O200 return [1] ; indicate success
O200 endif
; tool changed - move to toolensor
g53 g0 X #<_ini[toolsensor]x> Y #<_ini[toolsensor]y>
g53 g0 Z #<_ini[toolsensor]z>
; probe tool length
M64 P #<_ini[pins]probing> ; turn on probing led
F #<_ini[toolsensor]probefeed>
G91 (relative mode)
G38.3 Z #<_ini[toolsensor]maxprobe>
; we must execute this only in the milltask interpreter
; or preview will break, so test for '#<_task>' which is 1 for
; the milltask interpreter and 0 in the UI's
O300 if [[#<_task> GT 0] and [#5070 EQ 0]]
O<restore> call [#<metric>] [#<absolute>] [#<feed>]
O300 return [-2] ; indicate probe contact failure to epilog
O300 endif
; see whether this was the reference tool:
M66 P #<_ini[pins]reftool> L0
O400 if [#5399 EQ 1]
#1000=#5063 (save reference tool length)
M68 E #<_ini[pins]reflen> Q #1000
(print,reference length is #1000)
O400 else
g43.1 z[#5063-#1000] (set new tool offset)
M68 E #<_ini[pins]currlen> Q [#5063-#1000]
(print,new length is #5063)
O400 endif
M65 P #<_ini[pins]probing> ; drop probing led
M65 P #<_ini[pins]enable> ; disable table
G90 (absolute)
; move back to toolchange position: z, then xy
g53 g0 Z #<_ini[change_position]z>
g53 g0 X #<_ini[change_position]x> Y #<_ini[change_position]y>
; restore g20/21, g90/g91, feed
O<restore> call [#<metric>] [#<absolute>] [#<feed>]
; succeed by returning a positive value
o<manual_change> endsub [1]
m2

View File

@@ -0,0 +1,12 @@
o<on_abort> sub
(print, on_abort executing)
M65 P #<_ini[pins]change> ; drop change pin
M65 P #<_ini[pins]probing> ; drop probing led
o<reset_state> call
o<on_abort> endsub
m2

View File

@@ -0,0 +1,26 @@
; restore metric/inch absolute/relative, feed as per parameter values
; call as 'O<restore> call [originalmetric] [originalabs] [originalfeed]
;
O<restore> sub
O100 if [#1 NE #<_metric>]
O200 if [#1]
G21
O200 else
G20
O200 endif
O100 endif
O300 if [#2 NE #<_absolute>]
O400 if [#2]
G90
O400 else
G91
O400 endif
O300 endif
O500 if [#3 NE #<_feed>]
F[#3]
O500 endif
O<restore> endsub
m2

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env python3
import hal
class HandlerClass:
def on_led_change(self,hal_led,data=None):
'''
the gladevcp.change led had a transition
'''
if hal_led.hal_pin.get():
if self.halcomp["number"] > 0.0:
self.change_text.set_label("Insert tool number %d" % (int(self.halcomp["number"])))
else:
self.change_text.set_label("Remove tool")
else:
self.change_text.set_label("No change requested")
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.change_text = builder.get_object("change-text")
self.halcomp.newpin("number", hal.HAL_FLOAT, hal.HAL_IN)
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]

View File

@@ -0,0 +1,19 @@
# This is a component of LinuxCNC
# Copyright 2011, 2012, 2013 Dewey Garrett <dgarrett@panix.com>,
# Michael Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from stdglue import *

View File

@@ -0,0 +1,20 @@
# This is a component of LinuxCNC
# Copyright 2011, 2013 Dewey Garrett <dgarrett@panix.com>, Michael
# Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import remap

View File

@@ -0,0 +1,7 @@
T1 P1 Z1.1 D3 ;3mm end mill
T2 P2 Z2.2 D1.5 ;1.5mm end mill
T3 P5 Z3.3 D5 ;5mm tap drill
T4 P3 Z4.4 D16 ;16 mm mill
T5 P6 Z5.5 D25 ;25mm mill
T6 P4 Z6.6 D1 ;1mm drill
T7 P7 Z7.7 D2.5

View File

@@ -0,0 +1,10 @@
This example of a racktoolchanger attempts a transliteration of micges racktoolchanger patch.
This assumes tool number == pocket number; the pocket number in the tool.tbl is currently ignored.
See http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?RackToolChanger .
NB:
I dont fully understand the meanings of the pins involved, and the dwell and moves. This has NOT been tested on a real machine. Use as starting point for your own experimentation.

View File

@@ -0,0 +1,4 @@
net tool-lock motion.digital-out-00 gladevcp.tool-lock-led
net tool-flush motion.digital-out-01 gladevcp.tool-flush-led
setp gladevcp.table 1

View File

@@ -0,0 +1,11 @@
(change tools 1 through 6)
F100
#1 = 1
O101 while [#1 lt 7]
T#1 M6
#1 = [#1+1]
O101 endwhile
m2

View File

@@ -0,0 +1,12 @@
; if aborted during a toolchange, disable pins
o<on_abort> sub
(print, on_abort executing)
M65 P #<_ini[pins]lock> ; drop lock pin
M65 P #<_ini[pins]flush> ; drop flush pin
o<reset_state> call
o<on_abort> endsub
m2

View File

@@ -0,0 +1,46 @@
o<rack_change> sub
M73 (auto-restore modal settings on return)
;(print, rack_change: loaded tool=#<_current_tool> current pocket: #<_current_pocket>)
;(print, rack_change: selected tool=#<_selected_tool> selected pocket: #<_selected_pocket>)
; unload previous tool
o300 if [#<_current_pocket> GT 0]
o<tool_getput_move> call [#<_current_pocket>]
M62 P #<_ini[pins]lock> ; set lock pin
G4 P #<_ini[dwell]lock_time>
o<tool_holder_clear_move> call
G4 P #<_ini[dwell]mystery> ; unsure what this is for
o300 endif
; go to new tool
o<tool_getput_move> call [#<_selected_pocket>]
M64 P #<_ini[pins]lock> ; set lock pin
M64 P #<_ini[pins]flush> ; set flush pin
G4 P #<_ini[dwell]new_tool>
M65 P #<_ini[pins]flush> ; drop flush pin
; the purpose of this move is unclear to me
; micges - please explain!
o400 if [#<_absolute>]
G91
G0 Z-6
G90
o400 else
G0 Z-6
o400 endif
M65 P #<_ini[pins]lock> ; drop lock pin
G4 P #<_ini[dwell]post_unlock>
; NB: this is reordered wrt micges patch:
; tool_holder_clear_move came after load_tool_msg
o<tool_holder_clear_move> call
; succeed by returning a positive value
o<rack_change> endsub [1]
m2

View File

@@ -0,0 +1,10 @@
; parameter: last_slot
o<tool_getput_move> sub
o100 if [EXISTS[#<_ini[change_position]x>]]
g53 g0 X #<_ini[change_position]x>
g53 g0 Y [#<_ini[change_position]y> + #1 * #<_ini[tool_slot_delta]y>]
g53 g0 Z #<_ini[change_position]z>
o100 endif
o<tool_getput_move> endsub
m2

View File

@@ -0,0 +1,10 @@
; no parameters
o<tool_holder_clear_move> sub
o200 if [EXISTS[#<_ini[tool_holder_clear]x>]]
g53 g0 Z #<_ini[tool_holder_clear]z>
g53 g0 X #<_ini[tool_holder_clear]x>
g53 g0 Y #<_ini[tool_holder_clear]y>
o200 endif
o<tool_holder_clear_move> endsub
m2

View File

@@ -0,0 +1,19 @@
# This is a component of LinuxCNC
# Copyright 2011, 2012, 2013 Dewey Garrett <dgarrett@panix.com>,
# Michael Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from stdglue import *

View File

@@ -0,0 +1,20 @@
# This is a component of LinuxCNC
# Copyright 2011, 2013 Dewey Garrett <dgarrett@panix.com>, Michael
# Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import remap

View File

@@ -0,0 +1,70 @@
<?xml version="1.0"?>
<glade-interface>
<!-- interface-requires gladevcp 0.0 -->
<!-- interface-requires gladevcp 0.0 -->
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy project-wide -->
<widget class="GtkWindow" id="window1">
<child>
<widget class="HAL_Table" id="table">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<widget class="HAL_LED" id="tool-flush-led">
<property name="visible">True</property>
<property name="pick_color_on">#16eefaef15f5</property>
<property name="led_shape">2</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
<property name="x_padding">4</property>
<property name="y_padding">4</property>
</packing>
</child>
<child>
<widget class="HAL_LED" id="tool-lock-led">
<property name="visible">True</property>
<property name="pick_color_on">#ffff3ff60e08</property>
<property name="led_shape">2</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
<property name="x_padding">4</property>
<property name="y_padding">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">tool-lock</property>
</widget>
<packing>
<property name="y_options"></property>
<property name="x_padding">4</property>
<property name="y_padding">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">tool-flush</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
<property name="x_padding">4</property>
<property name="y_padding">4</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@@ -0,0 +1,5 @@
# in case they were linked already
unlinkp iocontrol.0.tool-change
unlinkp iocontrol.0.tool-changed
net tool-change iocontrol.0.tool-change iocontrol.0.tool-changed

View File

@@ -0,0 +1,174 @@
[EMC]
VERSION = 1.1
MACHINE = racktoolchange.ini
# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
DEBUG = 0
[DISPLAY]
DISPLAY = axis
GLADEVCP= -c gladevcp racktoolchange.ui
OPEN_FILE= ./nc_files/tcdemo.ngc
CYCLE_TIME = 0.100
HELP_FILE = doc/help.txt
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
MAX_SPINDLE_OVERRIDE = 1.0
PROGRAM_PREFIX = ../../nc_files/
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
#EDITOR = geany
INCREMENTS = 1 mm, .01 in, .1mm, 1 mil, .1 mil, 1/8000 in
[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 = python3
[RS274NGC]
PARAMETER_FILE = sim_mm.var
SUBROUTINE_PATH = nc_subroutines:../../nc_files/remap_lib/common_nc_subs
LOG_LEVEL = 9
ON_ABORT_COMMAND= O <on_abort> call
#
# ------ remapping toolchange - related codes ----------------------
#
# see python/remap.py for the prolog and epilog handlers
# see nc_files/remap-subroutines for the NGC procedures
#
# the prepare_min.ngc and change_min.ngc are templates - fill in as needed
REMAP= M6 modalgroup=6 prolog=change_prolog ngc=rack_change epilog=change_epilog
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[HAL]
HALUI = halui
HALFILE = LIB:basic_sim.tcl
HALFILE = racktoolchange.hal
POSTGUI_HALFILE= gladevcp.hal
[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 30.48
MAX_LINEAR_VELOCITY = 53.34
DEFAULT_LINEAR_ACCELERATION = 508
MAX_LINEAR_ACCELERATION = 508
POSITION_FILE = position_mm.txt
NO_FORCE_HOMING = 1
[EMCIO]
TOOL_TABLE = tool.tbl
[KINS]
KINEMATICS = trivkins
JOINTS = 3
[AXIS_X]
MIN_LIMIT = -254
MAX_LIMIT = 254
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
MIN_LIMIT = -254
MAX_LIMIT = 254
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 127
HOME_LATCH_VEL = 25.4
HOME_SEQUENCE = 1
[AXIS_Y]
MIN_LIMIT = -254
MAX_LIMIT = 254
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
[JOINT_1]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
MIN_LIMIT = -254
MAX_LIMIT = 254
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 127
HOME_LATCH_VEL = 25.4
HOME_SEQUENCE = 1
[AXIS_Z]
MIN_LIMIT = -50.8
MAX_LIMIT = 101.6
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
MIN_LIMIT = -50.8
MAX_LIMIT = 101.6
HOME_OFFSET = 25.4
HOME_SEARCH_VEL = 127
HOME_LATCH_VEL = 25.4
HOME_SEQUENCE = 0
[PYTHON]
# where to find Python code
# code specific for this configuration
PATH_PREPEND= ./python
# generic support code
PATH_APPEND= ../../nc_files/remap_lib/python-stdglue
# import the following Python module
TOPLEVEL= python/toplevel.py
# the higher the more verbose tracing of the Python plugin
LOG_LEVEL = 0
# Part program interpreter section --------------------------------------------
[TOOL_HOLDER_CLEAR]
X = 10
Y = 30
Z = 10
[TOOL_SLOT_DELTA]
X = 0
Y = 10
Z = 0
# this is not named TOOL_CHANGE_POSITION on purpose - canon uses it and will
# interfere
[CHANGE_POSITION]
X = 10
Y = 10
Z = 10
[DWELL]
LOCK_TIME = 0.5
MYSTERY = 0
NEW_TOOL = 1.0
POST_UNLOCK = 0.5
# motion.digital-out-NN pins
[PINS]
LOCK = 0
FLUSH = 1

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gladevcp" version="0.0"/>
<object class="GtkWindow" id="window1">
<property name="can-focus">False</property>
<child>
<!-- n-columns=2 n-rows=2 -->
<object class="HAL_Table" id="table">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="HAL_LED" id="tool-lock-led">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
<property name="led-shape">2</property>
<property name="pick-color-on">#1df5ab840e4b</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="HAL_LED" id="tool-flush-led">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="led-blink-rate">0</property>
<property name="led-shape">2</property>
<property name="pick-color-on">#1df5ab840e4b</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">tool-flush</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xpad">12</property>
<property name="label" translatable="yes">tool-lock</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -0,0 +1 @@
../tool.tbl

View File

@@ -0,0 +1 @@
This is an example remapped code to demonstrate how the interpreter lookahead can be controlled.

View File

@@ -0,0 +1,135 @@
[EMC]
VERSION = 1.1
MACHINE = stop-lookahead:demo.ini
# Debug level, 0 means no messages. See src/emc/nml_intf/debugflags.h for others
DEBUG = 0
[DISPLAY]
DISPLAY = axis
OPEN_FILE= ./nc_files/examples.ngc
CYCLE_TIME = 0.100
HELP_FILE = doc/help.txt
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
MAX_SPINDLE_OVERRIDE = 1.0
MAX_LINEAR_VELOCITY = 1.2
DEFAULT_LINEAR_VELOCITY = .25
PROGRAM_PREFIX = ../../nc_files/
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
#EDITOR = geany
TOOL_EDITOR = tooledit
INCREMENTS = 1 in, 0.1 in, 10 mil, 1 mil, 1mm, .1mm, 1/8000 in
[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 = python3
[RS274NGC]
PARAMETER_FILE = sim.var
SUBROUTINE_PATH = nc_subroutines:../../nc_files/remap_lib/common_nc_subs
LOG_LEVEL = 0
REMAP= G13 modalgroup=1 py=queuebuster
# this is important - read nc_subroutines/on_abort.ngc
ON_ABORT_COMMAND= O <on_abort> call
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[HAL]
HALUI = halui
HALFILE = LIB:basic_sim.tcl
[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.2
POSITION_FILE = position.txt
MAX_LINEAR_VELOCITY = 1.2
NO_FORCE_HOMING = 1
[EMCIO]
TOOL_TABLE = tool.tbl
TOOL_CHANGE_POSITION = 0 0 0
TOOL_CHANGE_QUILL_UP = 1
[KINS]
KINEMATICS = trivkins
JOINTS = 3
[AXIS_X]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 20.0
HOME_LATCH_VEL = 20.0
HOME_SEQUENCE = 1
[AXIS_Y]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 20.0
HOME_LATCH_VEL = 20.0
HOME_SEQUENCE = 1
[AXIS_Z]
MIN_LIMIT = -8.0
MAX_LIMIT = 8.00
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -8.0
MAX_LIMIT = 8.00
HOME_OFFSET = 1.0
HOME_SEARCH_VEL = 20.0
HOME_LATCH_VEL = 20.0
HOME_SEQUENCE = 0
[PYTHON]
PATH_PREPEND= python
# import the following Python module
TOPLEVEL= python/toplevel.py
# the higher the more verbose tracing of the Python plugin
LOG_LEVEL = 8

View File

@@ -0,0 +1,24 @@
;
; demo for stopping interpreter readahead
;
; assuming the G13 line is commented out, what would happen is:
;
; the interpreter parses and queues the msg commands, then encounters abort
; and immediately flushes the interpreter queue
; consequence: the message from (msg,xx) dont appear since they are flushed before they can be executed by
; task and the gui.
;
; if G13 is active, this means interpreter readahead stops at that very line until all preceding
; commands have been executed
; hence the messages appear in that case
(msg,one)
(msg,two)
(msg,three)
G13 (dont lookahead further)
o10 if [#<_task> EQ 1] (this avoids an abort message when starting the config)
(abort, aborting)
o10 endif
m2

View File

@@ -0,0 +1,24 @@
# This is a component of LinuxCNC
# Copyright 2013 Dewey Garrett <dgarrett@panix.com>, Michael Haberler
# <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import interpreter
def queuebuster(self, **words):
yield interpreter.INTERP_EXECUTE_FINISH

View File

@@ -0,0 +1,19 @@
# This is a component of LinuxCNC
# Copyright 2011, 2012, 2013 Dewey Garrett <dgarrett@panix.com>,
# Michael Haberler <git@mah.priv.at>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import remap

View File

@@ -0,0 +1 @@
../tool.tbl

View File

@@ -0,0 +1,7 @@
T1 P1 Z1.1 D3 ;3mm end mill
T2 P2 Z2.2 D1.5 ;1.5mm end mill
T3 P5 Z3.3 D5 ;5mm tap drill
T4 P3 Z4.4 D16 ;16 mm mill
T5 P6 Z5.5 D25 ;25mm mill
T6 P4 Z6.6 D1 ;1mm drill
T7 P7 Z7.7 D2.5