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 @@
Demonstrate moves by calling straight canon functions in an oword sub

View File

@@ -0,0 +1,22 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
7 N..... SET_FEED_RATE(100.0000)
8 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
9 N..... STRAIGHT_TRAVERSE(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
10 N..... STRAIGHT_FEED(15.0000, 25.0000, 0.0000, 0.0000, 0.0000, 0.0000)
11 N..... MESSAGE(" demonstrate moves via py oword sub")
12 N..... STRAIGHT_FEED(1.0000, 2.0000, 3.0000, 0.0000, 0.0000, 0.0000)
13 N..... STRAIGHT_TRAVERSE(33.0000, 45.0000, 78.0000, 0.0000, 0.0000, 0.0000)
14 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
15 N..... SET_XY_ROTATION(0.0000)
16 N..... SET_FEED_MODE(0, 0)
17 N..... SET_FEED_RATE(0.0000)
18 N..... STOP_SPINDLE_TURNING(0)
19 N..... SET_SPINDLE_MODE(0 0.0000)
20 N..... PROGRAM_END()
21 N..... ON_RESET()

View File

@@ -0,0 +1,33 @@
# This is a component of LinuxCNC
# Copyright 2011 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 emccanon
import interpreter
import inspect
## {{{ http://code.activestate.com/recipes/145297/ (r1)
def lineno():
"""Returns the current line number in our program."""
return inspect.currentframe().f_back.f_lineno
# example for creating moves in a Python oword sub
def canonmove(self, x,y,z):
emccanon.STRAIGHT_FEED(lineno(),x,y,z,0,0,0,0,0,0)
emccanon.STRAIGHT_TRAVERSE(lineno(),self.params["_ini[config]xpos"],self.params["_ini[config]ypos"],self.params["_ini[config]zpos"],0,0,0,0,0,0)
return 0.0

View File

@@ -0,0 +1,18 @@
# This is a component of LinuxCNC
# Copyright 2011 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

View File

@@ -0,0 +1,15 @@
[EMC]
DEBUG=0
[RS274NGC]
SUBROUTINE_PATH = .
LOG_LEVEL=0
[PYTHON]
PATH_PREPEND=.
TOPLEVEL = subs.py
LOG_LEVEL = 0
[CONFIG]
XPOS = 33
YPOS = 45
ZPOS = 78

View File

@@ -0,0 +1,8 @@
F100
G21
G0 X0 Y0 Z0
G1 X15 Y25
(debug, demonstrate moves via py oword sub)
o<canonmove> call [1] [2] [3]
M2

2
tests/interp/pymove/test.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
exec rs274 -i test.ini -n 0 -g test.ngc 2>&1