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,10 @@
An example of combining the G43.2 compound offset idea with remapping to create
a toolchange similar to Fanuc.
T1 = select and load tool 1, and apply the base offset for tool 1
T0101 = select and load tool 1 and apply offsets 1 and 10001
T0201 = select and load tool 1 and apply offsets 1 and 10002
This might not exactly match Fanuc, but the behaviour is easy to change
by editing toolchange.ngc

View File

@@ -0,0 +1,106 @@
[EMC]
VERSION = 1.1
MACHINE = lathe-fanucy
DEBUG = 0
[DISPLAY]
DISPLAY = axis
LATHE = 1
#EDITOR = geany
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
[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]
SUBROUTINE_PATH = ./:../
REMAP = T prolog=get_T_number ngc=toolchange
PARAMETER_FILE = sim-lathe.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 50000
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[HAL]
HALFILE = LIB:basic_sim.tcl
[TRAJ]
COORDINATES = X Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.0
MAX_LINEAR_VELOCITY = 3.333333
DEFAULT_LINEAR_ACCELERATION = 20.0
MAX_LINEAR_ACCELERATION = 20.0
[EMCIO]
TOOL_TABLE = lathe-fanucy.tbl
TOOL_CHANGE_POSITION = 2 0 1
TOOL_CHANGE_WITH_SPINDLE_ON = 1
[KINS]
KINEMATICS = trivkins coordinates=xz
JOINTS = 2
[AXIS_X]
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
MAX_VELOCITY = 3.333333
MAX_ACCELERATION = 20.0
[AXIS_Z]
MIN_LIMIT = -2.0
MAX_LIMIT = 4.0
MAX_VELOCITY = 3.333333
MAX_ACCELERATION = 20.0
[JOINT_0]
TYPE = LINEAR
MAX_VELOCITY = 3.333333
MAX_ACCELERATION = 20.0
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
HOME_SEARCH_VEL = 5.0
HOME_LATCH_VEL = 1.0
HOME_SEQUENCE = 0
[JOINT_1]
TYPE = LINEAR
MAX_VELOCITY = 3.333333
MAX_ACCELERATION = 20.0
MIN_LIMIT = -2.0
MAX_LIMIT = 4.0
HOME_SEARCH_VEL = 5.0
HOME_LATCH_VEL = 1.0
HOME_SEQUENCE = 1
[PYTHON]
# where to find Python code
# code specific for this configuration
PATH_PREPEND= ./
# generic support code
PATH_APPEND= ../../nc_files/remap_lib/python-stdglue/
# import the following Python module
TOPLEVEL= toplevel.py
# the higher the more verbose tracing of the Python plugin
LOG_LEVEL = 0

View File

@@ -0,0 +1,10 @@
T1 P11 X0.1 Z0.1 D0.1 I95.000000 J155.000000 Q1
T2 P22 X0.2 Z0.2 D0.1 I85.000000 J25.000000 Q2
T10001 P3 X0.001 Z0.001 D0.1 I275.000000 J335.000000 Q3
T10002 P4 X0.002 Z0.002 D0.1 I265.000000 J205.000000 Q4
T5 P5 D0.1 I210.000000 J150.000000 Q5
T6 P6 X0.5 Z0.5 D0.1 I120.000000 J60.000000 Q6
T7 P7 D0.1 I-30.000000 J30.000000 Q7
T8 P8 D0.1 I240.000000 J300.000000 Q8
T9 P9 D0.1 Q9
T10 P10 D0 ;demo zero diameter

View File

@@ -0,0 +1,33 @@
# This is a component of LinuxCNC
# Copyright 2014 Andy Pugh <andy@bodgesoc.org>, Chris Radek
# <chris@timeguy.com>
#
# 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 *
# Extract the T number into a parameter, but don't try anything else clever
def get_T_number(self,**words):
try:
cblock = self.blocks[self.remap_level]
if not cblock.t_flag:
self.set_errormsg("T requires a tool number")
return INTERP_ERROR
self.params["tool"] = cblock.t_number
return INTERP_OK
except Exception as e:
self.set_errormsg("T%d/prepare_prolog: %s" % (int(words['t']), e))
return INTERP_ERROR

View File

@@ -0,0 +1,12 @@
O<toolchange> sub
(debug, Tool requested = #<tool>)
#<wear> = [10000 + FIX[ #<tool> / 100]]
#<tool> = [#<tool> MOD 100]
M6 T#<tool>
G43 H#<tool>
O100 IF [#<wear> GT 10000]
G43.2 H#<wear>
O100 ENDIF
#<pocket> = #<tool>
(debug, tool = #<tool> wear = #<wear>)
O<toolchange> endsub [0]

View File

@@ -0,0 +1,21 @@
# This is a component of LinuxCNC
# Copyright 2011, 2014 Andy Pugh <andy@bodgesoc.org>, 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