Add AC/BC RTCP programs and 3D machine manager

This commit is contained in:
2026-09-20 12:31:12 +08:00
parent 1c1e5f9672
commit 8aab531b02
363 changed files with 53213 additions and 58 deletions

View File

@@ -0,0 +1,3 @@
; zmax zmin r frate n a b c dist
o<xyzac_switchkins_sub> call [10] [5] [10][1000][3][20][0][45][20]
m2

View File

@@ -0,0 +1,39 @@
; for debugging, use mdi to set global #<_switchkins_debug>=1
#<FRATE>=1000
M429
G0 X0 Y0 Z0 A0 C0
G0 C90 X10 Y0
G1 F#<FRATE> Z2
M428
G1 F#<FRATE> Z0
M429
G1 F#<FRATE> Z2
G0 C90 X0 Y10
G1 F#<FRATE> Z0
M428
G1 F#<FRATE> Z2
M429
G1 F#<FRATE> Z0
G0 C90 X10 Y30
G1 F#<FRATE> Z2
M428
G1 F#<FRATE> Z0
M429
G1 F#<FRATE> Z2
G0 C90 X30 Y10
G1 F#<FRATE> Z0
M428
G1 F#<FRATE> Z2
M429
G1 F#<FRATE> Z0
G0 X0 Y0 Z0 A0 C0
M2

View File

@@ -0,0 +1,49 @@
; for debugging, use mdi to set global #<_switchkins_debug>=1
#<FRATE>=1000
M429 ;Trivkins
G64 P0.01
S1500 M3
G0 X0 Y0 Z5 A0 C0
G1 F#<FRATE> Z0
G1 X20 Y0 F#<FRATE>
M428 ;XYZAC
G1 C90
G1 X20
G1 Y20
G1 X0
G1 Y0
G1 A20
G1 X-20
G1 Y-20
G1 X0
G1 Y0
(-------)
G1 C45
G1 X-15
G1 Y15
G1 X0
G1 Y0
G1 Y-15
G1 X15
G1 Y0
G1 X0
(-------)
G1 C90 X15
G1 C180 Y15
G1 C270 X0
G1 C360 Y0
G1 C0
G1 C-90 X-15
G1 C-180 Y-15
G1 C-270 X0
G1 C-360 Y0
G1 Z5
M429 ;Trivkins
G1 X0 Y0 Z1 A0 C0
M2

View File

@@ -0,0 +1,15 @@
;# enable optional stop for m1
m429 ;trivkins
G0 X0 Y0 Z0 A0 C0
G0 C90 X10 Y0
G1 F1000 Z2
(debug,A expect: 10 0 2) m1
(debug,B expect: 10 0 2) m1
m428 ;tcp
(debug,C expect: 0 -10 2) m1
g1f1000 z0
(debug,D expect: 0 -10 0) m1
(debug,E expect: 0 -10 0) m1
m429 ;trivkins
(debug,F expect: 10 0 0)
m2

View File

@@ -0,0 +1,3 @@
; zmax zmin r frate n a b c dist
o<xyzbc_switchkins_sub> call [10] [5] [10][1000][3][0][20][45][20]
m2

View File

@@ -0,0 +1,24 @@
;M428 by remap: kinstype==1 (xyzac,xyzbc) (note: sparm=identityfirst)
o<428remap>sub
#<kinstype> = 1 ; xyzac,xyzbc
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N
o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M428:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif
M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M428: Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
(debug,STOP)
M2
o2 else
o2 endif
o<428remap>endsub

View File

@@ -0,0 +1,24 @@
;M429 by remap: kinstype==0 Identity kinematics
o<429remap>sub
#<kinstype> = 0
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N
o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M429:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif
M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M429:Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
(debug,STOP)
M2
o2 else
o2 endif
o<429remap>endsub

View File

@@ -0,0 +1,24 @@
;M430 by remap: kinstype==2 userk kins
o<430remap>sub
#<kinstype> = 2
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N
o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M430:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif
M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M430:Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
(debug,STOP)
M2
o2 else
o2 endif
o<430remap>endsub

View File

@@ -0,0 +1,42 @@
(info: tests for values of [xyz]-rot-point)
o<centering>sub
#<xstart> = #1 (=-2.5)
#<ystart> = #2 (=-2.5)
#<xlen> = #3 (= 5)
#<ylen> = #4 (= 5)
#<zfinal> = #5 (=60)
#<n> = #6 (=12)
#<f> = #7 (=1000 feed)
#<angle> = 0
#<delta_angle> = [360/#<n>]
o1 if [exists [#<_hal[xyzac-trt-kins.x-rot-point]>]]
(debug,x-rot-point=#<_hal[xyzac-trt-kins.x-rot-point]>)
(debug,y-rot-point=#<_hal[xyzac-trt-kins.y-rot-point]>)
(debug,z-rot-point=#<_hal[xyzac-trt-kins.z-rot-point]>)
o1 endif
o2 if [exists [#<_hal[xyzbc-trt-kins.x-rot-point]>]]
(debug,x-rot-point=#<_hal[xyzbc-trt-kins.x-rot-point]>)
(debug,y-rot-point=#<_hal[xyzbc-trt-kins.y-rot-point]>)
(debug,z-rot-point=#<_hal[xyzac-trt-kins.z-rot-point]>)
o2 endif
M429 ;Identity kinematics
g0 x#<xstart> y#<ystart> z0 c0
M428 ;tcp
g61
o10 while [#<angle> le 360]
g1 f#<f>
#<angle> = [#<angle> + #<delta_angle>]
g0 c#<angle>
g1 x[#<xstart> + #<xlen>]
g1 y[#<ystart> + #<ylen>]
g1 x[#<xstart> + 0 ]
g1 y[#<ystart> + 0 ]
o10 endwhile
M429 ;Identity kinematics
g0 x0 y0 z#<zfinal> c0
o<centering>endsub

View File

@@ -0,0 +1,22 @@
; helix using switchkins (xyzac) a,c angles
o<helix_ac>sub
#<zmax> = #1 (=10)
#<zmin> = #2 (= 5)
#<r> = #3 (=10)
#<frate> = #4 (=1000)
#<n> = #5 (=3)
#<a> = #6 (=45)
#<b> = #7 (=0 NA)
#<c> = #8 (=20)
M429 ;Identity kinematics
g0 x[#<_x> - #<r>] ;adjust for radius
g10l20p0 x0y0 z#<zmax> a0 c0 ;new g54
M428 ;XYZAC
g0a#<a>c#<c> ;exercise a,c
f#<frate> g2i#<r>z#<zmin> p#<n> ;helix
M429 ;Identity kinematics
g0 x0 y0 z#<zmax> a0 c0 ;return to start
g0 x[#<_x> + #<r>] ;adjust restore
M428 ;XYZAC
o<helix_ac>endsub

View File

@@ -0,0 +1,22 @@
; helix using switchkins (xyzbc) b,c angles
o<helix_bc>sub
#<zmax> = #1 (=10)
#<zmin> = #2 (= 5)
#<r> = #3 (=10)
#<frate> = #4 (=1000)
#<n> = #5 (=3)
#<a> = #6 (=0 NA)
#<b> = #7 (=45)
#<c> = #8 (=20)
M429 ;Identity kinematics
g0 x[#<_x> - #<r>] ;adjust for radius
g10l20p0 x0y0 z#<zmax> b0 c0 ;new g54
M428 ;XYZBC
g0b#<b>c#<c> ;exercise b,c
f#<frate> g2i#<r>z#<zmin> p#<n> ;helix
M429 ;Identity kinematics
g0 x0 y0 z#<zmax> b0 c0 ;return to start
g0 x[#<_x> + #<r>] ;adjust restore
M428 ;XYZBC
o<helix_bc>endsub

View File

@@ -0,0 +1,47 @@
; ngcgui-compatible subroutine
(info: helix in each quadrant at angles A,C)
o<xyzac_switchkins_sub>sub
#<zmax> = #1 (=10)
#<zmin> = #2 (= 5)
#<r> = #3 (=10 radius)
#<frate> = #4 (=1000 feedrate)
#<n> = #5 (=3 n circles)
#<a> = #6 (=30 A angle)
#<b> = #7 (=0 B angle NA)
#<c> = #8 (=45 C angle)
#<dist> = #9 (=20 distance)
; quadrant I
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> a0 c0 ;MACHINE coordinates
g10l20p0 x0y0 z#<zmax> a0 c0 ;new g54
g0 x+#<dist> y+#<dist> z#<zmax> ;move to pattern center position
o<helix_ac> call [#<zmax>][#<zmin>][#<r>][#<frate>][#<n>][#<a>][#<b>][#<c>]
; quadrant II
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> a0 c0
g10l20p0 x0y0 z#<zmax> a0 c0
g0 x-#<dist> y+#<dist> z#<zmax>
o<helix_ac> call [#<zmax>][#<zmin>][#<r>][#<frate>][#<n>][#<a>][#<b>][#<c>]
; quadrant III
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> a0 c0
g10l20p0 x0y0 z#<zmax> a0 c0
g0 x-#<dist> y-#<dist> z#<zmax>
o<helix_ac> call [#<zmax>][#<zmin>][#<r>][#<frate>][#<n>][#<a>][#<b>][#<c>]
; quadrant IV
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> a0 c0
g10l20p0 x0y0 z#<zmax> a0 c0
g0 x+#<dist> y-#<dist> z#<zmax>
o<helix_ac> call [#<zmax>][#<zmin>][#<r>][#<frate>][#<n>][#<a>][#<b>][#<c>]
;final position
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> ;MACHINE coordinates
g10l20p0 x0y0 z#<zmax> ;new g54
o<xyzac_switchkins_sub>endsub

View File

@@ -0,0 +1,47 @@
; ngcgui-compatible subroutine
(info: helix in each quadrant at angles B,C)
o<xyzbc_switchkins_sub>sub
#<zmax> = #1 (=10)
#<zmin> = #2 (= 5)
#<r> = #3 (=10 radius)
#<frate> = #4 (=1000 feedrate)
#<n> = #5 (=3 n circles)
#<a> = #6 (=0 A angle NA)
#<b> = #7 (=30 B angle)
#<c> = #8 (=45 C angle)
#<dist> = #9 (=20 distance)
; quadrant I
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> b0 c0 ;MACHINE coordinates
g10l20p0 x0y0 z#<zmax> b0 c0 ;new g54
g0 x+#<dist> y+#<dist> z#<zmax> ;move to pattern center position
o<helix_bc> call [#<zmax>][#<zmin>][#<r>][#<frate>][#<n>][#<a>][#<b>][#<c>]
; quadrant II
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> b0 c0
g10l20p0 x0y0 z#<zmax> b0 c0
g0 x-#<dist> y+#<dist> z#<zmax>
o<helix_bc> call [#<zmax>][#<zmin>][#<r>][#<frate>][#<n>][#<a>][#<b>][#<c>]
; quadrant III
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> b0 c0
g10l20p0 x0y0 z#<zmax> b0 c0
g0 x-#<dist> y-#<dist> z#<zmax>
o<helix_bc> call [#<zmax>][#<zmin>][#<r>][#<frate>][#<n>][#<a>][#<b>][#<c>]
; quadrant IV
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> b0 c0
g10l20p0 x0y0 z#<zmax> b0 c0
g0 x+#<dist> y-#<dist> z#<zmax>
o<helix_bc> call [#<zmax>][#<zmin>][#<r>][#<frate>][#<n>][#<a>][#<b>][#<c>]
;final position
M429 ;Identity kinematics
g53 g0 x0y0 z#<zmax> ;MACHINE coordinates
g10l20p0 x0y0 z#<zmax> ;new g54
o<xyzbc_switchkins_sub>endsub