提交 xyzbc-trt 界面与验证更新

This commit is contained in:
mes123456
2026-07-02 20:25:37 -04:00
parent 68ecd05353
commit 370c344b96
868 changed files with 275426 additions and 39640 deletions

View File

@@ -0,0 +1,48 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Noto Sans'; font-size:9pt; font-weight:400; font-style:normal;">
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt; font-weight:600;">3D_Chips.ngc</span></p>
<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15pt;">This program is copyright of Rab Gordon, Gary Drew, and Paul Corner.</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15pt;"> It is released here under a GPL without warranty to do with as you may.</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15pt;"> With scales factors set at 1.0, the part is cut from a 100x100x50mm </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15pt;"> block with the zero point at the center top of the block </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15pt;"> and Cutter is assumed to be a 10mm ball nose </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15pt;"> and feedrate is 450 mm/min </span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:15pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15pt;">It uses the tool currently in the machine.</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15pt;">Last run we used tool 1:</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:15pt;"><br /></p>
<table border="1" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" cellspacing="0" cellpadding="10">
<tr>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Tool</span></p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Pocket</span></p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">X</span></p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Y</span></p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Z</span></p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Diameter</span></p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Comment</span></p></td></tr>
<tr>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">1</p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">1</p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">0</p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">0</p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">.511&quot;</p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">.394&quot;</p></td>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">10mm ball endmill</p></td></tr></table>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="IMAGEDIR/b3_endmill.png" /><span style=" font-size:15pt;"> </span></p></body></html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
n099 (This is a test plot nc program to be run on backplot)
n100 (Author Ray Henry 10-Feb-2000)
n101 g20
n102 g0 x0 y0 z0 f30
n103 x1 y1(start xy circle)
n104 g17 g02 i.5 j.5
n106 g0 z.1 (add xy lettering)
n107 y1.75
n108 z0
n109 g1 y1.25 x1.4
n110 y1.5 x1.2
n111 y1.25 x1
n112 y1.75 x1.4
n113 g0 z.1
n114 y1.75 x1.6
n115 z0
n116 g1 y1.5 x1.8
n117 y1.75 x2
n118 y1.5 x1.8
n119 y1.25
n120 g0 x0 y0 z0
n121 x1 z1(start xz circle)
n122 g18 g02 i.5 k.5
n124 g0 y.1 (add xz lettering)
n125 z1.75
n126 y0
n127 g1 z1.25 x1.4
n128 z1.5 x1.2
n129 z1.25 x1
n130 z1.75 x1.4
n131 g0 y.1
n132 z1.75 x1.6
n133 y0
n134 g1 x2
n135 z1.25 x1.6
n136 x2
n137 g0 x0 y0 z0
n138 y1 z1 (start yz circle)
n139 g19 g02 j.5 k.5
n141 g0 x.1 (add yz lettering)
n142 z1.75
n143 x0
n144 g1 z1.5 y1.2
n145 z1.75 y1.4
n146 z1.5 y1.2
n147 z1.25
n148 g0 x.1
n149 z1.75 y1.6
n150 x0
n151 g1 y2
n152 z1.25 y1.6
n153 y2
n154 g0 x0 y0 z0
n155 m2

View File

@@ -0,0 +1,22 @@
#!/bin/sh
# M101 in your G-code program will run the Linux commands in this
# shell script "batch" file, passing the P and Q variables as command
# line arguments.
# give the command line arguments descriptive names
P=$1
Q=$2
MCMD=$(readlink -nf "$0")
MNAME=$(basename "$MCMD")
echo
echo "Example for User M-code invocation:"
echo "M-code File: $MCMD"
echo "$MNAME P$P Q$Q"
# if a M1nn command exits with nonzero status,
# the G-code program exits. So always exit 0.
exit 0

View File

@@ -0,0 +1,29 @@
#include <stdio.h>
/*
Compile this with "gcc M102.c -o M102" to build an M102 executable
program in the emc/programs/ directory. M102 in your G-code program
will execute this code, passing the P and Q variables as command
line arguments.
*/
int main(int argc, char *argv[])
{
double p = 0.0, q = 0.0;
/* process the P and Q command line args we will be given */
if (argc > 1) {
sscanf(argv[1], "%lf", &p);
}
if (argc > 2) {
sscanf(argv[2], "%lf", &q);
}
/* put your code here */
printf("M102 P%f Q%f: put your code here\n", p, q);
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
; this file tests the lock/unlock of an indexing rotary.
; run it with a configuration having [AXIS_4]LOCKING_INDEXER=1
g20 g90
g0b0
g0x0y0z0
g1x1f70
g0x2
b45
x3
b90
x2
b0
x1
m2

View File

@@ -0,0 +1,284 @@
(Circle Diamond Square Program)
(Tom Kramer)
(26-Sep-1994)
(Assumes 4"x4"x2" finished stock)
(Top of stock at Z=2")
(X: 0.000 to 4.0)
(Y: -0.250 to 3.915)
(Z: 1.406 to 3.0)
(Cutter does not descend more than 0.94" below top)
n0080 G90 M9
n0090 G43 H1 g20
n0140 F16.0 S3500 M3
n0150 (MILLING AN ENCLOSED POCKET)
n0155 G0 Z+2.1
n0160 G0 X+0.0 Y+3.915
n0170 G0 Z+2.1
n0180 G1 Z+1.6875 (start left circle zigzag)
n0190 G1 X+4.0
n0200 G1 Y+3.725
n0210 G1 X+0.0
n0220 G1 Y+3.535
n0230 G1 X+1.437
n0240 G3 X+1.0704 Y+3.345 R+1.635
n0250 G1 X+0.0
n0260 G1 Y+3.155
n0270 G1 X+0.8428
n0280 G3 X+0.6802 Y+2.965 R+1.635
n0290 G1 X+0.0
n0300 G1 Y+2.775
n0310 G1 X+0.5603
n0320 G3 X+0.4732 Y+2.585 R+1.635
n0330 G1 X+0.0
n0340 G1 Y+2.395
n0350 G1 X+0.4134
n0360 G3 X+0.3779 Y+2.205 R+1.635
n0370 G1 X+0.0
n0380 G1 Y+2.015
n0390 G1 X+0.3651
n0400 G3 X+0.365 Y+2.0 R+1.635
n0410 G3 X+0.3744 Y+1.825 R+1.635
n0420 G1 X+0.0
n0430 G1 Y+1.635
n0440 G1 X+0.4063
n0450 G3 X+0.4621 Y+1.445 R+1.635
n0460 G1 X+0.0
n0470 G1 Y+1.255
n0480 G1 X+0.5446
n0490 G3 X+0.6587 Y+1.065 R+1.635
n0500 G1 X+0.0
n0510 G1 Y+0.875
n0520 G1 X+0.8136
n0530 G3 X+1.0284 Y+0.685 R+1.635
n0540 G1 X+0.0
n0550 G1 Y+0.495
n0560 G1 X+1.3611
n0570 G3 X+2.0 Y+0.365 R+1.635
n0580 G3 X+2.6389 Y+0.495 R+1.635
n0590 G1 X+4.0
n0600 G1 Y+0.305
n0610 G1 X+0.0
n0620 G1 Y+0.115
n0630 G1 X+4.0
n0640 G0 Z+3.0 (end left circle zigzag)
n0650 G0 X+1.437 Y+3.535
n0660 G0 Z+2.1
n0670 G1 Z+1.6875 (start right circle zigzag)
n0680 G2 X+2.0 Y+3.635 R+1.635
n0690 G2 X+2.563 Y+3.535 R+1.635
n0700 G1 X+4.0
n0710 G1 Y+3.345
n0720 G1 X+2.9296
n0730 G2 X+3.1572 Y+3.155 R+1.635
n0740 G1 X+4.0
n0750 G1 Y+2.965
n0760 G1 X+3.3198
n0770 G2 X+3.4397 Y+2.775 R+1.635
n0780 G1 X+4.0
n0790 G1 Y+2.585
n0800 G1 X+3.5268
n0810 G2 X+3.5866 Y+2.395 R+1.635
n0820 G1 X+4.0
n0830 G1 Y+2.205
n0840 G1 X+3.6221
n0850 G2 X+3.6349 Y+2.015 R+1.635
n0860 G1 X+4.0
n0870 G1 Y+1.825
n0880 G1 X+3.6256
n0890 G2 X+3.5937 Y+1.635 R+1.635
n0900 G1 X+4.0
n0910 G1 Y+1.445
n0920 G1 X+3.5379
n0930 G2 X+3.4554 Y+1.255 R+1.635
n0940 G1 X+4.0
n0950 G1 Y+1.065
n0960 G1 X+3.3413
n0970 G2 X+3.1864 Y+0.875 R+1.635
n0980 G1 X+4.0
n0990 G1 Y+0.685
n1000 G1 X+2.9716 (end right circle zigzag)
n1010 G0 Z+3.0 (boundary cut deleted)
n1140 G0 X+2.0 Y+0.375 (start cut around circle)
n1150 G0 Z+2.1
n1160 G1 Z+1.6875
n1170 G2 X+0.375 Y+2.0 R+1.625
n1180 G2 X+2.0 Y+3.625 R+1.625
n1190 G2 X+3.625 Y+2.0 R+1.625
n1200 G2 X+2.0 Y+0.375 R+1.625
n1210 G1 Z+2.1 (end cut around circle)
n1220 G0 Z+3.0
n1230 (MILLING AN ENCLOSED POCKET)
n1240 G0 X+1.4732 Y+3.59
n1250 G0 Z+2.1 (start left diamond zigzag)
n1260 G1 Z+1.8437
n1270 G1 X+1.8991
n1280 G1 X+1.7091 Y+3.4
n1290 G1 X+1.0804
n1300 G3 X+0.8418 Y+3.21 R+1.675
n1310 G1 X+1.5191
n1320 G1 X+1.3291 Y+3.02
n1330 G1 X+0.6714
n1340 G3 X+0.5451 Y+2.83 R+1.675
n1350 G1 X+1.1391
n1360 G1 X+0.9491 Y+2.64
n1370 G1 X+0.4521
n1380 G3 X+0.3866 Y+2.45 R+1.675
n1390 G1 X+0.7591
n1400 G1 X+0.5691 Y+2.26
n1410 G1 X+0.3453
n1420 G3 X+0.3265 Y+2.07 R+1.675
n1430 G1 X+0.3846
n1440 G3 X+0.4045 Y+1.9045 R+0.135
n1450 G1 X+0.4291 Y+1.88
n1460 G1 X+0.3293
n1470 G3 X+0.3539 Y+1.69 R+1.675
n1480 G1 X+0.6191
n1490 G1 X+0.8091 Y+1.5
n1500 G1 X+0.4014
n1510 G3 X+0.4737 Y+1.31 R+1.675
n1520 G1 X+0.9991
n1530 G1 X+1.1891 Y+1.12
n1540 G1 X+0.5748
n1550 G3 X+0.7113 Y+0.93 R+1.675
n1560 G1 X+1.3791
n1570 G1 X+1.5691 Y+0.74
n1580 G1 X+0.8964
n1590 G3 X+1.1615 Y+0.55 R+1.675
n1600 G1 X+1.7591
n1610 G1 X+1.9045 Y+0.4045
n1620 G3 X+2.0955 Y+0.4045 R+0.135
n1630 G1 X+2.2409 Y+0.55
n1640 G1 X+2.8385
n1650 G2 X+2.3406 Y+0.36 R+1.675
n1660 G1 X+1.6594
n1670 G0 Z+3.0 (end left diamond zigzag)
n1680 G0 X+1.8991 Y+3.59
n1690 G0 Z+2.1 (start right diamond zigzag)
n1700 G1 Z+1.8437
n1710 G1 X+1.9045 Y+3.5955
n1720 G2 X+2.0955 Y+3.5955 R+0.135
n1730 G1 X+2.1009 Y+3.59
n1740 G1 X+2.5268
n1750 G2 X+2.9196 Y+3.4 R+1.675
n1760 G1 X+2.2909
n1770 G1 X+2.4809 Y+3.21
n1780 G1 X+3.1582
n1790 G2 X+3.3286 Y+3.02 R+1.675
n1800 G1 X+2.6709
n1810 G1 X+2.8609 Y+2.83
n1820 G1 X+3.4549
n1830 G2 X+3.5479 Y+2.64 R+1.675
n1840 G1 X+3.0509
n1850 G1 X+3.2409 Y+2.45
n1860 G1 X+3.6134
n1870 G2 X+3.6547 Y+2.26 R+1.675
n1880 G1 X+3.4309
n1890 G1 X+3.5955 Y+2.0955
n1900 G2 X+3.6154 Y+2.07 R+0.135
n1910 G1 X+3.6735
n1920 G2 X+3.675 Y+2.0 R+1.675
n1930 G2 X+3.6707 Y+1.88 R+1.675
n1940 G1 X+3.5709
n1950 G1 X+3.3809 Y+1.69
n1960 G1 X+3.6461
n1970 G2 X+3.5986 Y+1.5 R+1.675
n1980 G1 X+3.1909
n1990 G1 X+3.0009 Y+1.31
n2000 G1 X+3.5263
n2010 G2 X+3.4252 Y+1.12 R+1.675
n2020 G1 X+2.8109
n2030 G1 X+2.6209 Y+0.93
n2040 G1 X+3.2887
n2050 G2 X+3.1036 Y+0.74 R+1.675
n2060 G1 X+2.4309 (end right diamond zigzag)
n2070 G0 Z+3.0 (boundary cut deleted)
n2160 G0 X+2.0884 Y+0.4116
n2170 G0 Z+2.1 (start diamond boundary)
n2180 G1 Z+1.8437
n2190 G2 X+1.9116 Y+0.4116 R+0.125
n2200 G1 X+0.4116 Y+1.9116
n2210 G2 X+0.4116 Y+2.0884 R+0.125
n2220 G1 X+1.9116 Y+3.5884
n2230 G2 X+2.0884 Y+3.5884 R+0.125
n2240 G1 X+3.5884 Y+2.0884
n2250 G2 X+3.5884 Y+1.9116 R+0.125
n2260 G1 X+2.0884 Y+0.4116
n2270 G1 Z+2.1
n2280 g0 z+3.0
n2290 g0 x+2.0 y+3.8
n2300 g0 z+2.1 (start diamond top)
n2310 g1 z+2.0
n2320 g1 y+3.5
n2330 g1 x+2.1 y+3.4
n2340 g1 x+1.9
n2350 g1 x+1.7 y+3.2
n2360 g1 x+2.3
n2370 g1 x+2.5 y+3.0
n2380 g1 x+1.5
n2390 g1 x+1.3 y+2.8
n2400 g1 x+2.7
n2410 g1 x+2.9 y+2.6
n2420 g1 x+1.1
n2430 g1 x+0.9 y+2.4
n2440 g1 x+3.1
n2450 g1 x+3.3 y+2.2
n2460 g1 x+0.7
n2470 g1 x+0.5 y+2.0
n2480 g1 x+3.5
n2490 g1 x+3.3 y+1.8
n2500 g1 x+0.7
n2510 g1 x+0.9 y+1.6
n2520 g1 x+3.1
n2530 g1 x+2.9 y+1.4
n2540 g1 x+1.1
n2550 g1 x+1.3 y+1.2
n2560 g1 x+2.7
n2570 g1 x+2.5 y+1.0
n2580 g1 x+1.5
n2590 g1 x+1.7 y+0.8
n2600 g1 x+2.3
n2610 g1 x+2.1 y+0.6
n2620 g1 x+1.1
n2630 g0 z+3.0 (end diamond top)
n3020 g0 x+0.0 y-0.25
n3030 g0 z+2.1 (start left and back ramps)
n3040 g1 z+1.37
n3050 g1 y+0.0
n3060 g1 y+2.0 z+1.375
n3070 g1 y+4.0 z+1.37
n3080 g1 x+2.0 z+1.375
n3090 g1 x+4.0 z+1.37
n3100 g1 y+3.8125
n3110 g1 x+2.0 y+3.8175 z+1.375
n3120 g1 x+0.0 y+3.8125 z+1.37
n3130 g1 x+0.1875 y+4.0
n3140 g1 x+0.1825 y+2.0 z+1.375
n3150 g1 x+0.1875 y+0.0 z+1.37 (end left and back ramps)
n3160 g1 x+0.375 z+1.53125 (start left and back ledges)
n3170 g1 y+3.625
n3180 g1 x+4.0 (end left and back ledges)
n3190 g1 y+4.0 z+1.37 (start right and front ramps)
n3300 g1 y+0.5 z+1.06379
n3310 g1 y+0.0
n3320 g1 x+3.5
n3330 g1 x+0.0 z+1.37
n3340 g1 y+0.125
n3350 g1 x+3.5 z+1.06379
n3360 g1 x+3.875
n3370 g1 y+0.5
n3380 g1 y+4.0 z+1.37
n3390 g1 x+3.75
n3400 g1 y+0.5 z+1.06379
n3410 g1 y+0.25
n3420 g1 x+3.5
n3430 g1 x+0.0 z+1.37
n3440 g1 y+0.375
n3450 g1 x+3.5 z+1.06379
n3460 g1 x+3.625
n3470 g1 y+0.5
n3480 g1 y+4.0 z+1.37
n3490 g0 z+3.0 (end right and front ramps)
n3500 M5
n3510 M2

View File

@@ -0,0 +1,39 @@
(comp-g1.ngc)
(This is the program shows a G1 straight feed entry and exit move)
(with cutter radius compensation from the tool table)
(tool 4 is 1" in diameter and must be defined in the tool table)
(this file needs X-4 to X5 travel and Y-3 to Y5 travel)
G20 (set units to inches)
F60 (set feed to 60 IPM)
(first, no compensation so we can see the part outline)
G0 Z1
G0 X2 Y3
G1 Z0
G2 X3 Y2 J-1 (part outline)
G1 Y-1
G2 X2 Y-2 I-1
G1 X-3
G1 X1.4 Y2.8
G2 X2 Y3 I.6 J-.8
(with compensation)
T4 M6 (change tool)
G0 Z1
(straight line entries must not form a concave path or it is an error)
G0 X0 Y3.5 (change Y3.5 to Y4 to see the concave entry error)
G1 Z0
G41 (turn cutter comp left on)
G1 X2 Y3 (entry move)
G2 X3 Y2 J-1 (same path as above)
G1 Y-1
G2 X2 Y-2 I-1
G1 X-3
G1 X1.4 Y2.8
G2 X2 Y3 i.6 J-.8
G40 (turn cutter comp off)
G1 X3 Y3.5 (exit move can be any angle)
T0 M6 (remove tool)
M2

View File

@@ -0,0 +1,61 @@
g20 g64 g17
g0x-.2y-.2z0
f30
g40
g1x0y0
g1y1
g3r.25x-.25y1.25
g1x-.5
g2r.25x-.75y1.5
g1y1.75
g0x-.2y-.2z0
g42 d1
g1x0y0
g1y1
g3r.25x-.25y1.25
g1x-.5
g2r.25x-.75y1.5
g1y1.75
g40
g0x.2y-.2z0
g41 d1
g1x0y0
g1y1
g3r.25x-.25y1.25
g1x-.5
g2r.25x-.75y1.5
g1y1.75
g40
g20 g64 g18
g0x-.2z-.2y0
g40
g1x0z0
g1z1
g2r.25x-.25z1.25
g1x-.5
g3r.25x-.75z1.5
g1z1.75
g0x-.2z-.2y0
g42 d1
g1x0z0
g1z1
g2r.25x-.25z1.25
g1x-.5
g3r.25x-.75z1.5
g1z1.75
g40
g0x.2z-.2y0
g41 d1
g1x0z0
g1z1
g2r.25x-.25z1.25
g1x-.5
g3r.25x-.75z1.5
g1z1.75
g40
g0x.2z-.2y0
m2

View File

@@ -0,0 +1,37 @@
(this is the program describing entry moves for)
(radius compensation in Figure 3 of the Handbook)
(http://linuxcnc.org/docs/2.9/html/gcode/tool-compensation.html)
g20 f60
(first, no compensation so we can see the part outline)
g0 z1
g0 x1 y5
g1 z0
g1 y4
g3 x2 y3 i1
g2 x3 y2 j-1
g1 y-1
g2 x2 y-2 i-1
g1 x-2
g2 x-2.6 y-0.2 j1
g1 x1.4 y2.8
g2 x2 y3 i.6 j-.8
(with compensation)
t4 m6
g0 z1
g0 x1 y5
g1 z0
g41 g1 y4
g3 x2 y3 i1
g2 x3 y2 j-1
g1 y-1
g2 x2 y-2 i-1
g1 x-2
g2 x-2.6 y-0.2 j1
g1 x1.4 y2.8
g2 x2 y3 i.6 j-.8
g40
m2

View File

@@ -0,0 +1,36 @@
(this is the program describing entry moves for)
(radius compensation in Figure 3 of the Handbook)
(http://www.linuxcnc.org/handbook/RS274NGC_3/RS274NGC_38a.html#999268)
g20 f60
(first, no compensation so we can see the part outline)
g0 z1
g0 x1 y4
g1 z0
g3 x2 y3 i1
g2 x3 y2 j-1
g1 y-1
g2 x2 y-2 i-1
g1 x-2
g2 x-2.6 y-0.2 j1
g1 x1.4 y2.8
g2 x2 y3 i.6 j-.8
(with compensation)
t4 m6
g0 z1
g0 x1 y4
g1 z0
g41
g3 x2 y3 i1
g2 x3 y2 j-1
g1 y-1
g2 x2 y-2 i-1
g1 x-2
g2 x-2.6 y-0.2 j1
g1 x1.4 y2.8
g2 x2 y3 i.6 j-.8
g40
m2

View File

@@ -0,0 +1,42 @@
(for the simulated 5 axis machine)
g21 g90 g94 g28
o200 sub
g0 b0 c0 (tool length change must happen with b,c=0)
g91 g28 z0 (could also be done with tool change position)
g90
g43.1 z#1 (change tool length)
g0z0 (move Z to apply new length)
x-100 b-45 c-180
g1 z-100 f2000
#100=-180
o100 while [ #100 le 180 ]
g1 x[100*cos[#100]] y[100*sin[#100]] c#100
#100=[#100+10]
o100 endwhile
g0 z0
x0 y0 b0 c0
o200 endsub
(cut around the "cone" with different tool lengths)
o200 call [50]
o200 call [80]
g61
g0 x-100 b-45 c-180
#100=-180
o101 while [ #100 lt 180 ]
g0 x[150*cos[#100]] y[150*sin[#100]] z-100 c#100
g1 w100 f2000 (drill)
g0 w0
#100=[#100+45]
o101 endwhile
g28
g49
m2

View File

@@ -0,0 +1,159 @@
G20
O100 sub ([f0] [f1] [f2] [f3])
#61=#1
O110 if [#2 gt 0]
#62=#2
O110 else
#62=#1
O110 endif
O111 if [#3 gt 0]
#63=#3
O111 else
#63=#1
O111 endif
O112 if [#4 gt 0]
#64=#4
O112 else
#64=#1
O112 endif
#41=0 #42=0 #43=0 #44=0
G0 X0Y0Z0A0
G93
O100 endsub
O200 sub ([t] [p1] [p2] [p3] [p4])
(Find new X)
#2=[#2*#1/#61]
O210 if [#41 gt 0]
#41=[#41-#2]
O210 else
#41=[#41+#2]
O210 endif
(Find new Y)
#3=[#3*#1/#62]
O220 if [#42 gt 0]
#42=[#42-#3]
O220 else
#42=[#42+#3]
O220 endif
(Find new Z)
#4=[#4*#1/#63]
O230 if [#43 gt 0]
#43=[#43-#4]
O230 else
#43=[#43+#4]
O230 endif
(Find new A)
#5=[#5*#1/#64]
O240 if [#44 gt 0]
#44=[#44-#5]
O240 else
#44=[#44+#5]
O240 endif
G1 X#41 Y#42 Z#43 A#44 F[60/#1]
O200 endsub
#100 = [440*1.781797] (Key of G)
(equal temperament chromatic scale)
#101 = [#100*1.059463] (g#)
#102 = [#100*1.122462] (a)
#103 = [#100*1.189207] (a#)
#104 = [#100*1.259921] (b)
#105 = [#100*1.334840] (c)
#106 = [#100*1.414214] (c#)
#107 = [#100*1.498307] (d)
#108 = [#100*1.587401] (d#)
#109 = [#100*1.681793] (e)
#110 = [#100*1.781797] (f)
#111 = [#100*1.887749] (f#)
(set XYZA axis scales)
O100 call [6400] [6400] [8000] [80]
G4P2
O200 call [1] [#107] [#100/2.0] [#104/2.0] [0] (Dai-) (G)
O200 call [1] [#104] [#100/2.0] [#104/2.0] [0] (-sy)
O200 call [1] [#100] [#100/2.0] [#104/2.0] [#107/2.0] (Dai-)
O200 call [1] [#107/2.0] [#100/2.0] [#104/2.0] [#110/2.0] (-sy) (G7)
O200 call [0.333] [#109/2.0] [#100/2.0] [#105/2.0] [#109/2.0] (Give) (C)
O200 call [0.333] [#111/2.0] [#100/2.0] [#105/2.0] [#109/2.0] (me)
O200 call [0.333] [#100] [#100/2.0] [#105/2.0] [#109/2.0] (your)
O200 call [0.667] [#109/2.0] [#102/2.0] [#105/2.0] [#100] (ans-) (Am7)
O200 call [0.333] [#100] [#102/2.0] [#105/2.0] [#100] (-wer)
O200 call [2] [#107/2.0] [#100/2.0] [#104/2.0] [#107/2.0] (do.) (G)
O200 call [1] [#102] [#111/4.0] [#105/2.0] [#107/2.0] (I'm) (D7)
O200 call [1] [#107] [#111/4.0] [#105/2.0] [#107/2.0] (half)
O200 call [1] [#104] [#100/2.0] [#104/2.0] [#107/2.0] (cra-) (G)
O200 call [1] [#100] [#100/2.0] [#104/2.0] [#109/2.0] (-zy) (Em)
O200 call [0.333] [#109/2.0] [#102/2.0] [#106/2.0] [#100] (All) (A7)
O200 call [0.333] [#111/2.0] [#102/2.0] [#106/2.0] [#100] (for)
O200 call [0.333] [#100] [#102/2.0] [#106/2.0] [#100] (the)
O200 call [0.667] [#102] [#102/2.0] [#106/2.0] [#100] (love)
O200 call [0.333] [#104] [#102/2.0] [#106/2.0] [#100] (of)
O200 call [1.667] [#102] [#111/4.0] [#105/2.0] [#107/2.0] (you..) (D7)
O200 call [0.333] [#104] [#111/4.0] [#105/2.0] [#107/2.0] (it)
O200 call [0.333] [#105] [#111/4.0] [#105/2.0] [#107/2.0] (won't) (D7)
O200 call [0.333] [#104] [#111/4.0] [#105/2.0] [#107/2.0] (be)
O200 call [0.333] [#102] [#111/4.0] [#105/2.0] [#107/2.0] (a)
O200 call [0.667] [#107] [#111/4.0] [#105/2.0] [#107/2.0] (sty-)
O200 call [0.333] [#104] [#111/4.0] [#105/2.0] [#107/2.0] (-lish)
O200 call [0.333] [#102] [#100/2.0] [#104/2.0] [#107/2.0] (marr-) (G)
O200 call [1.333] [#100] [#100/2.0] [#104/2.0] [#107/2.0] (iage...)
O200 call [0.333] [#102] [#100/2.0] [#104/2.0] [#107/2.0] (I)
O200 call [0.667] [#104] [#100/2.0] [#104/2.0] [#107/2.0] (can't)
O200 call [0.333] [#100] [#100/2.0] [#104/2.0] [#107/2.0] (a-)
O200 call [0.667] [#109/2.0] [#100/2.0] [#105/2.0] [#109/2.0] (-fford) (C)
O200 call [0.333] [#100] [#100/2.0] [#105/2.0] [#109/2.0] (a)
O200 call [0.333] [#109/2.0] [#100/2.0] [#104/2.0] [#107/2.0] (carr-) (G)
O200 call [1.333] [#107/2.0] [#100/2.0] [#104/2.0] [#107/2.0] (iage...)
O200 call [0.333] [#107/2.0] [#100/2.0] [#104/2.0] [#107/2.0] (but)
O200 call [0.667] [#100] [#100/2.0] [#104/2.0] [#107/2.0] (you'll) (G)
O200 call [0.333] [#104] [#100/2.0] [#104/2.0] [#107/2.0] (look)
O200 call [0.667] [#102] [#111/4.0] [#105/2.0] [#107/2.0] (sweet) (D7)
O200 call [0.333] [#107/2.0] [#111/4.0] [#105/2.0] [#107/2.0] (up-)
O200 call [0.667] [#100] [#100/2.0] [#104/2.0] [#107/2.0] (-on) (G)
O200 call [0.333] [#104] [#100/2.0] [#104/2.0] [#107/2.0] (the)
O200 call [0.333] [#102] [#111/4.0] [#105/2.0] [#107/2.0] (seat) (D7)
O200 call [0.333] [#104] [#111/4.0] [#105/2.0] [#107/2.0] (of)
O200 call [0.333] [#105] [#111/4.0] [#105/2.0] [#107/2.0] (a)
O200 call [0.333] [#107] [#100/2.0] [#104/2.0] [#107/2.0] (bi-) (G)
O200 call [0.333] [#104] [#100/2.0] [#104/2.0] [#107/2.0] (-cy-)
O200 call [0.333] [#100] [#100/2.0] [#104/2.0] [#107/2.0] (-cle)
O200 call [0.667] [#102] [#111/4.0] [#105/2.0] [#107/2.0] (built) (D7)
O200 call [0.333] [#107/2.0] [#111/4.0] [#105/2.0] [#107/2.0] (for)
O200 call [2] [#100] [#100/4.0] [#104/2.0] [#107/2.0] (two.) (G)
G4P2
G0 X0Y0Z0A0
M2

View File

@@ -0,0 +1,11 @@
; recursive function example
; factorial
o<factorial> sub
o<factorialif> if [[#1] EQ 0]
o<factorial> return [1]
o<factorialif> else
o<factorial> call [[#1] - 1]
o<factorial> return [#<_value> * #1]
o<factorialif> endif
o<factorial> endsub
m2

View File

@@ -0,0 +1,64 @@
import sys
from qtpy.QtWidgets import (QApplication, QDialog, QDialogButtonBox,
QVBoxLayout,QDialogButtonBox)
from qtpy.QtCore import QTimer, Qt
class CustomDialog(QDialog):
def __init__(self, *args, **kwargs):
super(CustomDialog, self).__init__(*args, **kwargs)
self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)
self.setWindowTitle("Filter-with-GUI Test")
QBtn = QDialogButtonBox.Cancel
self.buttonBox = QDialogButtonBox(QBtn)
self.buttonBox.rejected.connect(self.reject)
self.layout = QVBoxLayout()
self.layout.addWidget(self.buttonBox)
self.setLayout(self.layout)
self._percentDone = 0
self._timer = QTimer()
self._timer.timeout.connect(self.process)
self._timer.start(100)
def reject(self):
# This provides an error message
print('You asked to cancel before finished.', file=sys.stderr)
raise SystemExit(1)
def process(self):
try:
# output a line of gcode
print('(MSG, made line of code : {})'.format(self._percentDone), file=sys.stdout)
# keep track of progress
self._percentDone +=1
# update progress
print('FILTER_PROGRESS={}'.format(self._percentDone), file=sys.stderr)
# if done end with no error/error message
if self._percentDone == 100:
print("m2")
raise SystemExit(0)
except Exception as e:
# This provides an error message
print(('Something bad happened:',e), file=sys.stderr)
# this signals the error message should be shown
raise SystemExit(1)
if __name__ == "__main__":
app = QApplication(sys.argv)
w = CustomDialog()
w.show()
sys.exit( app.exec_() )

View File

@@ -0,0 +1,19 @@
import time
import sys
for i in range(0,100):
try:
# simulate calculation time
time.sleep(.1)
# output a line of gcode
print('G0 X1', file=sys.stdout)
# update progress
print('FILTER_PROGRESS={}'.format(i), file=sys.stderr)
except:
# This causes an error message
print('Error; But this was only a test', file=sys.stderr)
raise SystemExit(1)
print('M2', file=sys.stdout)

View File

@@ -0,0 +1,45 @@
%
(Program to mill a flowsnake)
(K. Lerman)
o1000 sub
#<level> = #1
#<startX> = #2
#<startY> = #3
#<endX> = #4
#<endY> = #5
o1001 if [#<level> EQ 0]
g1 f10 x#<endX> y#<endY>
o1001 else
#<p1X> = [[#<startX> * 2 + #<endX>]/3]
#<p1Y> = [[#<startY> * 2 + #<endY>]/3]
#<p2X> = [[#<startX> + #<endX>]/2 + [#<endY> - #<startY>]/[SQRT[12.0]]]
#<p2Y> = [[#<startY> + #<endY>]/2 - [#<endX> - #<startX>]/[SQRT[12.0]]]
#<p3X> = [[#<startX> + 2 * #<endX>]/3]
#<p3Y> = [[#<startY> + 2 * #<endY>]/3]
o1000 call [#<level>-1] [#<startX>] [#<startY>] [#<p1X>] [#<p1Y>]
o1000 call [#<level>-1] [#<p1X>] [#<p1Y>] [#<p2X>] [#<p2Y>]
o1000 call [#<level>-1] [#<p2X>] [#<p2Y>] [#<p3X>] [#<p3Y>]
o1000 call [#<level>-1] [#<p3X>] [#<p3Y>] [#<endX>] [#<endY>]
o1001 endif
o1000 endsub
S1M3
g0 z1
g0 x.25 y1.0
g1 f10 z0
#<level> = 5
#<_foobar> = 729
(debug, param 2:#2)
(debug, level:#<level>)
(debug, _foobar:#<_foo bar>)
o1000 call [#<level>] [.25] [1.0] [3.75] [1.0]
o1000 call [#<level>] [3.75] [1.0] [2.0] [3.95]
o1000 call [#<level>] [2.0] [3.95] [.25] [1.0]
g0 z1
M5
%

View File

@@ -0,0 +1,29 @@
from math import sqrt
def flowsnake(level, startX, startY, endX, endY):
if level == 0:
print("g1 f10 x", endX, "y", endY)
else:
p1X = (startX * 2 + endX)/3
p1Y = (startY * 2 + endY)/3
p2X = (startX + endX)/2 + (endY - startY)/sqrt(12.0)
p2Y = (startY + endY)/2 - (endX - startX)/sqrt(12.0)
p3X = (startX + 2 * endX)/3
p3Y = (startY + 2 * endY)/3
flowsnake(level-1, startX, startY, p1X, p1Y)
flowsnake(level-1, p1X, p1Y, p2X, p2Y)
flowsnake(level-1, p2X, p2Y, p3X, p3Y)
flowsnake(level-1, p3X, p3Y, endX, endY)
print("S1M3")
print("g0 z1")
print("g0 x.25 y1.0")
print("g1 f10 z0")
flowsnake(5, .25, 1.0, 3.75, 1.0)
flowsnake(5, 3.75, 1.0, 2.0, 3.95)
flowsnake(5, 2.0, 3.95, .25, 1.0)
print("g0 z1")
print("M2")

View File

@@ -0,0 +1,14 @@
;
O<g20sub> sub
M70 (save in current call context)
g20 (imperial)
g90 (absolute mode)
f4 (much faster feed)
G0 X1.0 Y1.0 (move absolute to 1in/1in)
M71 (restore to caller context)
O<g20sub> endsub
m2

View File

@@ -0,0 +1,115 @@
(cut a small 1/4-20 thread and part it)
(t1 is for facing and left turning, t4 is threading tool, t9 parting)
(proper tool offsets should be set in the tool table!)
g20 g64 g18
(face and turn outside diameter)
t1 m6
s1200 m3
g4p1
g43
g0z0x.2
f4
g1x-.0625
g0z.1
x.120
f5
g1z-.55
g0x.2
(round the end)
o100 sub
g0z1x-1
g41
g0z1
g2 x0 z0 r1
g3 x3.05 z-3.05 i0 k-3.05
g91
g2 z-1.5 x1 r1.5
g90
g40
g0 x4.5
o100 endsub
g21
f50
g0z1.3
g92z0
o100 call
f50
g92.1
g0z.9
g92z0
o100 call
g92.1
g0z.5
g92z0
o100 call
g92.1
g0z.3
g92z0
o100 call
g92.1
g0z.1
g92z0
o100 call
g92.1
g0z0
g92z0
o100 call
g0z0
o100 call
g92.1
g0z-.025
g92z0
o100 call
g92.1
m5
g20
f5
(thread)
t4 m6
g43
s800 m3
g4p1
g0z.2x.2
(p = thread pitch, distance per revolution)
(z = end of drive line)
(i = offset from drive line to thread peaks)
( negative i means the threads are at a smaller radius than the drive line,)
( so i is negative for outside threads, positive for inside threads)
(j = initial cut depth; subsequent depths follow degression formula)
(r = depth degression: 1.0 = constant depth, 2.0 = constant area)
( any number >= 1.0 allowed)
(k = full thread depth)
(q = "compound slide" angle)
(h = number of spring passes)
(e = distance along drive line used for tapered start/end)
(l = which ends get the taper: 0 = neither, 1 = begin, 2 = end, 3 = both)
g76 p.05 z-.5 i-.075 j.008 k.045 h3 r2.0 q29.5 e.05 l2
g0x.5
g0z0
m5
(part)
t9 m6
g43
s400 m3
g4p1
g0z-.6x.135
g1x0f.2
g0x.2
m2

View File

@@ -0,0 +1,37 @@
o<g881> sub
(debug, in g881); x=[#1] y=[#2] z=[#3] r=[#4])
(debug, g881 call_level= #<_call_level> remap_level=#<_remap_level>)
o<g881_havex> if [EXISTS[#<x>]]
(debug, X param set: #<x>)
o<g881_havex> endif
o<g881_havey> if [EXISTS[#<y>]]
(debug, Y param set: #<y>)
o<g881_havey> endif
o<g881_havez> if [EXISTS[#<z>]]
(debug, Z param set: #<z>)
o<g881_havez> endif
o<g881_havep> if [EXISTS[#<p>]]
(debug, P param set: #<p>)
o<g881_havep> endif
o<g881_haveq> if [EXISTS[#<q>]]
(debug, Q param set: #<q>)
o<g881_haveq> endif
o<g881_haver> if [EXISTS[#<r>]]
(debug, R param set: #<r>)
o<g881_haver> endif
;m250
(debug, end g881)
o<g881> endsub [1]
m2

View File

@@ -0,0 +1,5 @@
o<g881min> sub
(debug, in g881min, nargs=#<n_args>)
; #<n_args> = 31
o<g881min> endsub [1]
m2

View File

@@ -0,0 +1,6 @@
o<g882> sub
(debug, in g882 x=[#1] y=[#2] z=[#3] r=[#4], next is M75)
m75p1q47
o<g882> endsub [1]
m2

View File

@@ -0,0 +1,196 @@
/* renamed from cc_hole.gcmc for clarity
*
* G-code meta compiler
*
* Copyright (C) 2014 B. Stultiens
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Hole milling example
* --------------------
* Mill a hole in continuous curvature movements. Not a single straight line is
* required to mill an arbitrary large hole from any size milling bit.
* Continuous curvature milling reduces the stress on the mill, bit and object
* by preventing any jerking.
*
* A hole is milled at a given center and depth with a target radius. The
* milling-bit radius and the cutting step define how many turning cycles are
* required to finish the hole. The mill is retracted with a helical move back
* to the center and starting Z-position.
*
* @@@--svg-toolwidth 6.0 --svg-opacity 0.2@@@
*/
feedrate(600mm);
function cc_hole(center, targetradius, toolradius, cutstep, cutz)
{
local mkunitsum = ismodemm() ? 0.0mm : 0.0in;
local oldz = position()[2];
if(!isvector(center) || count(center) < 1) {
error("Center argument must be a vector and must have at least one X or Y coordinate");
return;
}
if(count(center) > 3) {
error("Center argument has more than 3 axes defined, may cause unforeseen problems");
return;
}
if(count(center) > 2 && !isundef(center[2])) {
warning("Center argument has a Z-coordinate, ignoring to prevent plowing into object");
center = head(center, 2);
}
if((count(center) == 1 && isundef(center[0])) || (count(center) > 1 && isundef(center[0]) && isundef(center[1]))) {
warning("Center argument has neither X nor Y coordinate, using current position");
center = head(position(), 2);
}
if(!isscalar(targetradius)) {
error("Target radius argument must be scalar");
return;
}
if(!isnone(targetradius) && !isdistance(targetradius)) {
error("Target radius argument must be a distance");
return;
}
targetradius += mkunitsum; // Make sure we have units
if(targetradius <= 0.0mm) {
error("Target radius argument must be larger than zero");
return;
}
if(!isscalar(toolradius)) {
error("Tool radius argument must be scalar");
return;
}
if(!isnone(toolradius) && !isdistance(toolradius)) {
error("Tool radius argument must be a distance");
return;
}
toolradius += mkunitsum; // Make sure we have units
if(toolradius <= 0.0mm) {
error("Tool radius argument must be larger than zero");
return;
}
if(targetradius <= toolradius) {
error("Hole target radius (", targetradius, ") must be larger than tool radius (", toolradius, ")");
return;
}
if(!isscalar(cutstep)) {
error("Cutting step argument must be scalar");
return;
}
if(!isnone(cutstep) && !isdistance(cutstep)) {
error("Cutting step must be a distance");
return;
}
cutstep += mkunitsum; // Make sure we have units
if(cutstep <= 0.0mm) {
error("Cutting step argument must be larger than zero");
return;
}
if(!isscalar(cutz)) {
error("Cutting depth argument must be scalar");
return;
}
if(!isnone(cutz) && !isdistance(cutz)) {
error("Cutting depth must be a distance");
return;
}
cutz += mkunitsum; // Make sure we have units
if(cutstep > 2.0*toolradius) {
warning("Cutting step is larger than twice the tool radius, not all material will be removed");
} elif(cutstep == 2.0*toolradius) {
warning("Cutting step is exactly twice the tool radius, material may be left at the inner edge");
}
comment("-- cc_hole center=", center, " targetradius=", targetradius, " toolradius=", toolradius, " cutstep=", cutstep, " cutz=", cutz, " --");
goto(center); // Center of the hole
move([-, -, cutz]); // Start the initial cut at the center; r = toolradius
local r = toolradius; // Keep track how big the hole is
local n = 1;
local dir = -1.0; // Alternating end-point tracking (=> (-1)^n sign shift)
local p; // endpoint for new arc into next hole circle
// We have to circle 1..n times to make the hole
while(r < targetradius) {
if(targetradius - r >= cutstep) {
// Take a full cutting step because space allows
p = (2*n-1) * cutstep;
r += cutstep;
} else {
// Last cut is under cutstep in size
p = (2*n-2) * cutstep + targetradius - r;
r += targetradius - r;
}
arc_cw_r([0.0mm, dir * p], p/2.0); // Arc into the next circle
circle_cw(center); // Widen the hole
n++;
dir = -dir; // Arc endpoint alternate
}
// Curve _out_ of the hole by helical arc move back to center and oldz
arc_cw_r([0.0mm, dir * (targetradius - toolradius), oldz-cutz], (targetradius - toolradius)/2.0);
comment("-- end cc_hole --");
return;
}
/* -------------------- Main Program -------------------- */
//ngcgui: info: Circular pocket with continuous curvature movements
//ngcgui: umode = 1; //, units: 1:mm, 0:inch
//ngcgui: xctr = 0; //, x center
//ngcgui: yctr = 0; //, y center
//ngcgui: diameter = 10; //, diameter
//ngcgui: tool_diameter = 2; //, tool_diameter
//ngcgui: step = 1; //, step
//ngcgui: cutdepth = -1; //, cutdepth
//ngcgui: xfinal = 0; //
//ngcgui: yfinal = 0; //
//ngcgui: zfinal = 1; //
//ngcgui: verbose = 0; // precede ensure_units
include("ensure_units.gcmc"); // avoid preamble conflict
if (umode == 1) {
zero = 0.0mm;
} else {
zero = 0.0in;
}
// ngcgui entries are unitless so these additions are used
// to ensure 1) floatingpoint and 2) units per umode setting
xctr = zero + xctr;
yctr = zero + yctr;
diameter = zero + diameter;
tool_diameter = zero + tool_diameter;
step = zero + step;
cutdepth = zero + cutdepth;
xfinal = zero + xfinal;
yfinal = zero + xfinal;
zfinal = zero + xfinal;
location = [xctr,yctr];
FINALPOS = [xfinal,yfinal,zfinal];
goto(FINALPOS);
if(!issvg()) {
move(FINALPOS); // To visualize subsequent rapids in LinuxCNC
}
// Center R_hole R_tool Step Cutting-Z
cc_hole(location, diameter/2, tool_diameter/2, step, cutdepth);
goto(FINALPOS);

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -0,0 +1,58 @@
/*******************************************************
The following //comment lines identify ngcgui inputs:
example option:
//ngcgui: --precision 6
info message (appears on ngcgui tab page):
//ngcgui: info: gcmc drill example
variables with defaults:
//ngcgui: umode = 1; //, units: 1:mm, 0:inch
//ngcgui: nx=4; //
//ngcgui: ny=3; //
//ngcgui: xstart=1; //
//ngcgui: ystart=1; //
//ngcgui: xspacing=0.5; //
//ngcgui: yspacing=1.0; //
//ngcgui: retract=0.1; //
//ngcgui: increment=0.5; //
//ngcgui: repeatct=1; //
//ngcgui: fr=10,feedrate; //
variable with comment text:
//ngcgui: zdepth=0 , z(neg typ)
//ngcgui: verbose = 0; //precede ensure_units
*******************************************************/
include("ensure_units.gcmc"); //avoid preamble conflict
if (umode == 1) {
zero = 0.0mm;
} else {
zero = 0.0in;
}
// ngcgui entries are unitless so these additions are used
// to ensure 1) floatingpoint and 2) units per umode setting
xstart = zero + xstart;
ystart = zero + ystart;
xspacing = zero + xspacing;
yspacing = zero + yspacing;
retract = zero + retract;
increment = zero + increment;
fr = zero + fr;
feedrate(fr);
x=xstart;
y=ystart;
sign = 1;
for (i = 0; i < nx ; i++) {
for (j = 0; j < ny; j++) {
drill([x, y, zdepth], retract, increment, repeatct);
y = y + sign * yspacing;
}
y = y - sign * yspacing;
sign = -1 *sign;
x = x + xspacing;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,35 @@
// gcmc include file
// ensure gcmc units mode agrees with g20,g21 at runtime
// in case a preamble conflicts with gcmc program
if (ismodemm()) {
if (isdefined("verbose") && verbose == 1) {
literal("\
o1 if [#<_metric> ne 1]\n\
(debug, !!!ensure_units.gcmc: set g21)\n\
g21\n\
o1 endif\n\
");
} else {
literal("\
o1 if [#<_metric> ne 1]\n\
g21\n\
o1 endif\n\
");
}
} else {
if (isdefined("verbose") && verbose == 1) {
literal("\
o1 if [#<_imperial> ne 1]\n\
(debug, !!!ensure_units.gcmc: set g20)\n\
g20\n\
o1 endif\n\
");
} else {
literal("\
o1 if [#<_imperial> ne 1]\n\
g20\n\
o1 endif\n\
");
}
}

View File

@@ -0,0 +1,240 @@
/*
* G-code meta compiler
*
* Copyright (C) 2014 B. Stultiens
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Gear example
* ------------
* This example is by no means a complete or correct implementation of gears in
* any generic form. It is primarily for inspiration and to show what gcmc can
* do with relatively little coding. You may use this script as inspiration to
* create a better implementation if you like.
*
* Please note: The below parameters will shift the examples with an XY offset
* as indicated by the options. These are passed on the command-line when the
* examples are generated.
*
* @@@--svg-toolwidth 0.1 --svg-opacity 1 --svg-no-movelayer -x 110 -y 70@@@
*/
/*
* Gear terms:
* N - Number of Teeth
* Pa - Pressure Angle
* D - Pitch Diameter - D = N/P = Do - 2/P (Gear radius at center of the teeth)
* P - Diametral Pitch - P = N/D
* p - Circular Pitch - p = pi() / P
* Db - Base Diameter - Db = D * cos(Pa) (Bottom of teeth insertion)
* Dr - Root Diameter - Dr = D - 2b (Bottom of tooth cutout)
* Do - Outside Diameter - Do = D + 2a
* a - Addendum - a = 1/P
* b - Dedendum - b = ht - a
* ht - Whole Depth (Pa<20) - 2.157/P
* ht - Whole Depth (Pa>=20) - 2.2/P + 0.05mm (Total depth from outer dia to bottom)
* t - Tooth Thickness - t = pi()/(2*P) (Thinckness at Pitch Diameter)
*/
__ang_step = 2.0deg; /* Trace interval for curves */
/*
* Point on involute curve at specified angle, see https://en.wikipedia.org/wiki/Involute
* Cartesian:
* x = a * ( cos(t) + t * sin(t))
* y = a * ( sin(t) - t * cos(t))
* Polar:
* r = a * sqrt(1 + t^2) = sqrt(a^2 + (a*t)^2)
* phi = t - atan(t)
* where:
* - a = circle radius
* - t = angle (radians)
*
* For angle from circle radius: t^2 = (r/a)^2 - 1
*/
function involute_point(angle, radius)
{
angle = to_rad(angle); /* Multiplication must be in radians */
return radius * [cos(angle) + to_none(angle) * sin(angle), sin(angle) - to_none(angle) * cos(angle)];
}
function involute_angle(radius, outrad)
{
return to_rad(sqrt(pow(outrad/radius, 2.0) - 1));
}
/*
* Make a gear with:
* - nteeth Number of teeth
* - pressure_angle Teeth contact pressure angle
* - diametral_pitch Diametral pitch (teets/length)
*
* Return a vectorlist with outer points of the gear centered at [0,0]
*/
function gear_P(nteeth, pressure_angle, diametral_pitch)
{
/* The routine gets is serious trouble if you make the pressure angle
* too large or too small. Warn the user if such case occurs.
*/
if(pressure_angle > 24.6deg) {
warning("Pressure angle (", pressure_angle, ") too large, cannot fit teeth inside the set outside diameter");
}
if(pressure_angle < 12.0deg) {
warning("Pressure angle (", pressure_angle, ") too small, teeth may get stuck at pitch radius");
}
local i;
local pitch_diameter = nteeth / diametral_pitch;
local base_diameter = pitch_diameter * cos(pressure_angle);
local addendum = 1.0/diametral_pitch;
local ht = 2.157 / diametral_pitch;
local dedendum = ht - addendum;
local outside_diameter = pitch_diameter + 2.0*addendum;
local root_diameter = base_diameter - 2.0*dedendum;
local work_diameter = outside_diameter - 4.0*addendum;
local tooth = {}; // The curve for one tooth
/*
* message("nteeth=", nteeth, " pressure_angle=", pressure_angle, " diametral_pitch=", diametral_pitch);
* message("addendum=", addendum, " dedendum=", dedendum, " ht=", ht);
* message("pitch_diameter=", pitch_diameter);
* message("base_diameter=", base_diameter);
* message("outside_diameter=", outside_diameter);
* message("root_diameter=", root_diameter);
* message("work_diameter=", work_diameter);
*/
/*
* Show the different diameters:
* hole([0, 0], pitch_diameter/2.0);
* hole([0, 0], base_diameter/2.0);
* hole([0, 0], outside_diameter/2.0);
* hole([0, 0], root_diameter/2.0);
* hole([0, 0], work_diameter/2.0);
*/
// Fillet radius is approx. Will not reach root exactly, but close enough
// Otherwise need to calculate intersection with root-circle
local filletrad = (base_diameter - root_diameter)/8.0;
// Center of the fillet arc, involute makes a ~240deg angle with fillet arc
// The fillet arc runs from the root to the working depth of the gear
local center = rotate_xy([-filletrad, 0.0mm], 60.0deg) + [work_diameter/2.0, 0];
// Trace the fillet arc from ~root-circle to working depth at involute arc starting Y-level
for(i = 180.0deg; i > 60.0deg; i -= __ang_step*2.5) {
tooth += { [cos(i), sin(i)] * filletrad + center };
}
if(i != 60.0deg) {
// Add the last point if we did not reach the working depth
tooth += { [cos(60.0deg), sin(60.0deg)] * filletrad + center };
}
// Calculate the maximum involute angle to intersect at the outside radius
local max_a = involute_angle(base_diameter/2.0, outside_diameter/2.0);
// Trace the involute arc from the base up to outside radius
for(i = 0.0deg; i < max_a; i += __ang_step) {
tooth += { involute_point(i, base_diameter/2.0)};
}
if(i != max_a) {
// Add the last point if we did not reach the outside radius
tooth += { involute_point(max_a, base_diameter/2.0)};
}
// We now have one side of the tooth. Rotate to be at tooth-symmetry on X-axis
tooth = rotate_xy(tooth, -90.0deg / nteeth);
// Add the same curve mirrored to make the other side of the tooth
// Coordinates reverse to have them all in one direction only
tooth += reverse(scale(tooth, [1, -1]));
// Create all teeth of the gear by adding each tooth at correct angle
local gear = {};
repeat(nteeth; i) {
gear += rotate_xy(tooth, 360.0deg * i / nteeth);
}
return gear;
}
/* -------------------- Helper Functions -------------------- */
/*
* Trace a path at given offset
*/
function trace(path, offset)
{
goto(path[-1] + offset);
foreach(path; v) {
move(v + offset);
}
}
/*
* Make a hole at center point with given radius
*/
function hole(point, radius)
{
goto(point - [radius]);
circle_cw_r([radius, 0]);
}
/* -------------------- Main Program -------------------- */
//ngcgui: info: Involute-gear example
//ngcgui: umode = 1; //, units: 1:mm, 0:inch
//ngcgui: D = 100.0; //, Pitch Dia
//ngcgui: HD = 6.0; //, Hole Dia
//ngcgui: N = 9; //, Number of teeth
//ngcgui: PA = 20.0; //, Pressure Angle (deg)
//ngcgui: frate = 600; //, Feedrate
//ngcgui: xoffset = 0;
//ngcgui: yoffset = 0;
//ngcgui: howmany = 1; //, howmany (1 | 2)
//ngcgui: verbose = 0;
include("ensure_units.gcmc"); //avoid preamble conflict
if (umode == 1) {
zero = 0.0mm;
} else {
zero = 0.0in;
}
// ngcgui entries are unitless so these additions are used
// to ensure 1) floatingpoint and 2) units per umode setting
frate = frate + zero;
HD = HD + zero;
D = D + zero;
PA = PA + 0.0deg;
P = N/D; // Diametral pitch
feedrate(frate);
location = [xoffset,yoffset];
if (howmany == 1) {
hole(location, HD/2.0);
trace(gear_P(N, PA, P), location);
} elif (howmany == 2) {
hole(location + [D/2.0, 0.0mm], HD/2.0);
trace(gear_P(N, PA, P), location + [D/2.0, 0.0mm]);
hole(location + [-D/2.0, 0.0mm], HD/2.0);
trace(gear_P(N, PA, P), location + [-D/2, 0.0mm]);
} else {
error("howmany must be 1 or 2");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -0,0 +1,70 @@
//ngcgui: info: Rectangle -- simple gcmc example
/*COPY this file to a directory in your subroutine search path that
* precedes the directory of this library file and edit as
* required
*
* ngcgui uses the editor specified by $VISUAL
*/
//--------------------------------------------------------------------
// Variables
// Precede any of the following lines with
// //ngcgui:
// to make an entry box
// Omit the "//ngcgui:" to use the hard-coded value
//ngcgui: umode = 1; //, units: 1:mm, 0:inch
//ngcgui: frate = 100; //, Feed Rate
//ngcgui: x1 = 0; //, xoffset
//ngcgui: y1 = 0; //, yoffset
//ngcgui: width = 1;
//ngcgui: height = 1;
//ngcgui: zsafe = 0.1;
//ngcgui: zcut = -0.1; //, zcut (neg)
//ngcgui: verbose = 0; // precede ensure_units
include("ensure_units.gcmc"); // avoid preamble conflict
//--------------------------------------------------------------------
if (verbose) {comment("debug, rectangle.gcmc:start");}
if (umode == 1) {
zero = 0.0mm;
} else {
zero = 0.0in;
}
// ngcgui entries are unitless so these additions are used
// to ensure 1) floatingpoint and 2) units per umode setting
frate = zero + frate;
x1 = zero + x1;
y1 = zero + y1;
width = zero + width;
height = zero + height;
zsafe = zero + zsafe;
zcut = zero + zcut;
feedrate(frate);
goto([x1, y1, zsafe]);
move([x1, y1, zcut]);
move([x1 + width, y1, zcut]);
move([x1 + width, y1 + height, zcut]);
move([x1, y1 + height, zcut]);
move([x1, y1, zcut]);
goto([-, -, zsafe]);
if (verbose) {comment("debug, rectangle.gcmc:end");}
// uncomment to see how message()s are handled:
if (verbose) {
message("1test message in gcmc file");
message("2test message in gcmc file");
}
// uncomment to see how warning()s are handled:
//warning("1test warning in gcmc file");
//warning("2test warning in gcmc file");
// uncomment to see how error()s are handled:
//error("1test error in gcmc file");
//error("2test error in gcmc file");

View File

@@ -0,0 +1,123 @@
/* demo for using gcmc file with [py]ngcgui
ngcgui tags follow:
info: message to appear on ngcgui tab page:
format is: ^//ngcgui: info: info text
//ngcgui: info: STAR (gcmc G-Code Meta Compiler)
gcmc options (start with hyphen):
format is: ^//ngcgui: -optioname [optionvalue]
//ngcgui: --precision 5
Variables to present in ngcgui with optional default value and comment
format is ^//ngcgui: vname [= value , [comment text]]
//ngcgui: umode = 1; //, units: 1:mm, 0:inch
//ngcgui: feedr=100,Feed Rate
//ngcgui: zsafe = 1 ; //,zsafe
//ngcgui: zcut = -1 ; //,zcut (neg typ)
//ngcgui: x1=0,Xoffset
//ngcgui: y1=0,Yoffset
//ngcgui: myscale=1,scale
//ngcgui: n_erodes = 4; //, Erodes
//ngcgui: erode_width = 2; //,width (+/-)
//ngcgui: verbose = 0; //precede ensure_units
*/
include("ensure_units.gcmc"); //avoid preamble conflict
//example below derived from: http://www.vagrearg.org/content/gcmc#running
/*
Copyright: 2013
Author: Bertho Stultiens <bertho@vagrearg.org>
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.
*/
/* Return new path from 'srcpath' traced internally offset by 'width' */
function erode(srcpath, width)
{
local n, i, pp, pc, pn, v1, v2, bisect, newpoint, crossp, res;
n = count(srcpath);
res = {};
for(i = 0; i < n; i++) {
pp = srcpath[(i-1+n)%n]; /* Previous point */
pc = srcpath[i]; /* Current point */
pn = srcpath[(i+1+n)%n]; /* Next point */
v1 = normalize(pp - pc);
v2 = normalize(pn - pc);
bisect = width * normalize(v1 + v2);
newpoint = bisect + pc;
if(i > 0) {
/* Check convex polygon interior angle */
crossp = v1[0] * v2[1] - v1[1] * v2[0];
if(crossp < 0.0) {
newpoint = -bisect + pc;
}
}
res += { newpoint };
}
return res;
}
/* Trace the path at offset */
function tracepath(path, offset)
{
move(path[count(path)-1] + offset);
dwell(0);
foreach(path; p) {
move(p + offset);
dwell(0);
}
}
/* A nice star */
starpath = {
[ 1, 1], [ 0, 3],
[-1, 1], [-3, 0],
[-1, -1], [ 0, -3],
[ 1, -1], [ 3, 0]
};
if (umode == 1) {
fix = 0.0mm;
} else {
fix = 0.0in;
}
x1 = fix + x1;
y1 = fix + y1;
frate = fix + feedr;
zsafe = fix + zsafe;
zcut = fix + zcut;
erode_width = fix + erode_width;
theoffset = [x1,y1];
/******************** Program start ********************/
feedrate(feedr);
goto([-,-,zsafe]); /* Safe Z */
starpath *= myscale*10.0; /* Scale the star */
goto(starpath[count(starpath)-1]); /* First coordinate */
move([-,-,zcut]); /* Goto cutting depth */
/* Cut the stars smaller and smaller */
for(i = 0; i < n_erodes; i++) {
tracepath(erode(starpath, erode_width * -i), theoffset);
}
move([-,-,zsafe]); /* Back to safe Z */

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,198 @@
/*
* G-code meta compiler
*
* Copyright (C) 2014 B. Stultiens
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Trochoidal example
* ------------------
* Trochoidal movement for high-speed milling. A path is followed in a circular
* pattern with given radius and increment. Afterwards, a clean cut is
* performed to remove the residuals.
*
* NOTE: To take full advantage of trochoidal milling, you need to have a CNC
* program that can look ahead to keep the speed high. For LinuxCNC that means
* you will need the git version on branch circular-blend-arc-rc3 (or any later
* branch thereof, until it is merges into the master branch).
*
* @@@--svg-toolwidth 0.5 --svg-opacity 0.25@@@
*/
/*
* Trochoidal point calculation.
* See: https://en.wikipedia.org/wiki/Trochoid
*/
function trochoid_point(ang, a, b)
{
ang = to_rad(ang); // Trochoids are defined in radians
// The first part is the trochoid, the second part moves the first 180
// degree point at a relative "0, 0" location so we can scale in any
// way without having to do hard math
return [ a * to_none(ang) - b * sin(ang), b - b * cos(ang) ] - [a*pi(), 2.0*b];
}
/*
* Perform a move from startpoint to endpoint using a trochoidal path.
* - Cutting at depth cutz (returns to old Z)
* - Trochoid radius as specified
* - Increment for each turn as specified
*/
function trochoid_move(startpoint, endpoint, cutz, radius, increment)
{
local min_ainc = .1deg; // avoid too long compute times (and log( value<=1))
local min_rotations = 5; // avoid confusing appearance if too small
local i;
local a = increment/(2.0*pi()); // Trochoid step parameter
local ainc = log10(to_mm(radius)) * 5.0deg; // Steps are logarithmic based on the radius to reduce small steps
local oldz = position()[2];
local vec = endpoint - startpoint; // Vector denoting path to move
if (ainc < min_ainc) {
error("ainc too small: ",ainc," (try: increase trochoid radius)");
return;
}
// If we are not moving, it is an error
if(length(vec) <= zero) {
error("trochoid move is not going anywhere");
return;
}
comment("-- trochoid_move at ", cutz, " from ", startpoint, " to ", endpoint, " radius=", radius, " increment=", increment, " --");
// Calculate the number of *whole* rotations, rounded up, we need to make
local n = 2.0rad * pi() * to_none(ceil(length(vec) / increment));
local nrotations = n/(2.0rad * pi());
if (nrotations < min_rotations) {
error("too few rotations= ",nrotations," (try: decrease trochoid increment)");
return;
}
if (verbose) {
comment("debug, rotations= ",nrotations);
comment("debug, ainc= ",ainc);
}
// The path may be arbitrary angled, get the angle for rotating the trochoid
local rot = atan(vec[1], vec[0]);
// Go to the trochoid entry-point and move to cutting deph
goto(startpoint + rotate_xy(trochoid_point(0.0rad, a, radius), rot));
move([-, -, cutz]);
// Calculate each next point of the trochoid until we traversed the whole path to the endpoint
for(i = 0.0deg; i < n; i += ainc) {
move(startpoint + rotate_xy(trochoid_point(i, a, radius), rot));
}
// Return to old Z so we will not bump into stuff
goto([-, -, oldz]);
comment("-- trochoid_move end --");
}
/* -------------------- Main Program -------------------- */
//ngcgui: info: troichoid-path example (mm or inch per parm#1 (units) setting, !! DEFAULTS are in mm !!)
//ngcgui: umode = 1; //, units: 1:mm, 0:inch
//ngcgui: trochoid_r = 5; //, trochoidal radius
//ngcgui: trochoid_incr = 2; //, trochoidal increment
//ngcgui: path_scale = 25; //, path scale (all xi,yi)
//ngcgui: xoffset = 0; //, path x offset
//ngcgui: yoffset = 0; //, path y offset
//ngcgui: x0 = 0; //, path x0
//ngcgui: y0 = 1; //, path y0
//ngcgui: x1 = 2; //, path x1
//ngcgui: y1 = 2; //, path y1
//ngcgui: x2 = 0; //, path x2
//ngcgui: y2 = 4; //, path y2
//ngcgui: x3 = -1; //, path x3
//ngcgui: y3 = 2; //, path y3
//ngcgui: cutdepth = -1; //
//ngcgui: safez = 5; // z safe
//ngcgui: x_return = 0; // x return
//ngcgui: y_return = 0; // y return
//ngcgui: fnormal = 300; //, feed normal
//ngcgui: fslow = 150; //, feed slow
//ngcgui: ffast = 3000; //, feed fast
//ngcgui: verbose = 1;
include("ensure_units.gcmc"); //avoid preamble conflict
if (umode == 1) {
zero = 0.0mm;
} else {
zero = 0.0in;
}
// ngcgui entries are unitless so these additions are used
// to ensure 1) floatingpoint and 2) units per umode setting
trochoid_r = zero + trochoid_r;
trochoid_incr = zero + trochoid_incr;
xoffset = zero + xoffset;
yoffset = zero + yoffset;
x0 = zero + x0;
y0 = zero + y0;
x1 = zero + x1;
y1 = zero + y1;
x2 = zero + x2;
y2 = zero + y2;
x3 = zero + x3;
y3 = zero + y3;
cutdepth = zero + cutdepth;
safez = zero + safez;
x_return = zero + x_return;
y_return = zero + y_return;
fnormal = zero + fnormal;
fslow = zero + fslow;
ffast = zero + ffast;
CUTZ = cutdepth;
SAFEZ = safez;
HOME = [x_return, y_return, safez];
path = { [xoffset + x0, yoffset + y0],
[xoffset + x1, yoffset + y1],
[xoffset + x2, yoffset + y2],
[xoffset + x3, yoffset + y3] };
path *= path_scale; //path_scale is dimensionless
feedrate(fnormal);
if (verbose) {
comment("debug, feed normal= ",fnormal);
}
goto([-, -, SAFEZ]);
move([-, -, SAFEZ]);
goto(HOME);
/* Trochoidal high-speed milling of the outline */
if (verbose) {
comment("debug, feed fast= ",ffast);
}
feedrate(ffast); // *Really* high-speed milling
repeat(count(path); i) {
trochoid_move(path[i-2], path[i-1], CUTZ, trochoid_r, trochoid_incr);
}
/* Clean-cutting the object */
if (verbose) {
comment("debug, feed slow= ",fslow);
}
feedrate(fslow); // "Finishing the edge" speed
pathmode(1); // Exact path mode so we hit the corners exactly
move([-, -, CUTZ]); // We are at the "outside" of the path, reenter cutting depth
move(path[-1]); // The first corner
foreach(path; v) {
move(v); // Trace the object
}
goto([-, -, SAFEZ]);
goto(HOME);

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,167 @@
/* demo for using gcmc file with [py]ngcgui
//ngcgui: info: WHEELS (gcmc G-Code Meta Compiler)
//ngcgui: umode = 1; //, units: 1:mm, 0:inch
//ngcgui: r1=10; //,Radius 1 (10mm = .39370 in)
//ngcgui: r2= 5; //,Radius 2 ( 5mm = .19685 in)
//ngcgui: r3= 3.333; //,Radius 3 ( 3.333mm = .13122 in)
//ngcgui: s1= 1 ,Speed 1 (ratio, nounits)
//ngcgui: s2= 7 ,Speed 2 (ratio, nounits)
//ngcgui: s3= -17 ,Speed 3 (ratio, nounits)
//ngcgui: p1= 0 ,Phase 1 (angle, degrees)
//ngcgui: p2= 0 ,Phase 2 (angle, degrees)
//ngcgui: p3= 90 ,Phase 3 (angle, degrees)
//ngcgui: zsafe = 1; //, zsafe
//ngcgui: zcut = -1; //, zcut (neg)
//ngcgui: xoffset = 0;
//ngcgui: yoffset = 0;
//ngcgui: scalex = 5;
//ngcgui: scaley = 5;
//ngcgui: scalez = 1;
//ngcgui: frate = 60; //, feedrate
//ngcgui: verbose = 0; // precede ensure_units
*/
include("ensure_units.gcmc"); //avoid preamble conflict
/*
Copyright: 2013
Author: Alan Battersby <alan.battersby@virginmedia.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.
*/
/********************************************************/
/* Code to produce wheels paths */
/* Using GCMC Compiler */
/* Author: Alan Battersby */
/* Version: 1.0 */
/********************************************************/
/********************************************************/
/* Each wheel is a vector of three components */
/* Radius - The radius of the wheel */
/* Speed - The speed of the wheel */
/* Phase - The phase of the wheel */
function Radius(wheel)
{
return wheel[0];
}
function Speed(wheel)
{
return wheel[1];
}
function Phase(wheel)
{
return wheel[2];
}
function CreateWheel(r, s, p)
{
return [r,s,p];
}
/* Wheels are held in global vector list called wheels */
function CalcPoint(wheels, angle)
{
local at, posn, r, s, p, w;
posn = [0, 0];
foreach (wheels; w)
{
r = Radius(w);
s = Speed(w);
p = Phase(w);
at = s * angle + p;
posn += [r * cos(at), r * sin(at) ];
}
return posn;
}
function CutPath(wheels, start, inc, end, cdepth, scale)
{
local angle, point;
/* move to first point at safe height */
for(angle = start; angle <= end; angle += inc)
{
if (angle == start)
{
/* we should be at safe height */
/* so move to cutting depth */
point = scale(CalcPoint(wheels, angle), scale);
goto(point + theoffset);
goto([-,-,cdepth * scale[2]]);
}
else
{
point = scale(CalcPoint(wheels, angle), scale);
move(point + theoffset);
}
}
}
/******************* Library ****************************/
function GoAtSafeHeight(x,y)
{
goto([-,-,safeheight]);
goto([x,y,safeheight]);
}
/******************* main program ***********************/
if (umode == 1) {
zero = 0.0mm;
} else {
zero = 0.0in;
}
// ngcgui entries are unitless so these additions are used
// to ensure 1) floatingpoint and 2) units per umode setting
xoffset = zero + xoffset;
yoffset = zero + yoffset;
zsafe = zero + zsafe;
zcut = zero + zcut;
r1 = zero + r1;
r2 = zero + r2;
r3 = zero + r3;
s1 = 0.0 + s1; //angular speed ratio (unitless)
s2 = 0.0 + s2; //angular speed ratio (unitless)
s3 = 0.0 + s3; //angular speed ratio (unitless)
theoffset = [xoffset, yoffset];
safeheight = zsafe;
cuttingdepth = zcut;
svec = [scalex, scaley ,scalez ];
wheels = {
CreateWheel(r1, s1, p1 * 1deg),
CreateWheel(r2, s2, p2 * 1deg),
CreateWheel(r3, s3, p3 * 1deg)
};
feedrate(frate);
GoAtSafeHeight(0, 0);
CutPath(wheels, 0deg, 0.01deg, 360deg, cuttingdepth, svec);
GoAtSafeHeight(0, 0);

View File

@@ -0,0 +1,14 @@
; this is called from gladevcp MDI action with the following
; MDI command:
; O<oword> call [${spin-f}] [${check}] [${toggle}] [${scale-f}] [${spin-f}]
O<oword> sub
(DEBUG, oword.ngc: spin-f=#1 check=#2)
(DEBUG, toggle=#3 scale=#4)
(DEBUG, spin-f=#5 combo-s=#6)
O<oword> endsub
m2

View File

@@ -0,0 +1,93 @@
; Gmoccapy_2_tools_with_compensation.ngc
; testprogram to mill two circles with cutter radius compensation
; and two different tools
; set the basic settings, this should be
; on every program the beginning
G17
G21
G54
G61
G40
G49
G80
G90
; get the first tool
T3 M6
G43
; go to center of the workpiece
G0 X50 Y50
G0 Z30
; turn on spindle clockwise
S3000
M3
; coolant on
M8
G0 Z10
F250
G1 Z0
; tool radius compensation
; go in circle with lower feed rate
G41
G3 X70 Y50 Z-1 I10 J0
; make first circle with normal feed
F2000
G3 I -20
; out of the workpiece
G3 X50 Y50 Z1 I-10 J0
G0 Z30
; coolant off
M9
; turn off cutter radius compensation, otherwise no tool change is possible
G40
T1 M6
G43
; optional stop for testing
(MSG, optional stop, i.e. for cleaning the workpiece, or other thinks)
M1
; go again to the center of the workpiece
G0 X50 Y50
G0 Z10
; turn on spindle clockwise
S6000
M3
; mist on
M7
G0 Z10
F400
G1 Z1
; Werkzeugradienkompensation ein
; Anfahrradius mit Eintauchgeschwindigkeit
G41
G3 X65 Y50 Z-1 I7.5 J0
; 2. Kreis mit Vorschubgeschwindigkeit fräsen
F1000
G3 I-15
; Aus dem Werkstück
G3 X50 Y50 Z1 I-7.5 J0
G0 Z30
G0 Z30
G0 X50 Y50
M9 ; coolant off
M5 ; spindle off
M2 ; program end

View File

@@ -0,0 +1,45 @@
( Rectangular Probing )
( )
( This program repeatedly probes in a regular XY grid and writes the )
( probed location to the file 'probe-results.txt' in the same directory )
( as the INI file )
(Configuration section)
G20 (Inches)
F4 (probe speed)
#1=0 (X start)
#2=.25 (X increment)
#3=13 (X count)
#4=0
#5=.25
#6=5 (Y count)
#7=.1 (Z safety)
#8=-.5 (Z probe)
(End configuration section)
(PROBEOPEN probe-results.txt)
#9=0 #10=0
G0Z#7
O1 while [#9 lt #6]
#10=0
G0 Y[#4+#5*#9]
O2 while [#10 lt #3]
O3 if [[#9/2] - fix[#9/2] eq 0]
G0X[#1+#2*#10]
O3 else
G0X[#1+#2*[#3-#10-1]]
O3 endif
G38.2Z#8
G0Z#7
#10=[#10+1]
O2 endwhile
#9=[#9+1]
O1 endwhile
(PROBECLOSE)
G0Z#7
G0X#1Y#4
M2

View File

@@ -0,0 +1,12 @@
; drill a bolt hole circle for 6 bolts at diameter 3 inches
G20 G17 G90
; position over first hole, establishing our radius of 1.5
; an equivalent command would be G0 @1.5 ^0 Z0
G0 X1.5 Y0 Z0
; drill six holes, incrementing 60 degrees each time
G91 G81 R.1 Z-.5 ^60 L6 F10
M2

View File

@@ -0,0 +1,245 @@
import sys, os
BASE = os.environ['LINUXCNC_HOME']
sys.path.insert(0, os.path.join(BASE, "lib", "python"))
import math
def _(s): return s
def ui():
import tkinter
import pickle
import nf
import rs274.options
import os
app = tkinter.Tk()
rs274.options.install(app)
app.tk.call("source", os.path.join(BASE, "share", "axis", "tcl", "combobox.tcl"))
app.wm_title(_("Circular Holes"))
app.wm_iconname(_("Circular Holes"))
prev = tkinter.Canvas(app, width=200, height=200)
f = tkinter.Frame(app)
b = tkinter.Frame(app)
prev.grid(row=0, column=0, sticky="nw")
f.grid(row=0, column=1, sticky="nw")
b.grid(row=1, column=0, columnspan=2, sticky="ne")
validate_float = "expr {[regexp {^-?([0-9]+(\.[0-9]*)?|\.[0-9]+|)$} %P]}"
validate_int = "expr {[regexp {^-?([0-9]+|)$} %P]}"
validate_posfloat = "expr {[regexp {^?([0-9]+(\.[0-9]*)?|\.[0-9]+|)$} %P]}"
validate_posint = "expr {[regexp {^([0-9]+|)$} %P]}"
def posfloatentry(f, v):
var = tkinter.DoubleVar(f)
var.set(v)
w = tkinter.Entry(f, textvariable=var, validatecommand=validate_posfloat, validate="all", width=10)
return w, var
def floatentry(f, v):
var = tkinter.DoubleVar(f)
var.set(v)
w = tkinter.Entry(f, textvariable=var, validatecommand=validate_float, validate="all", width=10)
return w, var
def posintentry(f, v):
var = tkinter.IntVar(f)
var.set(v)
w = tkinter.Entry(f, textvariable=var, validatecommand=validate_posint, validate="all", width=10)
return w, var
def intentry(f, v):
var = tkinter.IntVar(f)
var.set(v)
w = tkinter.Entry(f, textvariable=var, validatecommand=validate_int, validate="all", width=10)
return w, var
def checkbutton(k, v):
var = tkinter.BooleanVar(f)
var.set(v)
g = tkinter.Frame(f)
w = tkinter.Checkbutton(g, variable=var, text="Yes")
w.pack(side="left")
return g, var
def intscale(k, v, min=1, max = 100):
var = tkinter.IntVar(f)
var.set(v)
g = tkinter.Frame(f, borderwidth=0)
w = tkinter.Scale(g, orient="h", variable=var, from_=min, to=max, showvalue=False)
l = tkinter.Label(g, textvariable=var, width=3)
l.pack(side="left")
w.pack(side="left", fill="x", expand=1)
return g, var
def optionmenu(k, v, *options):
options = list(options)
def trace(*args):
try:
var.set(options.index(svar.get()))
except ValueError:
pass
try:
opt = options[v]
except (TypeError, IndexError):
v = 0
opt = options[0]
var = tkinter.IntVar(f)
var.set(v)
svar = tkinter.StringVar(f)
svar.set(options[v])
svar.trace("w", trace)
wp = f._w.rstrip(".") + ".c" + svar._name
f.tk.call("combobox::combobox", wp, "-editable", 0, "-width",
max(len(opt) for opt in options)+3, "-textvariable", svar._name,
"-background", "white")
f.tk.call(wp, "list", "insert", "end", *options)
w = nf.makewidget(f, tkinter.Widget, wp)
return w, var
rc = os.path.expanduser("~/.holecirclerc")
constructors = [
("units", lambda f, v: optionmenu(f, v, _("G20 (in)"), _("G21 (mm)"))),
("cx", floatentry),
("cy", floatentry),
("th0", floatentry),
("inc", floatentry),
("rad", posfloatentry),
("count", posintentry),
("feedrate", posfloatentry),
("depth", floatentry),
("dwell", posfloatentry),
("retract", floatentry),
]
defaults = dict(
cx = 0,
cy = 0,
th0 = 0,
inc = 15,
count = 6,
feedrate = 8,
depth=-.1,
retract=.1,
units=0,
dwell=0,
rad=1
)
texts = dict(
units=_("Units"),
rad=_("Radius"),
cx=_("Center X"),
cy=_("Center Y"),
th0=_("Start Angle"),
inc=_("Increment Angle"),
count=_("Hole Count"),
feedrate=_("Feed Rate"),
depth=_("Hole Depth"),
retract=_("Retract Height"),
dwell=("Dwell (0=no dwell)"),
)
try:
defaults.update(pickle.load(open(rc, "rb")))
except (IOError, pickle.PickleError): pass
vars = {}
widgets = {}
for j, (k, con) in enumerate(constructors):
v = defaults[k]
text = texts.get(k, k.replace("_", " "))
lab = tkinter.Label(f, text=text)
widgets[k], vars[k] = con(f, v)
lab.grid(row=j, column=0, sticky="w")
widgets[k].grid(row=j, column=1, sticky="ew")
def update_preview(*args):
prev.delete("all")
try:
count = vars['count'].get()
th0 = vars['th0'].get()
inc = vars['inc'].get()
except ValueError: return
for i in range(count):
th = (th0 + i * inc) * math.pi / 180
x = 100 + 75 * math.cos(th)
y = 100 - 75 * math.sin(th)
prev.create_oval((x-4,y-4,x+4,y+4), fill='black')
def update_ok(*args):
result = True
for i in vars.values():
try:
i.get()
except ValueError:
result = False
break
if result: bb.configure(state="normal")
else: bb.configure(state="disabled")
# This line creates an error when you load holecircle twice
# from inside linuxcnc eg. gladevcp filechooser or AXIS GUI
#print(("update_ok", args), file=sys.stderr)
vars['count'].trace('w', update_preview)
vars['inc'].trace('w', update_preview)
vars['th0'].trace('w', update_preview)
for i in vars.values(): i.trace('w', update_ok)
update_preview()
status = tkinter.IntVar()
bb = tkinter.Button(b, text=_("OK"), command=lambda:status.set(1), width=8, default="active")
bb.pack(side="left", padx=4, pady=4)
bc = tkinter.Button(b, text=_("Cancel"), command=lambda:status.set(-1), width=8, default="normal")
bc.pack(side="left", padx=4, pady=4)
app.bind("<Escape>", lambda evt: bc.invoke())
app.bind("<Return>", lambda evt: bb.invoke())
app.wm_protocol("WM_DELETE_WINDOW", lambda: bc.invoke())
app.wm_resizable(0,0)
app.wait_visibility()
app.tk.call("after", "idle", ("after", "idle", "focus [tk_focusNext .]"))
#app.tk_focusNext().focus()
app.wait_variable(status)
if status.get() == -1:
raise SystemExit(1)
for k, v in vars.items():
defaults[k] = v.get()
app.destroy()
pickle.dump(defaults, open(rc, "wb"))
return defaults
unitcodes = ['G20', 'G21']
u = ui()
print(unitcodes[u['units']])
print("F%.1f" % u['feedrate'])
count = u['count']
th0 = u['th0']
inc = u['inc']
depth = u['depth']
retract = u['retract']
cx = u['cx']
cy = u['cy']
rad = u['rad']
if u['dwell']: cycle = "G82 P% 8.4f" % u['dwell']
else: cycle = "G81"
for i in range(count):
th = (th0 + i * inc) * math.pi / 180
x = cx + rad * math.cos(th)
y = cy + rad * math.sin(th)
print("%s X% 8.4f Y% 8.4f Z% 8.4f R% 8.4f" % (cycle, x, y, depth, retract))
print("M2")

View File

@@ -0,0 +1,4 @@
O<increment> sub
g91 g0 x#1 y#2
g90
O<increment> endsub

View File

@@ -0,0 +1,13 @@
from math import *
print("G20 F60")
print("G64 P0.001")
print("G0 X0 Y0 Z0")
a=.1
for i in range(100):
t = i/10.
x = a * (cos(t) + t * sin(t))
y = a * (sin(t) - t * cos(t))
print("G1 X%f Y%f" % (x,y))
print("M2")

View File

@@ -0,0 +1,115 @@
(cut a small 1/4-20 thread and part it)
(t1 is for facing and left turning, t4 is threading tool, t9 parting)
(proper tool offsets should be set in the tool table!)
g20 g64 g18
(face and turn outside diameter)
t1 m6
s1200 m3
g4p1
g43
g0z0x.2
f4
g1x-.0625
g0z.1
x.120
f5
g1z-.55
g0x.2
(round the end)
o100 sub
g0z1x-1
g41
g0z1
g2 x0 z0 r1
g3 x3.05 z-3.05 i0 k-3.05
g91
g2 z-1.5 x1 r1.5
g90
g40
g0 x4.5
o100 endsub
g21
f50
g0z1.3
g92z0
o100 call
f50
g92.1
g0z.9
g92z0
o100 call
g92.1
g0z.5
g92z0
o100 call
g92.1
g0z.3
g92z0
o100 call
g92.1
g0z.1
g92z0
o100 call
g92.1
g0z0
g92z0
o100 call
g0z0
o100 call
g92.1
g0z-.025
g92z0
o100 call
g92.1
m5
g20
f5
(thread)
t4 m6
g43
s800 m3
g4p1
g0z.2x.2
(p = thread pitch, distance per revolution)
(z = end of drive line)
(i = offset from drive line to thread peaks)
( negative i means the threads are at a smaller radius than the drive line,)
( so i is negative for outside threads, positive for inside threads)
(j = initial cut depth; subsequent depths follow degression formula)
(r = depth degression: 1.0 = constant depth, 2.0 = constant area)
( any number >= 1.0 allowed)
(k = full thread depth)
(q = "compound slide" angle)
(h = number of spring passes)
(e = distance along drive line used for tapered start/end)
(l = which ends get the taper: 0 = neither, 1 = begin, 2 = end, 3 = both)
g76 p.05 z-.5 i-.075 j.008 k.045 h3 r2.0 q29.5 e.05 l2
g0x.5
g0z0
m5
(part)
t9 m6
g43
s400 m3
g4p1
g0z-.6x.135
g1x0f.2
g0x.2
m2

View File

@@ -0,0 +1,35 @@
G54 G18 G21
F400
O100 SUB
G0 X0.202 Z3.041
G2 X1.081 Z0.919 I3.0 K0.0
G1 X3.0 Z-1.0
G1 Z-4.0
X2.268 Z-5.268
G2 X2.0 z-6.268 I1.73205 K-1.0
G1 Z-6.732
G2 X4.0 Z-8.732 I2.0 K0.0
G1 X4.5
G3 X6.285 Z-12.982 I-0.0 K-2.5
G2 Z-19.982 I3.57071 K-3.5
; Let's make the pawn safe to play with
G1 X10 A0.2
G1 X8.5 Z-22.58
G1 X10.0 Z-25.178
G1 Z-27.178
G2 X11.014 Z-35.1 I5.70735 K-3.29514
G1 X12.0 Z-36.1
G1 Z-38.1
G0 X15.0
O100 ENDSUB
G40 T2M6G43
G71.1 Q100 X15 Z3.041 D1 I1 R0.3
G40 T10M6G43
G71.2 Q100 X15 Z3.041 D0.51 I0.5 R0.3
G42.1 D0.3 L2
G70 Q100 X15 Z3.041 E0 D0.5 P2
M2

View File

@@ -0,0 +1,19 @@
G21 G54 G18
F400
O100 SUB
G0 X0 Z-10
O101 REPEAT [3]
G1 X[#<_x>+5] Z[#<_Z>+3]
G1 X[#<_x>+5]
O101 ENDREPEAT
O100 ENDSUB
O101 SUB
G72 Q100 X1 Z1 D0.5 I1 R0.3
G70 Q100 X1 Z1 D0.5 P2
O101 ENDSUB
O101 CALL
M2

View File

@@ -0,0 +1,64 @@
G54 G18 G21
F400
O100 SUB
G0Z-12X14
G1Z-10X14
G1 X10 Z-10
G3 K5 I0 X5 Z-5
G1 X5 Z0
X-1
Z2
O100 ENDSUB
G70 Q100 X15 Z4 D1 P1
G71 Q100 X-5 Z-14 D0.5 I1 R0.3
G72 Q100 X15 Z4 D0.5 I1 R0.3
#<_distance>=20
O101 SUB
G0 X-1 Z[2+#<_distance>]
G1 X-1 Z[0+#<_distance>]
G1 X5 Z[0+#<_distance>]
G1 X5 Z[-5+#<_distance>]
G2 I5 K0 X10 Z[-10+#<_distance>]
G1 X14 Z[-10+#<_distance>]
G0 X14 Z[-12+#<_distance>]
O101 ENDSUB
G72 Q101 X-5 Z[-14+#<_distance>] D0.5 I1 R0.3
G71 Q101 X15 Z[4+#<_distance>] D0.5 I1 R0.3
G70 Q101 X15 Z[4+#<_distance>] D1 P1
#<_distance>=[#<_distance>+12]
O102 SUB
G0Z[12+#<_distance>]X14
G1Z[10+#<_distance>]X14
G1 X10 Z[10+#<_distance>]
G2 K-5 I0 X5 Z[5+#<_distance>]
G1 X5 Z[0+#<_distance>]
X-1
Z[-2+#<_distance>]
O102 ENDSUB
G71 Q102 X-5 Z[14+#<_distance>] D0.5 I1 R0.3
G72 Q102 X15 Z[-4+#<_distance>] D0.5 I1 R0.3
G70 Q102 X15 Z[-4+#<_distance>] D1 P1
#<_distance>=[#<_distance>+20]
O103 SUB
G0 X-1 Z[-2+#<_distance>]
G1 X-1 Z[-0+#<_distance>]
G1 X5 Z[-0+#<_distance>]
G1 X5 Z[5+#<_distance>]
G3 I5 K0 X10 Z[10+#<_distance>]
G1 X14 Z[10+#<_distance>]
G0 X14 Z[12+#<_distance>]
O103 ENDSUB
G72 Q103 X-5 Z[14+#<_distance>] D0.5 I1 R0.3
G71 Q103 X15 Z[-4+#<_distance>] D0.5 I1 R0.3
G70 Q103 X15 Z[-4+#<_distance>] D1 P1
M2

View File

@@ -0,0 +1,151 @@
G21
G64
G18 G8
G00 X13.5 Z1.0 S1000 M3
Z0.488
G94 G01 X-1.0 F50.0
Z0.975
G00 X0.383 Z1.269
X13.5
Z0.0
G01 X-1.0
Z0.488
G00 X0.383 Z0.782
X13.5
Z1.0
Z2.0
X11.237
G01 Z-34.973 F50.0
X12.2 Z-35.95
Z-37.95
X12.625
G00 X13.625 Z-36.95
Z2.0
X9.849
G01 Z-19.832
G00 X10.849 Z-18.832
Z2.0
X8.461
G01 Z-19.832
X9.849
G00 X10.849 Z-18.832
Z2.0
X7.073
G01 Z-10.296
G00 X8.073 Z-9.296
Z2.0
X5.685
G01 Z-8.784
G03 X7.073 Z-10.296 I-0.98513 K-2.29772
G00 X8.073 Z-9.296
Z2.0
X4.297
G01 Z-8.582
X4.7
G03 X5.685 Z-8.784 I-0.0 K-2.5
G00 X6.685 Z-7.784
Z2.0
X2.909
G01 Z-0.559
G00 X3.909 Z0.441
Z2.0
X1.521
G01 Z0.829
X2.909 Z-0.559
G00 X4.909 Z1.441
Z0.441
X2.909
G01 Z-0.559
X3.2 Z-0.85
Z-4.15
X2.909 Z-4.654
Z-8.11
G02 X4.2 Z-8.582 I1.29082 K1.52767
G01 X4.297
G00 X5.297 Z-7.582
Z-4.654
X3.909
G01 X2.909
X2.468 Z-5.418
G02 X2.2 Z-6.418 I1.73205 K-1.0
G01 Z-6.582
G02 X2.909 Z-8.11 I2.0 K0.0
G00 X3.909 Z-7.11
X7.073
Z-9.296
G01 Z-10.296
G03 X7.2 Z-11.082 I-2.3731 K-0.78638
G01 Z-11.382
G03 X7.073 Z-12.168 I-2.5 K0.0
G01 Z-19.832
X8.461
G00 X9.461 Z-18.832
Z-12.168
X8.073
G01 X7.073
G03 X6.485 Z-13.132 I-2.3731 K0.78638
G02 X5.685 Z-14.204 I3.57071 K-3.5
G01 Z-18.76
G02 X6.485 Z-19.832 I4.37094 K2.42793
G01 X7.073
G00 X8.073 Z-18.832
Z-14.204
X6.685
G01 X5.685
G02 X5.058 Z-16.482 I4.37075 K-2.42793
G02 X5.685 Z-18.76 I4.99775 K0.15
G00 X6.685 Z-17.76
X9.849
Z-18.832
G01 Z-19.832
X10.2
Z-20.132
X9.849 Z-20.74
Z-24.42
G00 X10.849 Z-23.42
Z-20.74
G01 X9.849
X8.787 Z-22.58
X9.849 Z-24.42
G00 X10.849 Z-23.42
X9.849
G01 Z-24.42
X10.2 Z-25.028
Z-27.328
G02 X9.849 Z-28.029 I5.70735 K-3.29514
G01 Z-32.917
G02 X11.214 Z-34.95 I6.0583 K2.594
G01 X11.237 Z-34.973
G00 X12.237 Z-33.973
Z-28.029
X10.849
G01 X9.849
G02 X9.319 Z-30.473 I6.05858 K-2.594
G02 X9.849 Z-32.917 I6.58858 K0.15
G00 X10.849 Z-31.917
Z-29.029
X11.237
Z2.0
X0.534 Z3.241
G01 X0.202 Z3.041 F75.0
G02 X1.081 Z0.919 I3.0 K0.0
G01 X3.0 Z-1.0
Z-4.0
X2.268 Z-5.268
G02 X2.0 Z-6.268 I1.73205 K-1.0
G01 Z-6.732
G02 X4.0 Z-8.732 I2.0 K0.0
G01 X4.5
G03 X6.285 Z-12.982 I-0.0 K-2.5
G02 Z-19.982 I3.57071 K-3.5
G01 X10.0
X8.5 Z-22.58
X10.0 Z-25.178
Z-27.178
G02 X11.014 Z-35.1 I5.70735 K-3.29514
G01 X12.0 Z-36.1
Z-38.1
G00 X15.0
Z10.0
M2
%

View File

@@ -0,0 +1,49 @@
g20 g64 g18 f30
g49
t0 m6
g0x.3z0
g40
g1x.1
g3x0z.1r.1
g1z1
g2r.25x-.25z1.25
g3r.25x-.5z1.5
g1z1.75
g0x.3
t2 m6
g43 h2
g0z0
g42
g1x.1
g3x0z.1r.1
g1z1
g2r.25x-.25z1.25
g3r.25x-.5z1.5
g1z1.75
g40
g0x.3
t7 m6
g43 h9
g0z1.85
g0x-.3
g41
g1x-.4
g2x-.5z1.75r.1
g1z1.5
g2r.25x-.25z1.25
g3r.25x0z1
g1z.1
g2r.1x.1z0
g40
g0x.3
g49
t0 m6
m2

View File

@@ -0,0 +1,29 @@
o<m250> sub
(debug, in M250.ngc)
o<g881_havex> if [EXISTS[#<x>]]
(debug, X param set: #<x>)
o<g881_havex> endif
o<g881_havey> if [EXISTS[#<y>]]
(debug, Y param set: #<y>)
o<g881_havey> endif
o<g881_havez> if [EXISTS[#<z>]]
(debug, Z param set: #<z>)
o<g881_havez> endif
o<g881_havep> if [EXISTS[#<p>]]
(debug, P param set: #<p>)
o<g881_havep> endif
o<g881_haveq> if [EXISTS[#<q>]]
(debug, Q param set: #<q>)
o<g881_haveq> endif
o<g881_haver> if [EXISTS[#<r>]]
(debug, R param set: #<r>)
o<g881_haver> endif
o<m250> endsub
m2

View File

@@ -0,0 +1,34 @@
; This demonstrates doing an M61 remapped to a named oword sub
;
; to activate, incantate as follows in the INI file:
;
; [RS274NGC]
; # remap M61 to a named oword subroutine.
; # parameter #1: the Q value
; M61_COMMAND=o<m61demo>call
;
;
O<m61demo> sub
;
; O<m61demo> if ;; trigger error report
;
(DEBUG,m61demo.ngc: M61 Q=#1)
; test fail-change line from gladevcp
M66 P2 L0
O<m61demo_test_fail> if [#5399 EQ 1]
(DEBUG, digital-input-02=#5399 - returning -1 to fail M61)
; a return value < 0 fails the M61
O<m61demo> return [-1]
O<m61demo_test_fail> endif
; return the tool number to commit the change.
; return a negative return to abort the interpreter with a message like
; "M61 failed (<return value>)" - the tool number will be unchanged
;
O<m61demo> endsub [#1]
m2

View File

@@ -0,0 +1,88 @@
; This demonstrates doing an M6 remapped to a named oword sub
;
; to activate, incantate as follows in the INI file:
;
; [RS274NGC]
; # remap M6 to a named oword subroutine.
; M6_COMMAND=o<m6demo>call
;
; parameter #1: the current tool-in-spindle
; parameter #2: the tool number requested in the last T (prepare) command
; parameter #3: pocket of new tool
;
;
;
O<m6demo> sub
;
(DEBUG, executing M6 O-word sub, tool-in-spindle=#1 prepared=#2 pocket=#3)
;
M66 P2 L0
;(debug, digital-input-02=#5399)
#<tool_change_with_spindle_on> = 0
#<tool_change_quill_up> = 0
#<tool_change_at_g30> = 0
; number of seconds to wait for 'tool-changed' equivalent
#<timeout> = 9999
;
O<m6demo_spindle_off> if [#<tool_change_with_spindle_on> EQ 0]
M5
O<m6demo_spindle_off> endif
O<m6demo_quill_up> if [#<tool_change_quill_up> NE 0]
G0 G53 Z0
O<m6demo_quill_up> endif
O<m6demo_tc_at_g30> if [#<tool_change_at_g30> NE 0]
G30
O<m6demo_tc_at_g30> endif
; set analog output pin #2 to signal the pocket number
; iocontrol.tool-number becomes motion.analog-out-02
M68 E2 Q[#2]
;(DEBUG, set current tool number on motion.analog-out-02: #2)
;
; assert the equivalent of the iocontrol.tool-change pin
; which is now motion.digital-out-01
M64 P1
;(DEBUG, motion.digital-out-01 set high, waiting for motion.digital-in-01)
; wait for the equivalent of the iocontrol.tool-changed pin to go high
; we use motion.digital-in-01
;
M66 P1 L3 Q#<timeout>
;
; if we waited too long, fail change and abort.
;
O<m6demo_timeout> if [#5399 EQ -1]
(DEBUG, timeout waiting for digital-in-01 to become true - failing change )
O<m6demo> return [-1]
O<m6demo_timeout> endif
; retract iocontrol.tool-change equivalent
;(DEBUG, deasserting motion.digital-out-01)
M65 P1
;
; test fail-change line from gladevcp
M66 P2 L0
; (debug, digital-input-02=#5399)
O<m6demo_change_fail> if [#5399 EQ 1]
(DEBUG, returning -1 to fail change)
O<m6demo> return [-1]
O<m6demo_change_fail> else
(debug, change ok, returning +1 to commit change)
; a positive return value commits the tool change
O<m6demo> return [1]
O<m6demo_change_fail> endif
;
; return a positive value commit the change.
; a negative return value will fail the change and
; abort the interpreter with a message like
; "M6 failed (<return value>)"
;
O<m6demo> endsub
m2

View File

@@ -0,0 +1,6 @@
O<m6remap> sub
(DEBUG, executing in M69 in m6remap O-word sub)
M69
(DEBUG, done)
O<m6remap> endsub
m2

View File

@@ -0,0 +1,41 @@
; Demonstrate saving and explicitly restoring the global state around
; a subroutine call using M70 - save state and M72 - restore state
;
; note that the subroutine itself is not aware of the M7x features
O<showstate> sub
(DEBUG, imperial=#<_imperial> absolute=#<_absolute> feed=#<_feed> rpm=#<_rpm>)
O<showstate> endsub
O<imperialsub> sub
;
g20 (imperial)
g91 (relative mode)
F5 (low feed)
S300 (low rpm)
;
(debug, in subroutine, state now:)
o<showstate> call
;
O<imperialsub> endsub
; main program
g21 (metric)
g90 (absolute)
f200 (fast speed)
S2500 (high rpm)
;
(debug, in main, state now:)
o<showstate> call
;;
M70 (save caller state in at global level)
;
O<imperialsub> call
;
M72 (explicitly restore state)
;
(debug, back in main, state now:)
o<showstate> call
;
m2

View File

@@ -0,0 +1,53 @@
; Demonstrate saving the global state within a subroutine
; using the M73 autorestore feature
;
O<showstate> sub
(DEBUG, imperial=#<_imperial> absolute=#<_absolute> feed=#<_feed> rpm=#<_rpm>)
O<showstate> endsub
O<imperialsub> sub
M73 (save caller state in current call context, restore on return or endsub)
;
g20 (imperial)
g91 (relative mode)
F5 (low feed)
S300 (low rpm)
;
(debug, in subroutine, state now:)
o<showstate> call
(debug, arg=#1)
o<test_return> if [[#1] GT 0]
; if called with param #1 > 0, demonstrate restore-on-return
(debug, executing return)
o<test_return> return
o<test_return> endif
; note - no exit M7x code needed - the following endsub or an
; explicit 'return' will restore caller state
(debug, executing endsub)
O<imperialsub> endsub
; main program
g21 (metric)
g90 (absolute)
f200 (fast speed)
S2500 (high rpm)
;
(debug, in main after endsub, state now:)
o<showstate> call
;
; show restore-on-endsub:
o<imperialsub> call [0]
;
(debug, back in main after return, state now:)
o<showstate> call
; now show restore-on-return:
o<imperialsub> call [1]
;
(debug, back in main, state now:)
o<showstate> call
;
m2

View File

@@ -0,0 +1,33 @@
o<m75> sub
(debug, in M75.ngc)
(debug, in M75: call_level=#<_call_level> remap_level=#<_remap_level>)
o<g881_havex> if [EXISTS[#<x>]]
(debug, X param set: #<x>)
o<g881_havex> endif
o<g881_havey> if [EXISTS[#<y>]]
(debug, Y param set: #<y>)
o<g881_havey> endif
o<g881_havez> if [EXISTS[#<z>]]
(debug, Z param set: #<z>)
o<g881_havez> endif
o<g881_havep> if [EXISTS[#<p>]]
(debug, P param set: #<p>)
o<g881_havep> endif
o<g881_haveq> if [EXISTS[#<q>]]
(debug, Q param set: #<q>)
o<g881_haveq> endif
o<g881_haver> if [EXISTS[#<r>]]
(debug, R param set: #<r>)
o<g881_haver> endif
;m76P#<p>Q[#<q>*5]
o<m75> endsub
m2

View File

@@ -0,0 +1,29 @@
o<m76> sub
(debug, in M76.ngc)
o<g881_havex> if [EXISTS[#<x>]]
(debug, X param set: #<x>)
o<g881_havex> endif
o<g881_havey> if [EXISTS[#<y>]]
(debug, Y param set: #<y>)
o<g881_havey> endif
o<g881_havez> if [EXISTS[#<z>]]
(debug, Z param set: #<z>)
o<g881_havez> endif
o<g881_havep> if [EXISTS[#<p>]]
(debug, P param set: #<p>)
o<g881_havep> endif
o<g881_haveq> if [EXISTS[#<q>]]
(debug, Q param set: #<q>)
o<g881_haveq> endif
o<g881_haver> if [EXISTS[#<r>]]
(debug, R param set: #<r>)
o<g881_haver> endif
o<m76> endsub
m2

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 326 KiB

View File

@@ -0,0 +1,103 @@
; MACROCOMMAND=Finish Diameter,Surface Speed,DOC,FPR,Finish Length,Radius,Angle,Tool Number, Max RPM
; MACRODEFAULTS=1,500,.02,.007,-2,0,0,1,1500
; MACROSVG=LatheMacro.svg,1
; MACROOPTIONS=load:yes,save:yes,default:default.txt,path:~/macros
; O<boring> call [${bore.x-f}] [${bore.sf-f}] [${bore.cut-f}] [${bore.feed-f}] [${bore.z-f}] [${bore.rad-f}] [${bore.angle-f}] [${bore.tool-s}]
; #1 finish diameter
; #2 surface speed
; #3 depth of cut
; #4 feed/rpm
; #5 finish length
; #6 radius
; #7 angle
; #8 tool number
; #9 max RPM
;boring
O<boring> sub
O110 IF [#<_imperial>]
(MSG, IMPERIAL sizes)
O110 ELSE
(MSG, METRIC sizes)
O110 ENDIF
(debug, Start Diameter %.3f#<_x>)
(debug, Finish Diameter %.3f#1)
(debug, Z Start %.3f#<_z>)
(debug, Z Finish %.3f#5)
O107 IF [#<_imperial>]
(MSG, IMPERIAL ON)
#1 = [#1 * 25.4]; X
#2 = [#2 * 3.28]; surface speed
#3 = [#3 * 25.4]; doc
#4 = [#4 * 25.4]; feed
#5 = [#5 * 25.4]; length
#6 = [#6 * 25.4]; radius
O107 ENDIF
M73 ;save/restore codes
G8 ; Radius mode (easier maths)
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
G91.1 ; but not for arcs
#1 = [#1 / 2] ; because of radius mode
#14 = [#<_x>] (starting X)
#13 = #<_z> (starting Z)
#20 = [#6 * SIN[#7]]
#21 = [-#6 * COS[#7]]
#22 = [#6 / COS[#7]]
#23 = [#5 + #6 - #20]
#24 = [[#23 - #13] * TAN[#7]]
(MSG, Unpause To Start Boring Macro)
m0
M6 T#8 G43
G96 D#9 S#2 ; Constant Surface Speed Mode
m3 ;Start Spindle
g95 F#4 ; Feed-Per-Rev Mode
g4p1 ; Wait to reach speed
(debug, Turning finish dia #1 start dia #14 start length #13 finish length #5)
O100 WHILE [#14 LT [#1 - #3]]
g0 X #14
#14=[#14 + #3]
G1 X #14
G1 Z #23 X[#14 + #24]
O101 IF [#6 GT 0]
G3 Z#5 X[#14 + #24 + #21] I#21 K#20
G1 X[#14 + #24 + #21 - #3]
O101 ELSE
G1 X[#14 + #24 - [#3 * 1.5]]
O101 ENDIF
G0 Z[#13]
O100 ENDWHILE
G0 x#1
G1 Z #23 X[#1 + #24]
O102 IF [#6 GT 0]
G3 Z#5 X[#1 + #24 + #21] I#21 K#20
G1 X[#1 + #24 + #21 - #3]
O102 ELSE
G1 X[#1 + #24 - #3]
O102 ENDIF
G0 Z #13
G0 X #1 ; For touch-off
M5
G7
O<boring> endsub
M2

View File

@@ -0,0 +1,102 @@
; MACROCOMMAND=X,SFM,DOC,Z,Tool Number,Chamfer size,Front Outside,Front Inside,Back Outside,Max RPM
; MACRODEFAULTS=1,300,.5,1,1,.015,true,false,false,1500
; MACROSVG=LatheMacro.svg,4
; O<chamfer>call [${chamfer.x-f}] [${chamfer.sf-f}] [0.5] [${chamfer.z-f}] [${chamfer.tool-s}] [${chamfer.size-f}] [${chamfer.fo}] [${chamfer.fi}] [${chamfer.bo}]
; #1 chamfer x
; #2 surface speed *
; #3 doc
; #4 chamfer z
; #5 tool number
; #6 chanfer size
; #7 front outside switch *
; #8 front inside switch *
; #9 back outside switch *
; #10 Max RPM
;chamfer
O<chamfer> sub
O107 IF [#<_imperial>]
(MSG, IMPERIAL ON)
#1 = [#1 * 25.4]; X
#2 = [#2 * .3048] ; sf/m to m/m
#3 = [#3 * 25.4]; doc?
#4 = [#4 * 25.4]; Z
#6 = [#6 * 25.4]; chanfer size
O107 ENDIF
M73 ; save/restore codes
G8 ; Lathe radius Mode
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
#1 = [#1 / 2] ; because of radius mode
#14 = [#<_x>] (starting X)
#13 = [#<_z>] (starting Z)
(MSG, Unpause To start Chamfer Macro)
m0
M6 T#5 G43
G96 D#10 S#2 ; Constant Surface Speed Mode
M3
g95 F0.1 ; Feed-Per-Rev Mode
#20 = 0
O101 if [#7 GT 0.5] ; front outside
o100 while [[#20 + #3] lt #6]
#20 = [#20 + #3]
g0 x[#1 - #20] z#13
g1 z#4
g1 x#1 z[#4 - #20]
g1 x #14
g0 z#13
o100 endwhile
g0 x#14 z#13
g0 x[#1 - #6]
g1 z#4
g1 x#1 z[#4 - #6]
g1 x #14
g0 z#13
O101 elseif [#8 GT 0.5] ; front inside
o102 while [[#20 + #3] lt #6]
#20 = [#20 + #3]
g0 x[#1 + #20] z#13
g1 z#4
g1 x#1 z[#4 - #20]
g1 x #14
g0 z#13
o102 endwhile
g0 x#14 z#13
g0 x[#1 + #6]
g1 z#4
g1 x#1 z[#4 - #6]
g1 x #14
g0 z#13
O101 elseif [#9 GT 0.5] ; back outside
o103 while [[#20 + #3] lt #6]
#20 = [#20 + #3]
g0 x[#1 - #20] z#13
g1 z#4
g1 x#1 z[#4 + #20]
g1 x #14
g0 z#13
o103 endwhile
g0 x#14 z#13
g0 x[#1 - #6]
g1 z#4
g1 x#1 z[#4 + #6]
g1 x #14
g0 z#13
O101 endif
G7
O<chamfer> endsub
m2

View File

@@ -0,0 +1,86 @@
; MACROCOMMAND= Drill Diameter,Finish Depth,SFM,FPR,Tool Number,Peck Depth,Retract Depth
; MACRODEFAULTS=1.0,-1.0,300.0,.007,1,0.2,.1
; MACROSVG=LatheMacro.svg,6
; O<drill> call [${drill.diameter-f}] [${drill.zdepth-f}] [${drill.sf-f}] [${drill.feed-f}] [${drill.tool-s}] [${drill.peck-f}] [${drill.retract-f}]
; #1 drill diameter
; #2 zdepth
; #3 surface speed
; #4 feed/rpm
; #5 tool number
; #6 peck amount
; #7 peck retract amount - not used right now
O<drill> sub
O100 IF [#<_imperial>]
(MSG, IMPERIAL sizes)
(MSG, )
#<diam> = [#1 * 25.4]
#<zDepth> = [#2 * 25.4]
#<surfaceSpeed> = [#3 * .3048] ; sf/m to m/m
#<fpr> = [#4 * 25.4]
#<peck> = [#6 * 25.4]
#<retract> = [#7 * 25.4]
#10 = [[#3 *12] / [3.1415 * #1]] ; RPM from sfm request
(debug, Drill Diameter: %d#1 in)
(debug, Peck Increment: %.3f#6 in)
(debug, Start Z: %.3f#<_z> in)
(debug, Finish Z: %.3f#2 in)
(debug, Feed: %.3f#4 in/rev)
(debug, Tool: %d#5)
(debug, Speed: %d#3 sfm @ %d#10 rpm)
O100 ELSE
(MSG, METRIC sizes)
#<diam> = #1
#<zDepth> = #2
#<surfaceSpeed> = #3 ;m/m
#<fpr> = #4
#<peck> = #6
#<retract> = #7
#10 = [#<surfaceSpeed> / [3.1415 * #<diam>]] ; rpm from m/m request
(debug, Drilling Diameter: %d#<diam> mm)
(debug, Peck Distance: %.2f#<peck> mm)
(debug, Start Z: %.2f#<_z> mm)
(debug, Finish depth: %.2f#<zDepth> mm)
(debug, Feed: %.2f#<fpr> mm/rev)
(debug, Tool: %d#5)
(debug, Speed %d#<surfaceSpeed> m/min @ #10 rpm)
O100 ENDIF
M73 ; save state, restore on exit
G7 ; diameter mode
G17 ; XY Plane
G21 ; Metric Units don't change units!
G90 ; Absolute Distance
#<zStart> = #<_z> (starting Z)
(MSG, Unpause To start Drilling Macro)
m0
M6 T#5 G43
G97 S#10 ; Constant RPM mode
M3 ;Start Spindle
G95 F#<fpr> ; Feed-Per-Rev Mode
g4p1 ; Wait to reach speed
G0 X0 ; must drill from the centerline. Tool should be zeroed here
G00 Z #<zStart>
G98
G83 Z#<zDepth> R#<zStart> Q#<peck>
G80
G0 Z #<zStart>
M5
G7
(MSG,Done Drilling Macro)
O<drill> endsub
M2

View File

@@ -0,0 +1,74 @@
; MACROCOMMAND=Face Diameter,SFM,DOC,FPR,Z Length,Angle,Tool Number, Max RPM
; MACRODEFAULTS=1,500,.02,.007,-2,0,1,1500
; MACROSVG=LatheMacro.svg,2,10
; O<facing>call [${face.x-f}] [${face.sf-f}] [${face.cut-f}] [${face.feed-f}] [${face.z-f}] [${face.angle-s}] [${face.tool-s}]
; #1 face diameter
; #2 surface speed
; #3 DOC
; #4 feed/rpm
; #5 Face Z length
; #6 face angle
; #7 tool number
; #8 max RPM
;Facing
O<facing> sub
O10 IF [#6 NE 0]
(MSG, Angled facing isn't supported yet)
M2
O10 ENDIF
O107 IF [#<_imperial>]
(MSG, IMPERIAL ON)
#1 = [#1 * 25.4]
#2 = [#2 * .3048] ; sf/m to m/m
#3 = [#3 * 25.4]
#4 = [#4 * 25.4]
#5 = [#5 * 25.4]
O107 ENDIF
M73
G7 ; Lathe Diameter Mode
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
#14 = [#<_x> * 2] (starting X)
#13 = #<_z> (starting Z)
(debug, Facing start X #14 mm, Start Z #13 mm)
(debug, Finish Z #5 mm)
(MSG, Unpause To start Facing Macro)
m0
M6 T#7 G43
G96 D#8 S#2 ; Constant Surface Speed Mode
M3
g95 F#4 ; Feed-Per-Rev Mode
g4p1 ; Wait to reach speed
O200 WHILE [#13 GT #5 + #3]
#13=[#13-#3]
G1 Z#13
G1 X#1
G0 Z[#13+#3]
G0 X#14
G0 Z#13
O200 ENDWHILE
G1 Z#5
G1 X#1
G0 Z[#13+#3]
G0 X[#14+#3]
G0 Z#5 ; For touch-off
M5
O<facing> endsub
M2

View File

@@ -0,0 +1,30 @@
; MACROCOMMAND=xinc,zinc
; MACRODEFAULTS=0.0,0.0
; MACROIMAGE=go_to_position.png
; MACROOPTIONS =load:yes,save:yes
; Testfile go to position
; will jog the machine to a given position
O<go_to_position> sub
G17
G20
G54
G61
G40
G49
G80
G90
;#1 = <X-Pos>
;#2 = <Z-Pos>
(DEBUG, %fWill now move machine to X = #1 , Z = #2)
(MSG, Unpause To Start Go-To-Position Macro)
m0
G0 X #1 Z #2
O<go_to_position> endsub
M2

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,2 @@
go_to_position0,1.0, xinc
go_to_position1,3.5, zinc

View File

@@ -0,0 +1,85 @@
; MACROCOMMAND=r1 Max,Fast Feed,Slow Feed,d1 (mm)
; MACRODEFAULTS=1,25,.1,6
; MACROSVG=LatheMacro.svg,8,9
; O<probe-hole> call [Max Radius] [slow_feed] [fast_feed] [diameter]
; #1 Max radius
; #2 fast probe speed
; #3 slow probe feed
; #5 probe diameter (in mm)
O<probe-hole> sub
; Fast feed for roughing in measurements
G20 F#2
#1000=#1 ;max radius
G91 G38.3 Z.00001
#1001=#5061
#1002=#5062
G91 G38.2 X#1000
#1003=#5061
G90 G0 X#1001
G91 G38.2 X[0-#1000]
#1004=#5061
#1001=[[#1003+#1004]/2]
G90 G0 X#1001
G91 G38.2 Y#1000
#1005=#5062
G90 G0 Y#1002
G91 G38.2 Y[0-#1000]
#1006=#5062
#1002=[[#1005+#1006]/2]
G90 G0 Y#1002
G91 G38.2 X#1000
#1003=#5061
G90 G0 X#1001
G91 G38.2 X[0-#1000]
#1004=#5061
#1001=[[#1003+#1004]/2]
G90 G0 X#1001
G91 G38.2 Y#1000
#1005=#5062
G90 G0 Y#1002
G91 G38.2 Y[0-#1000]
#1006=#5062
#1002=[[#1005+#1006]/2]
G90 G0 Y#1002
; Slow probe for accuracy
F#3
G90 G0 X[#1003-0.005]
G91 G38.2 X0.010
#1003=#5061
G90 G0 X[#1004+0.005]
G91 G38.2 X-0.010
#1004=#5061
#1001=[[#1003+#1004]/2]
G90 G0 X#1001
G90 G0 Y[#1005-0.005]
G91 G38.2 Y0.010
#1005=#5062
G90 G0 Y[#1006+0.005]
G91 G38.2 Y-0.010
#1006=#5062
#1002=[[#1005+#1006]/2]
G90 G0 Y#1002
G91 G1 F1 X[0-#5071] Y[0-#5072]
G90
#1007=[#1003-#1004+[#5/25.4]]
#1008=[#1005-#1006+[#5/25.4]]
#1009=[[#1007+#1008]/2]
#1010=[atan[#1002]/[#1001]]
#1011=[sqrt[[#1001*#1001]+[#1002*#1002]]]
(debug,Dia #1009 Ang #1010 Dist #1011)
O<probe-hole> endsub

View File

@@ -0,0 +1,85 @@
; MACROCOMMAND=X,SFM,DOC,Z,Tool Number,Radius,Front Outside,Front Inside,Back Outside
; MACRODEFAULTS=1,300,.5,1,.1,.015,true,false,false
; MACROSVG=LatheMacro.svg,3
; O<radius> call [${radius.x-f}] [${radius.sf-f}] [0.5] [0][${radius.z-f}] [${radius.tool-s}] [0] [${radius.rad-f}] [${radius.fo}] [${radius.fi}] [${radius.bo}]
O<radius> sub
O107 IF [#<_imperial>]
(MSG, IMPERIAL ON)
#1 = [#1 * 25.4]; X
#2 = [#2 * 3.28]; surface speed
#3 = [#3 * 25.4]; doc
#4 = [#4 * 25.4]; Z
#6 = [#6 * 25.4]; radius
O107 ENDIF
M73 ; save/restore codes
G8 ; Lathe radius Mode
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
M6 T#6 G43
#1 = [#1 / 2] ; because of radius mode
#14 = [#<_x>] (starting X)
#13 = [#<_z>] (starting Z)
G96 D1500 S#2 ; Constant Surface Speed Mode
M3
g95 F0.1 ; Feed-Per-Rev Mode
#20 = 0
O101 if [#9 GT 0.5] ; Front outside
o100 while [[#20 + #3] lt #8]
#20 = [#20 + #3]
g0 x[#1 - #20] z#13
g1 z#5
g3 x#1 z[#5 - #20] K[-#20]
g1 x #14
g0 z#13
o100 endwhile
g0 x#14 z#13
g0 x[#1 - #8]
g1 z#5
g3 x#1 z[#5 - #8] K[-#8]
g1 x #14
g0 z#13
O101 elseif [#10 GT 0.5] ; front inside
o102 while [[#20 + #3] lt #8]
#20 = [#20 + #3]
g0 x[#1 + #20] z#13
g1 z#5
g2 x#1 z[#5 - #20] K[-#20]
g1 x #14
g0 z#13
o102 endwhile
g0 x#14 z#13
g0 x[#1 + #8]
g1 z#5
g2 x#1 z[#5 - #8] K[-#8]
g1 x #14
g0 z#13
O101 elseif [#11 GT 0.5] ; back outside
o103 while [[#20 + #3] lt #8]
#20 = [#20 + #3]
g0 x[#1 - #20] z#13
g1 z#5
g2 x#1 z[#5 + #20] K#20
g1 x #14
g0 z#13
o103 endwhile
g0 x#14 z#13
g0 x[#1 - #8]
g1 z#5
g2 x#1 z[#5 + #8] K#8
g1 x #14
g0 z#13
O101 endif
G7
O<radius> endsub
m2

View File

@@ -0,0 +1,93 @@
; MACROCOMMAND=Thread X, SFM, Tool Number, Pitch, Z, Internal, External
; MACRODEFAULTS=1,300,1,.015,1,False,true
; MACROSVG=LatheMacro.svg,5
; O<threading>call [${thread.x-f}] [${thread.sf-f}] [${thread.tool-s}] [${thread.pitch-f}] [${thread.z-f}] [${thread.internal}] [${thread.external}]
; #1=thread.x
; #2=thread.sf
; #3=thread.tool-s
; #4=thread.pitch-f
; #5=thread.z-f
; #6=thread.internal
; #7=thread.external
;threading
O<threading> sub
O107 IF [#<_imperial>]
(MSG, IMPERIAL ON)
#1 = [#1 * 25.4] ; start X
#2 = [#2 * .3048] ; sf/m to m/m
#4 = [#4 * 25.4] ; pitch
#5 = [#5 * 25.4] ; z finish
O107 ENDIF
G7 ; Lathe Diameter Mode
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
#14 = [#<_x> * 2] (starting X)
#13 = #<_z> (starting Z)
O50 IF [#6 GT 0.5]
(debug, INTERNAL Threading thread dia-#1)
(debug, start-#13)
(debug, finish-#5)
(debug, Pitch-#4)
(debug, Depth-#3)
O50 ELSE
#<OD> = [#1 - 0.108 * #4]
#<ID> = [#1 - 1.0825 * #4]
(debug, EXTERNAL Threading OD = #<OD> ID = #<ID>)
O50 ENDIF
(MSG, Unpause To start Threading Macro)
m0
M6 T#3 G43
G96 D200 S#2 ; Constant Surface Speed Mode
M3
g95 F0.1 ; Feed-Per-Rev Mode
g4p1 ; Wait to reach speed
;Threading
; Internal
O51 IF [#6 GT 0.5]
#<OD> = [#1]
#<ID> = [#1 - 1.3 * #4]
;g1X [#<ID> - 1] ;thread truncation
;g0 Z #13
;g1 X #<ID>
;g1 Z #5
G0 X[#<ID> - 1]
g0 Z #13
#3 = [#4 * 1.3]
g1X [#<ID> - 1]
g76 p#4 z#5 i1 j0.2 k#3 h3 r1.5 q29.5 e0 l0
; External
O51 ELSE
#<OD> = [#1 - 0.108 * #4]
#<ID> = [#1 - 1.0825 * #4]
; EXTERNAL Threading OD = #<OD> ID = #<ID>)
#3 = [#4 * 1.0825]
g1X [#<OD> + 1] ;final thread truncation
g0 z#13
g1 X #<OD>
g1 Z #5
G0 X[#<OD> +1]
G0 Z #13
g76 p#4 z#5 i-1 j0.2 k#3 h3 r1.5 q29.5 e0 l0
O51 ENDIF
G0 Z #13
m5
O<threading> endsub
M2

View File

@@ -0,0 +1,109 @@
; MACROCOMMAND=Finish Diameter,SFM,DOC,FPR,Finish Length,Radius,Angle,Tool Number, Max RPM
; MACRODEFAULTS=1.0,500.0,.02,.007,-2.0,0.0,0.0,1,1500
; MACROSVG=LatheMacro.svg,0,11
; O<turning> call [${turn.x-f}] [${turn.sf-f}] [${turn.cut-f}] [${turn.feed-f}] [${turn.z-f}] [${turn.rad-f}] [${turn.angle-f}] [${turn.tool-s}]
; #1 finish diameter
; #2 speed
; #3 depth of cut
; #4 feed/rpm
; #5 finish length
; #6 radius
; #7 angle
; #8 tool number
; #9 max RPM
;Turning
O<turning> sub
O110 IF [#<_imperial>]
(MSG, IMPERIAL sizes)
O110 ELSE
(MSG, METRIC sizes)
O110 ENDIF
(debug, Start Diameter %.3f#<_x>)
(debug, Finish Diameter %.3f#1)
(debug, Z Start %.3f#<_z>)
(debug, Z Finish %.3f#5)
O107 IF [#<_imperial>]
(MSG, IMPERIAL ON)
#1 = [#1 * 25.4]
#2 = [#2 * .3048] ; sf/m to m/m
#3 = [#3 * 25.4]
#4 = [#4 * 25.4]
#5 = [#5 * 25.4]
#6 = [#6 * 25.4]
O107 ENDIF
M73 ;save/restore codes
G8 ; Radius mode (easier maths)
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
G91.1 ; but not for arcs
#<finishDiam> = #1
#1 = [#1 / 2] ; because of radius mode
#14 = [#<_x>] (starting X)
#<startDiam> = [#14 *2]
#13 = [#<_z>] (starting Z)
#20 = [#6 * SIN[#7]]
#21 = [#6 * COS[#7]]
#22 = [#6 / COS[#7]]
#23 = [#5 + #6 - #20]
#24 = [[#13 - #23] * TAN[#7]]
(MSG, Unpause To Start Turning Macro)
m0
M6 T#8 G43
G96 D#9 S#2 ; Constant Surface Speed Mode
m3 ;Start Spindle
g95 F#4 ; Feed-Per-Rev Mode
g4p1 ; Wait to reach speed
O100 WHILE [#14 GT [#1 + #3 / 2]]
g0 X #14
#14=[#14-#3 / 2]
G1 X #14
G1 Z #23 X[#14 + #24]
O101 IF [#6 GT 0]
G2 Z#5 X[#14 + #24 + #21] I#21 K#20
G1 X[#14 + #24 + #21 + #3/2]
O101 ELSE
G1 X[#14 + #24 + [#3 * .6]]
O101 ENDIF
O104 IF [#7 LT 0]
G0 X#14
O104 ENDIF
G0 Z[#13]
O100 ENDWHILE
G0 x#1
G1 Z #23 X[#1 + #24]
O102 IF [#6 GT 0]
G2 Z#5 X[#1 + #24 + #21] I#21 K#20
G1 X[#1 + #24 + #21 + #3]
O102 ELSE
G1 X[#1 + #24 + #3]
O102 ENDIF
O106 IF [#7 LT 0]
G0 X#14
O106 ENDIF
G0 Z #13
G0 X #1 ; For touch-off
M5
G7
O<turning> endsub
M2

View File

@@ -0,0 +1,13 @@
; MACROCOMMAND=
; MACRODEFAULTS=
; MACROIMAGE=go_to_home.svg,1,1
O<go_to_home> sub
G0 G53
G28 Z0
G28 X0 Y0
O<go_to_home> endsub
M2

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg3820"
width="144"
height="72"
viewBox="0 0 144 72"
sodipodi:docname="go_to_home.svg"
inkscape:version="0.91 r13725">
<metadata
id="metadata3826">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3824" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="997"
id="namedview3822"
showgrid="false"
inkscape:zoom="1"
inkscape:cx="144.02568"
inkscape:cy="31.732601"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="Layer 1">
<image
style=""
width="144"
height="72"
preserveAspectRatio="none"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAABICAYAAAAZK3z6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz AAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAOJSURB VHic7d29ThxXGMbx/2FmgAIhviQWm8IGVkqgSJPO2tjyWqKIVsoVOJeQC0iVIn0uIdxBPkiBFKME y5ILF64mEuwWNIAAJ6y0BXi9Z1LsbDTWzswezRQbxPOTjkDLFKd49J6vPYNh2DPgOfAFUAGmUp6R u+MGOAMOgB3gRdaDC8BvQKSmltN+BeaJmfjnAvAK+MQY061UKn+ura29qVQq59PT0++RO+v6+nry 9PR0udVqfX5+fv44iiIf+At4BPwzCNAu8GUQBO/q9foP1Wr1ZGw9lv+tw8PD1f39/W+63e4C/cw0 DFAHfjfGdLe3t79XeCTP0dHR/b29vW/jSlT3gO+Az1ZWVl7WarXX9Ic1NbXUtri42Dk+Pp7tdDoP AOMDNYCNjY23wAQiI1Sr1bdnZ2dPgJoPrAAsLy//DXjj7JjcDnFWAO75xPs8QRBYVIHEQZwVgCl/ 8KExxqAAiYM4KwD4ic89NISJm/9ykqxAE6gCiYM4K8DHFUgBElfDAYpTpSFMRkqtQFEUqQKJkzgr QCJA1toJa60CJCMlc6JVmBShVZgUp1WYlKVVmBSnCiRlZVYgBUhGyqpAWoWJq9RVmE7jxUnWafxE sjSJ5NAcSIpLnQNZa70oijQHkpGstcNzIDSEiTsNYVJc5kaihjBxlF6BNISJCx1lSFnaiZZS0ldh qAKJm9Q5kI4yxIkuFkpZGsKkFG0kSnF598I0hMlIqffC0BAm7hQgKUUbiVKKVmFSilZhUlzeYaqG MHGhSbSUoiFMisu7WGiHHxcZkroK02m8uBo+jdcr7sRV1lGGR/8fiomMojeUSXH6Ur2UpQBJKdqJ llIyNxI1iZaR8uZACpC4yFzGi7jQTrSUMrwTrRcriKusWxkeiWSJZMm7lSHiIj1AiSvPInky31Cm BImLjybRN8BUr9fTF8rESa/XG1SgGx84AR62221vdnZ2jN2S26Ldbg/2gU584CXwsNVqTa6urr4f Y7/klmg2m5Pxrwc+sAM8D8PQ39ra6i0tLek4QzJdXl6aMAwHc+edwWToF6AxMzMTNRqNDwqRpLm4 uDC7u7t+p9MxwM/AV4MAzQOvgE89z2NzczNaX1+P5ubmoiAIxtZhGb9ut8vV1ZVpNpsmDENjrQUI gUfAVfLZefqVKFJTy2k/0c8KkH508RT4GqgB94CplGfk7rihv1I/AH4E/kj+8V9yReInMiHUiAAA AABJRU5ErkJggg== "
id="image3828"
x="0"
y="0" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:24px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
x="35"
y="31"
id="text3855"><tspan
sodipodi:role="line"
id="tspan3853"
x="35"
y="31">Go To </tspan><tspan
sodipodi:role="line"
x="35"
y="61"
id="tspan3857">Home</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -0,0 +1,27 @@
; MACROCOMMAND=xinc,yinc,zinc
; MACRODEFAULTS=0,0,0
; MACROIMAGE= go_to_position.png
; Testfile go to position
; will jog the machine to a given position
O<go_to_position> sub
G17
G20
G54
G61
G40
G49
G80
G90
;#1 = <X-Pos>
;#2 = <Y-Pos>
;#3 = <Z-Pos>
(DEBUG, Will now move machine to X = #1 , Y = #2 , Z = #3)
G0 X #1 Y #2 Z #3
O<go_to_position> endsub
M2

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,18 @@
; MACROCOMMAND=
; MACRODEFAULTS=
; MACROIMAGE=go_to_zero.png
; will jog the machine to zero
o<go_to_zero> sub
o<100> if [#5422 LT 0]
G0 Z0
G0 X0 Y0
o<100> else if [#5422 GE 0]
G0 X0 Y0
G0 Z0
o<100> endif
o<go_to_zero> endsub
M2

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,335 @@
(mmount.ngc - sample program)
(this program mills a stepper motor mount)
(it is intended to be run on the Mazak at the CNC workshop)
(it requires the custom 3-station workholding fixture that is on that machine)
(station 1 starts with a flat rectangular blank, and makes holes in it)
(station 1 uses the G55 coordinate system)
(touch off: XY = center of 1.876 hole, Z = top of plate)
(station 2 mounts the part using a couple of the holes, and mills the outline)
(station 2 uses the G56 coordinate system)
(touch off: XY = center of 1.876 hole, Z = top of plate)
(station 3 mounts the part on end to drill, tap, and c'bore holes in one end)
(station 3 uses the G57 coordinate system)
(touch off: XZ = center of 1.876 hole, Y = back surface of plate)
(it uses the following tools:)
(1 1 -1.1901 0.250 3/4 center drill)
(2 2 -0.2875 0.209 #4 tap drill)
(3 3 0.0 0.1406 9/64 clearance drill)
(4 4 -1.6630 0.25 1/4 end mill)
(5 5 -1.5042 0.5 1/2 end mill)
(15 15 -1.5042 0.55 same 1/2 end mill oversize roughing)
(6 6 -0.1833 0.25 1/4-20 pulley tap)
#100=10.0 (outside feed)
#101=10.0 (inside feed)
#102=3.0 (drill feed)
G17 G20 G40 G90
o100 sub
(helical hole milling, load tool and set feed first, then use like so:)
(o100 call [x pos] [y pos] [safety height] [hole depth] [hole dia] [tool dia])
(tool dia doesn't have to be specified exactly.)
#9=#5 (save real dia)
#5=[#5-.020]
#4=[0 - #4]
#7=[#6 / 2] (#7 is depth per circle = half of tool diameter)
#8=[#3 - #7] (#8 is current depth step)
g0 z#3
(start above and right so we make a convex corner for entry to the ccw arcs)
g0 x[#1 + #6] y[#2 + [#5]]
g41 g0 x#1 y[#2 + [#5 / 2]]
o101 while [#8 GT #4]
(down toward the specified depth a bit at a time)
g3 x#1 y[#2 + [#5 / 2]] i0 j[0 - [#5 / 2]] z#8
#8=[#8 - #7]
o101 endwhile
(down to the actual depth)
g3 x#1 y[#2 + [#5 / 2]] i0 j[0 - [#5 / 2]] z#4
(full circle at the actual depth)
g3 x#1 y[#2 + [#5 / 2]] i0 j[0 - [#5 / 2]]
(now make a finish pass at the actual diameter)
g3 x#1 y[#2 - [#9 / 2]] i0 j[0 - [[#5 + #9]/4]]
g3 x#1 y[#2 - [#9 / 2]] i0 j[#9/2]
g3 x#1 y[#2 + [#5 / 2]] i0 j[[#5+#9]/4]
g0 z#3
g40
o100 endsub
(DRILL 3/4 CENTER)
T1 M6 G43
G55
S764 M3 M8
G00 X0.0000 Y0.0000
G00 Z0.2500
(spot five holes in station 1)
G81 R0.0250 Z-0.0400 X0.0000 Y-6.0000 F#102
G81 R0.0250 Z-0.0400 X0.0000 Y-7.0000 F#102
G81 R0.0250 Z-0.0400 X0.0000 Y-3.5000 F#102
G81 R0.0250 Z-0.0400 X0.0000 Y-2.5000 F#102
G81 R0.0250 Z-0.0400 X-1.938 Y-8.9000 F#102
G00 Z0.2500
M5 M9
G00 G53 Z0.0000
(MILL 0.250)
T4 M6 G43
(station 1)
G55
S3056 M3 M8
G00 X0.0000 Y0.0000
G00 Z0.2500
(mill curved slot)
G00 X-0.1806 Y-11.4324
G41
G01 X-0.1806 Y-11.1824 F#101
G03 X0.3449 Y-10.6567 I-1.7574 J2.2824 Z0.025
G03 X0.1221 Y-10.4853 I-0.1114 J0.0857 Z0.0
G02 X-0.3521 Y-10.9596 I-2.0601 J1.5853 Z-0.125
G03 X-0.1806 Y-11.1824 I0.0858 J-0.1114
G03 X0.3449 Y-10.6567 I-1.7574 J2.2824
G03 X0.1221 Y-10.4853 I-0.1114 J0.0857
G02 X-0.3521 Y-10.9596 I-2.0601 J1.5853 Z-0.250
G03 X-0.1806 Y-11.1824 I0.0858 J-0.1114
G03 X0.3449 Y-10.6567 I-1.7574 J2.2824
G03 X0.1221 Y-10.4853 I-0.1114 J0.0857
G02 X-0.3521 Y-10.9596 I-2.0601 J1.5853 Z-0.375
G03 X-0.1806 Y-11.1824 I0.0858 J-0.1114
G03 X0.3449 Y-10.6567 I-1.7574 J2.2824
G03 X0.1221 Y-10.4853 I-0.1114 J0.0857
G02 X-0.3521 Y-10.9596 I-2.0601 J1.5853 Z-0.550
G03 X-0.1806 Y-11.1824 I0.0858 J-0.1114
G03 X0.3449 Y-10.6567 I-1.7574 J2.2824
G03 X0.1221 Y-10.4853 I-0.1114 J0.0857
G02 X-0.3521 Y-10.9596 I-2.0601 J1.5853
G00 Z0.2500
G40
(mill second curved slot)
G00 X1.5152 Y-8.4181
G41
G01 X1.7652 Y-8.4181 Z0.025
G02 X1.7652 Y-9.3819 I-3.7032 J-0.4819 Z-0.125
G03 X2.0440 Y-9.4181 I0.1394 J-0.0181
G03 X2.0440 Y-8.3819 I-3.9820 J0.5181
G03 X1.7652 Y-8.4181 I-0.1394 J-0.0181
G02 X1.7652 Y-9.3819 I-3.7032 J-0.4819 Z-0.250
G03 X2.0440 Y-9.4181 I0.1394 J-0.0181
G03 X2.0440 Y-8.3819 I-3.9820 J0.5181
G03 X1.7652 Y-8.4181 I-0.1394 J-0.0181
G02 X1.7652 Y-9.3819 I-3.7032 J-0.4819 Z-0.375
G03 X2.0440 Y-9.4181 I0.1394 J-0.0181
G03 X2.0440 Y-8.3819 I-3.9820 J0.5181
G03 X1.7652 Y-8.4181 I-0.1394 J-0.0181
G02 X1.7652 Y-9.3819 I-3.7032 J-0.4819 Z-0.550
G03 X2.0440 Y-9.4181 I0.1394 J-0.0181
G03 X2.0440 Y-8.3819 I-3.9820 J0.5181
G03 X1.7652 Y-8.4181 I-0.1394 J-0.0181
G02 X1.7652 Y-9.3819 I-3.7032 J-0.4819
G00 Z0.2500
G40
(mill four holes)
o100 call [ 1.1880] [-0.9380] [0.25] [0.55] [0.4375] [0.25]
o100 call [-1.1880] [-0.9380] [0.25] [0.55] [0.4375] [0.25]
o100 call [ 0.0000] [-7.5000] [0.25] [0.55] [0.5000] [0.25]
o100 call [ 0.0000] [-1.4000] [0.25] [0.55] [0.5000] [0.25]
G00 G53 Z0.0000
(station 3)
G57
G0 X0.0000 Y0.0000
(counterbores)
(o100 call [x pos] [y pos] [safety height] [hole depth] [hole dia] [tool dia])
F#101
o100 call [1.188] [-0.250] [1.4] [-0.367] [0.405] [0.25]
F[#101/3] (mostly plunging)
o100 call [1.188] [-0.250] [1.4] [-0.267] [0.2813] [0.25]
F#101
o100 call [-1.188] [-0.250] [1.4] [-0.367] [0.405] [0.25]
F[#101/3] (mostly plunging)
o100 call [-1.188] [-0.250] [1.4] [-0.267] [0.2813] [0.25]
M5 M9
G00 G53 Z0.0000
(DRILL 9/32)
T3 M6 G43
G55
S679 M3 M8
G00 X0.0000 Y0.0000
G00 Z0.2500
G83 R0.050 Z-0.6000 Q.15 X-1.9380 Y-8.9000 F#102
G00 G53 Z0.0000
G57
G00 X0.0000 Y0.0000
G00 Z1.5000
G83 R1.5000 Z-0.100 Q.15 X1.1880 Y-0.2500 F#102
G83 R1.5000 Z-0.100 Q.15 X-1.1880 Y-0.2500 F#102
M5 M9
G00 G53 Z0.0000
(DRILL #4)
T2 M6 G43
G55
S914 M3 M8
G00 X0.0000 Y0.0000
G00 Z0.2500
G83 R0.050 Z-0.7000 Q0.15 X0.0000 Y-7.0000 F#102
G83 R0.050 Z-0.7000 Q0.15 X0.0000 Y-6.0000 F#102
G83 R0.050 Z-0.7000 Q0.15 X0.0000 Y-3.5000 F#102
G83 R0.050 Z-0.7000 Q0.15 X0.0000 Y-2.5000 F#102
G00 G53 Z0.0000
(drill at station 3)
G57
G00 X0.0000 Y0.0000
G00 Z1.5000
G00 X-1.188 Y-0.250
G00 Z0.500
G83 R0.500 Z-0.938 Q0.15 F#102
G00 Z1.5000
G00 X1.188 Y-0.250
G00 Z0.500
G83 R0.500 Z-0.938 Q0.15 F#102
M5 M9
G00 G53 Z0.0000
(MILL 0.500)
T5 M6 G43
S1527 M3 M8
G55
G00 X0 Y0
G00 Z0.2500
F#100
(two large holes - turn the slugs into chips so they don't get caught)
(o100 call [x pos] [y pos] [safety height] [hole depth] [hole dia] [tool dia])
o100 call [0.0000] [0.0000] [0.25] [0.6] [1.000] [0.5]
o100 call [0.0000] [0.0000] [0.25] [0.6] [1.876] [0.5]
o100 call [0.0000] [-8.900] [0.25] [0.6] [1.00] [0.5]
o100 call [0.0000] [-8.900] [0.25] [0.6] [2.00] [0.5]
G00 G53 Z0.0000
(station 2 - milling the perimeter)
G56
(first notch - to allow scrap to drop away)
G00 X0 Y0
G00 X-3.75 Y-8.9
G00 Z0.25
G01 Z-0.25
G01 X-2.9 Y-8.9
G00 Z0.25
G00 X-3.75 Y-8.9
G01 Z-0.6
G01 X-2.9 Y-8.9
G00 Z0.25
(2nd drop notch)
G00 X-3.75 Y0.5
G01 Z-0.25
G01 X-2 Y0.5
G00 Z0.25
G00 X-3.75 Y0.5
G01 Z-0.6
G01 X-2 Y0.5
G00 Z0.25
(3rnd drop notch)
G00 X0 Y2.75
G01 Z-0.25
G01 X0 Y1.75
G00 Z0.25
G00 X0 Y2.75
G01 Z-0.6
G01 X0 Y1.75
G00 Z0.25
(beginning of profile)
G00 G53 Z0.0000
G00 X0 Y0
G00 Z0.2500
G00 X-1.6732 Y1.0677
G41 D15 (oversize tool diameter)
G03 X-0.6423 Y1.0677 I0.5154 J0.8569 Z-0.2500 F#100
G02 X0.6423 Y1.0677 I0.6423 J-1.0677
G01 X1.4775 Y0.5653
G02 X1.5976 Y0.3739 I-0.1289 J-0.2142
G01 X2.4036 Y-8.3886
G02 X2.4046 Y-8.4115 I-0.2489 J-0.0229
G01 X2.4046 Y-9.4000
G02 X2.2096 Y-9.7962 I-0.5000 J0.0000
G01 X0.0386 Y-11.4672
G02 X-0.6625 Y-11.3760 I-0.3050 J0.3962
G01 X-2.3342 Y-9.2050
G02 X-2.4359 Y-8.8548 I0.3962 J0.3050
G01 X-1.5975 Y0.3737
G02 X-1.4774 Y0.5653 I0.2490 J-0.0226
G01 X-0.6423 Y1.0677
G02 X0.6423 Y1.0677 I0.6423 J-1.0677 Z-0.6000
G01 X1.4775 Y0.5653
G02 X1.5976 Y0.3739 I-0.1289 J-0.2142
G01 X2.4036 Y-8.3886
G02 X2.4046 Y-8.4115 I-0.2489 J-0.0229
G01 X2.4046 Y-9.4000
G02 X2.2096 Y-9.7962 I-0.5000 J0.0000
G01 X0.0386 Y-11.4672
G02 X-0.6625 Y-11.3760 I-0.3050 J0.3962
G01 X-2.3342 Y-9.2050
G02 X-2.4359 Y-8.8548 I0.3962 J0.3050
G01 X-1.5975 Y0.3737
G02 X-1.4774 Y0.5653 I0.2490 J-0.0226
G01 X-0.6423 Y1.0677
G02 X0.6423 Y1.0677 I0.6423 J-1.0677
G00 Z0.2500
G40
G00 X-1.6732 Y1.0677
G41 D5
G03 X-0.6423 Y1.0677 I0.5154 J0.8569 Z-0.6000 F#100
G02 X0.6423 Y1.0677 I0.6423 J-1.0677
G01 X1.4775 Y0.5653
G02 X1.5976 Y0.3739 I-0.1289 J-0.2142
G01 X2.4036 Y-8.3886
G02 X2.4046 Y-8.4115 I-0.2489 J-0.0229
G01 X2.4046 Y-9.4000
G02 X2.2096 Y-9.7962 I-0.5000 J0.0000
G01 X0.0386 Y-11.4672
G02 X-0.6625 Y-11.3760 I-0.3050 J0.3962
G01 X-2.3342 Y-9.2050
G02 X-2.4359 Y-8.8548 I0.3962 J0.3050
G01 X-1.5975 Y0.3737
G02 X-1.4774 Y0.5653 I0.2490 J-0.0226
G01 X-0.6423 Y1.0677
G01 X-0.2248 Y1.3189 (continue past edge)
G00 Z0.2500
G40
M5 M9
G00 G53 Z0.0000
(TAP PULLEY 1/4-20)
T6 M6 G43
S200 M3 M8
G55
G00 X0.0000 Y0.0000
G00 Z0.2500
G00 X0.0000 Y-7.0000
G33.1 Z-0.95 K0.05
G00 X0.0000 Y-6.0000
G33.1 Z-0.95 K0.05
G00 X0.0000 Y-3.5000
G33.1 Z-0.95 K0.05
G00 X0.0000 Y-2.5000
G33.1 Z-0.95 K0.05
G00 G53 Z0.0000
G57
G00 X0.0000 Y0.0000
G00 Z1.5000
G00 X1.1880 Y-0.2500
G33.1 Z-1.0 K0.05
G00 X-1.1880 Y-0.2500
G33.1 Z-1.0 K0.05
M5 M9
G00 G53 Z0.0000
T0 M6 G49
M02

View File

@@ -0,0 +1,14 @@
G21 (metric)
F100 (note slow feed)
G91 (relative mode)
G1 X10
; this sub switches to G20 (inch) and G90 but protects the caller by M70/M71
; it also switches to a much higher feed
O<g20sub> callsub
G1 X10 (this move still relative and in metric units, note slow feed restored)
m2

View File

@@ -0,0 +1,301 @@
(info: arc1: inside/outside, cw/ccw, cutter radius compensation)
; Arc making subroutine formatted for ngcgui
; Specify:
; dir == 2 for cw, 3 for ccw
; inside == 1 for inside, 0 for outside
; xoff,yoff == arc center
; arc radius == distance to center of rotation
; angle == anglular spread of arc
; rotate == rotation of arc
; width == width of arc
; see also arc2.ngc to specify using center of rotation
;----------------------------------------------------------------------
; Copyright: 2012
; Author: Dewey Garrett <dgarrett@panix.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.
;----------------------------------------------------------------------
o<arc1> sub
#<toolno> = #1 (=1)
#<dir> = #2 (=2 2:cw 3:ccw)
#<inside> = #3 (=1 1:inside 0:outside)
#<rpm> = #4 (=2000)
#<feedrate> = #5 (=100)
#<zincr> = #6
#<cutdepth> = #7
#<zsafe> = #8 (=0.25)
#<zstart> = #9 (=0)
#<width> = #10 (=.3)
#<angle> = #11 (=45 Angle)
#<arc_r> = #12 (=2 Arc Radius)
#<rotate> = #13 (=-90)
#<xoff> = #14 (=2)
#<yoff> = #15 (=0)
#<scale> = #16 (=1)
#<spin_notify> = #17 (=0)
#<use_g43> = #18 (=1)
#<h_for_g43> = #19 (=0)
#<verbose> = #20 (=0)
#<min_angle> = 1 ;minimum angle
g40; cutter comp off to begin
o<i0> if [#<scale> LE 0]
(print, arc1: bad scale: #<scale> - EXITING)
(debug, arc1: bad scale: #<scale> - EXITING)
(AXIS,notify, arc1: bad scale - EXITING)
m2
o<i0> endif
o<i1> if [[#<dir> NE 2] AND [#<dir> NE 3]]
(print, arc1: bad dir=#<dir> - EXITING)
(debug, arc1: bad dir=#<dir> - EXITING)
(AXIS,notify, arc1: bad dir - EXITING)
m2
o<i1> endif
o<i2> if [[#<inside> NE 1] AND [#<inside> NE 0]]
(print, arc1: bad inside specifier: #<inside> - EXITING)
(debug, arc1: bad inside specifier: #<inside> - EXITING)
(AXIS,notify, arc1: bad inside specifier - EXITING)
m2
o<i2> endif
o<i3> if [#<angle> LT #<min_angle>]
(print, arc1: angle too small: #<angle> - EXITING)
(debug, arc1: angle too small: #<angle> - EXITING)
(AXIS,notify, arc1: angle too small - EXITING)
m2
o<i3> endif
o<loadtool> call [#<toolno>][#<use_g43>][#<h_for_g43>][#<verbose>]
#<tooldiam> = [#5410 + .001]
o<iftool> if [[#<tooldiam> GT #<width>] AND [#<inside> EQ 1]]
(print, arc1: tooldiam too big: #<tooldiam> - EXITING)
(debug, arc1: tooldiam too big: #<tooldiam> - EXITING)
(AXIS,notify, arc1: tooldiam too big - EXITING)
m2
o<iftool> endif
; construct arc parallel to x axis (for transformation later)
#<slot_r> = [#<width>/2]
#<phi> = [90 - #<angle>/2]
#<distance> = [2 * #<arc_r> * COS[#<phi>]] ; between endpoints
; (xa,ya), (xb,yb), ... are points on arc
; (vxas,vyas), (vxbs,vybs), ... are vectors to subarc centers (short ones)
; (vxal,vyal), (vxbl,vybl), ... are vectors to subarc centers (long ones)
; start point is at center of outside arc:
#<x0> = 0
#<y0> = [#<slot_r> + #<arc_r> * [1 - sin[#<phi>]]]
#<vx0> = 0
#<vy0> = [0 - #<arc_r> - #<slot_r>]
#<xa> = [0 + #<distance>/2 + #<slot_r> * cos[#<phi>]]
#<ya> = [0 + #<slot_r> * sin[#<phi>]]
#<vxas> = [0 - #<slot_r> * cos[#<phi>]]
#<vyas> = [0 - #<slot_r> * sin[#<phi>]]
#<vxal> = [0 - [#<arc_r> + #<slot_r>] * cos[#<phi>]]
#<vyal> = [0 - [#<arc_r> + #<slot_r>] * sin[#<phi>]]
#<xb> = [0 + #<distance>/2 - #<slot_r> * cos[#<phi>]]
#<yb> = [0 - #<slot_r> * sin[#<phi>]]
#<vxbs> = [0 + #<slot_r> * cos[#<phi>]]
#<vybs> = [0 + #<slot_r> * sin[#<phi>]]
#<vxbl> = [0 - [#<arc_r> - #<slot_r>] * cos[#<phi>]]
#<vybl> = [0 - [#<arc_r> - #<slot_r>] * sin[#<phi>]]
#<xc> = [0 - #<distance>/2 + #<slot_r> * cos[#<phi>]]
#<yc> = [0 - #<slot_r> * sin[#<phi>]]
#<vxcs> = [0 - #<slot_r> * cos[#<phi>]]
#<vycs> = [0 + #<slot_r> * sin[#<phi>]]
#<vxcl> = [0 + [#<arc_r> - #<slot_r>] * cos[#<phi>]]
#<vycl> = [0 - [#<arc_r> - #<slot_r>] * sin[#<phi>]]
#<xd> = [0 - #<distance>/2 - #<slot_r> * cos[#<phi>]]
#<yd> = [0 + #<slot_r> * sin[#<phi>]]
#<vxds> = [0 + #<slot_r> * cos[#<phi>]]
#<vyds> = [0 - #<slot_r> * sin[#<phi>]]
#<vxdl> = [0 + [#<arc_r> + #<slot_r> ] * cos[#<phi>]]
#<vydl> = [0 - [#<arc_r> + #<slot_r> ] * sin[#<phi>]]
;# this offset makes center at x,y = 0,0 for convenience:
#<yf> = [0 - #<arc_r> * [1 - sin[#<phi>]]]
#<y0> = [#<yf> + #<y0>]
#<ya> = [#<yf> + #<ya>]
#<yb> = [#<yf> + #<yb>]
#<yc> = [#<yf> + #<yc>]
#<yd> = [#<yf> + #<yd>]
; choose points according to dir:
o<ifdir> if [#<dir> EQ 2] ; cw 0->a->b->c->d->0
#<dir0> = 2 ; pre entry
#<dir1> = 2 ; most
#<dir2> = 3 ; inside of arc
; 1/4 circle arc entry move
#<xp> = [#<x0> - #<tooldiam>/2]
#<yp> = [#<y0> - #<tooldiam>/2]
#<vxp> = [#<tooldiam>/2]
#<vyp> = 0
#<x1> = #<xa>
#<y1> = #<ya>
#<vx1> = #<vxas>
#<vy1> = #<vyas>
#<x2> = #<xb>
#<y2> = #<yb>
#<vx2> = #<vxbl>
#<vy2> = #<vybl>
#<x3> = #<xc>
#<y3> = #<yc>
#<vx3> = #<vxcs>
#<vy3> = #<vycs>
#<x4> = #<xd>
#<y4> = #<yd>
#<vx4> = #<vxdl>
#<vy4> = #<vydl>
o<ifdir> else ; ccw 0->d->c->b->a->0
#<dir0> = 3 ; pre entry
#<dir1> = 3 ; most
#<dir2> = 2 ; inside of arc
; 1/4 circle arc entry move
#<xp> = [#<x0> + #<tooldiam>/2]
#<yp> = [#<y0> - #<tooldiam>/2]
#<vxp> = [0 - #<tooldiam>/2]
#<vyp> = 0
#<x1> = #<xd>
#<y1> = #<yd>
#<vx1> = #<vxds>
#<vy1> = #<vyds>
#<x2> = #<xc>
#<y2> = #<yc>
#<vx2> = #<vxcl>
#<vy2> = #<vycl>
#<x3> = #<xb>
#<y3> = #<yb>
#<vx3> = #<vxbs>
#<vy3> = #<vybs>
#<x4> = #<xa>
#<y4> = #<ya>
#<vx4> = #<vxal>
#<vy4> = #<vyal>
o<ifdir> endif
; apply rotation, scaling, offsets
o<move> call [#<xp>][#<yp>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<xp> = #<_move:x>
#<yp> = #<_move:y>
o<move> call [#<x0>][#<y0>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x0> = #<_move:x>
#<y0> = #<_move:y>
o<move> call [#<x1>][#<y1>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x1> = #<_move:x>
#<y1> = #<_move:y>
o<move> call [#<x2>][#<y2>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x2> = #<_move:x>
#<y2> = #<_move:y>
o<move> call [#<x3>][#<y3>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x3> = #<_move:x>
#<y3> = #<_move:y>
o<move> call [#<x4>][#<y4>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x4> = #<_move:x>
#<y4> = #<_move:y>
; vectors to arc centers: just rotate and scale, no offset
o<move> call [#<vxp>][#<vyp>][#<rotate>][#<scale>][0][0]
#<vxp> = #<_move:x>
#<vyp> = #<_move:y>
o<move> call [#<vx0>][#<vy0>][#<rotate>][#<scale>][0][0]
#<vx0> = #<_move:x>
#<vy0> = #<_move:y>
o<move> call [#<vx1>][#<vy1>][#<rotate>][#<scale>][0][0]
#<vx1> = #<_move:x>
#<vy1> = #<_move:y>
o<move> call [#<vx2>][#<vy2>][#<rotate>][#<scale>][0][0]
#<vx2> = #<_move:x>
#<vy2> = #<_move:y>
o<move> call [#<vx3>][#<vy3>][#<rotate>][#<scale>][0][0]
#<vx3> = #<_move:x>
#<vy3> = #<_move:y>
o<move> call [#<vx4>][#<vy4>][#<rotate>][#<scale>][0][0]
#<vx4> = #<_move:x>
#<vy4> = #<_move:y>
s #<rpm> m3
o<if1> if [#<spin_notify> GT 0]
o<spin> call [#<rpm>]
o<if1> endif
f#<feedrate>
g0 z#<zsafe>
g0 x#<xp> y#<yp> ; pre-entry point
o<ifi0> if [#<inside> EQ 1]
o<ifi1> if [#<dir> EQ 2]
/g42 ;# cutter compensation right of path
o<ifi1> else
/g41 ;# cutter compensation left of path
o<ifi1> endif
o<ifi0> else
o<ifi2> if [#<dir> EQ 2]
/g41 ;# cutter compensation left of path
o<ifi2> else
/g42 ;# cutter compensation right of path
o<ifi2> endif
o<ifi0> endif
; entry with cutter radius compensation
g#<dir0> x#<x0> y#<y0> i #<vxp> j #<vyp>
g1 z#<zstart>
#<zcurrent> = [#<zstart> - #<zincr>]
o<wh1> while [#<zcurrent> GT [0 - #<cutdepth>]]
g#<dir1> x#<x1> y#<y1> i#<vx0> j#<vy0> z #<zcurrent>
g#<dir1> x#<x2> y#<y2> i#<vx1> j#<vy1>
g#<dir2> x#<x3> y#<y3> i#<vx2> j#<vy2>
g#<dir1> x#<x4> y#<y4> i#<vx3> j#<vy3>
g#<dir1> x#<x0> y#<y0> i#<vx4> j#<vy4>
#<zcurrent>=[#<zcurrent>-#<zincr>]
o<wh1> endwhile
g#<dir1> x#<x1> y#<y1> i#<vx0> j#<vy0> z [0 - #<cutdepth>]
g#<dir1> x#<x2> y#<y2> i#<vx1> j#<vy1>
g#<dir2> x#<x3> y#<y3> i#<vx2> j#<vy2>
g#<dir1> x#<x4> y#<y4> i#<vx3> j#<vy3>
g#<dir1> x#<x0> y#<y0> i#<vx4> j#<vy4>
g#<dir1> x#<x1> y#<y1> i#<vx0> j#<vy0>
g0 z#<zsafe>
g40 ;# cancel cutter radius compensation
o<arc1> endsub

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -0,0 +1,54 @@
(info: arc2: specify arc center, offset, angle)
; dir: 2 for cw, 3 for ccw
; inside: 1 for inside, else outside
; Specify:
; (xoff,yoff) == arc center
; (xctr,yctr) == center of rotation
; angle == anglular spread of arc
; width == width of arc
; calls arc1.ngc
o<arc2> sub
#<toolno> = #1 (=1)
#<dir> = #2 (=2 2:cw 3:ccw)
#<inside> = #3 (=1 1:inside 0:outside)
#<rpm> = #4 (=2000)
#<feedrate> = #5 (=100)
#<zincr> = #6
#<cutdepth> = #7
#<zsafe> = #8 (=0.25)
#<zstart> = #9 (=0)
#<width> = #10 (=.25)
#<angle> = #11 (=15)
#<xoff> = #12 (=2)
#<yoff> = #13 (=1)
#<xctr> = #14 (=0)
#<yctr> = #15 (=0)
#<scale> = #16 (=1)
#<spin_notify> = #17 (=0)
#<use_g43> = #18 (=1)
#<h_for_g43> = #19 (=0)
#<verbose> = #20 (=0)
#<min_separation> = .1
#<delx> = [#<xoff> - #<xctr>]
#<dely> = [#<yoff> - #<yctr>]
#<arc_r> = [SQRT[#<dely>*#<dely> + #<delx>*#<delx>]]
#<rotate> = [-90 + ATAN[#<dely>]/[#<delx>]]
o<if0> if [#<arc_r> LT #<min_separation>]
(print, arc2: separation too small: #<arc_r> - EXITING)
(debug, arc2: separation too small: #<arc_r> - EXITING)
(AXIS,notify, arc2: separation too small - EXITING)
m2
o<if0> endif
o<arc1>call[#<toolno>][#<dir>][#<inside>][#<rpm>][#<feedrate>][#<zincr>][#<cutdepth>][#<zsafe>][#<zstart>][#<width>][#<angle>][#<arc_r>][#<rotate>][#<xoff>][#<yoff>][#<scale>][#<spin_notify>][#<use_g43>][#<h_for_g43>][#<verbose>]
o<arc2> endsub

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -0,0 +1,89 @@
(info: backlash measurement utility, use with dial indicator)
o<backlash> sub
#<axis> = #1 (= 0 0=x 1=y 2=z)
#<p1> = #2 (= 1.1)
#<p2> = #3 (= 2)
#<fraction> = #4 (= 0.1)
#<feedrate> = #5 (= 10)
#<count> = #6 (= 10)
o<l10> if [#<p1> GT #<p2>]
#<vmin> = #<p2>
#<vmax> = #<p1>
o<l10> else
#<vmin> = #<p1>
#<vmax> = #<p2>
o<l10> endif
#<delv> = [#<vmax> - #<vmin>]
o<l20> if [ABS[#<delv>] GT 0.9] (protect indicator)
(debug, backlash: move too big for indicator #<delv> - EXITING)
(print, backlash: move too big for indicator #<delv> - EXITING)
(AXIS,notify, backlash: move too big for indicator - EXITING)
m2
o<l20> endif
o<l30> if [[#<fraction> GT .99] OR [#<fraction> LT .01]]
(debug, backlash: bad fraction: #<fraction> - EXITING)
(print, backlash: bad fraction: #<fraction> - EXITING)
(AXIS,notify, bad fraction - EXITING)
m2
o<l30> endif
#<vzero> = [#<vmin> + [#<vmax> - #<vmin>] * #<fraction>]
#<ok> = 0
f #<feedrate> g1
o<whl> while [#<count> GT 0]
o<xxx> if [#<axis> EQ 0]
#<ok> = 1
x #<vmin>
x #<vzero>
(debug, set indicator ZERO, S to continue)
m0 (mandatory stop)
M110
x #<vmax>
x #<vzero>
o<xxx> endif
o<yyy> if [#<axis> EQ 1]
#<ok> = 1
y #<vmin>
y #<vzero>
(debug, set indicator ZERO, S to continue)
m0 (mandatory stop)
M110
y #<vmax>
y #<vzero>
o<yyy> endif
o<zzz> if [#<axis> EQ 2]
#<ok> = 1
z #<vmin>
z #<vzero>
(debug, set indicator ZERO, S to continue)
m0 (mandatory stop)
M110
z #<vmax>
z #<vzero>
o<zzz> endif
o<ccc> if [#<axis> EQ 5]
#<ok> = 1
c #<vmin>
c #<vzero>
(debug, set indicator ZERO, S to continue)
m0 (mandatory stop)
M110
c #<vmax>
c #<vzero>
o<ccc> endif
#<count> = [#<count> - 1]
(debug, READ indicator, S to continue)
m0 (mandatory stop)
M110
o<whl> endwhile
o<l60> if [#<ok> EQ 0]
(debug, bad axis specifier: #<axis>)
(print, bad axis specifier: #<axis>)
o<l60> endif
o<backlash> endsub

View File

@@ -0,0 +1,54 @@
(info: db25 connector -- uses iquad.ngc)
; centered at origin, use offsets to relocate
o<db25> sub
#<toolno> = #1 (=1)
#<rpm> = #2 (=2000)
#<dir> = #3 (=2 2conv|3climb)
#<feedrate> = #4 (=10)
#<cutdepth> = #5 (=.1)
#<zincr> = #6 (=.02)
#<zsafe> = #7 (=0.2)
#<zstart> = #8 (=0)
#<xoff> = #9 (=0)
#<yoff> = #10 (=0)
#<rotate> = #11 (=0)
#<use_g43> = #12 (=1)
#<h_for_g43>= #13 (=0)
#<verbose> = #14 (=0)
; reject tools that are too big
o<loadtool> call [#<toolno>][#<use_g43>][#<h_for_g43>][#<verbose>]
#<tooldiam> = #5410
o<if0> if [#<tooldiam> Gt 0.12501]
(debug, db25: tooldiam too big: #<tooldiam> - EXITING)
(print, db25: tooldiam too big: #<tooldiam> - EXITING)
(AXIS,notify, db25: tooldiam too big - EXITING)
m2
o<if0> endif
; http://www.interfacebus.com/Connector_D-Sub_Mechanical_Dimensions.html
; mounting hole spacing is 1.857
#<xlong> = 1.635
#<xlong> = 1.675 ; adjust to allow use of 0.125 cutter diameter
#<y> = 0.432
#<xshort> = [#<xlong> - 2 * #<y> * tan[10]]
; center at origin
#<x1> = [0.5 * #<xlong>]
#<y1> = [0.5 * #<y>]
#<x2> = [ 0.5 * #<xshort>]
#<y2> = [-0.5 * #<y>]
#<x3> = [-0.5 * #<xshort>]
#<y3> = [-0.5 * #<y>]
#<x4> = [-0.5 * #<xlong>]
#<y4> = [ 0.5 * #<y>]
#<scale> = 1.0
o<iquad>call[#<toolno>][#<rpm>][#<dir>][#<feedrate>][#<cutdepth>][#<zincr>][#<zsafe>][#<zstart>][#<x1>][#<y1>][#<x2>][#<y2>][#<x3>][#<y3>][#<x4>][#<y4>][#<scale>][#<rotate>][#<xoff>][#<yoff>]
o<db25> endsub

View File

@@ -0,0 +1,67 @@
(Adapted from Program to mill a flowsnake.ngc by K. Lerman)
(info: gosper -- recursion demo -- line is x1,y1 to x2,y2)
o<gosper> sub
#<rpm> = #1 (=2000)
#<zcut> = #2 (=.010 depth of cut)
#<feedrate> = #3 (=10)
#<zsafe> = #4 (=0.5 safety height)
#<x1> = #5 (=-0.866 line x1)
#<y1> = #6 (=-0.5 line y1)
#<x2> = #7 (= 0.866 line x2)
#<y2> = #8 (=-0.5 line y2)
#<level> = #9 (=3 recursion lvl)
#<scale> = #10 (=1)
#<rotate> = #11 (=0)
#<xoff> = #12 (=-3)
#<yoff> = #13 (=-3)
(debug, feature: #<_feature:>)
(debug, remaining: #<_remaining_features:>)
o<i0> if [#<scale> EQ 0]
#<scale> = 1.0
(debug, scale was 0, setting #<scale>)
o<i0> endif
o<t1> if [#<level> LT 0]
#<level> = 0
(debug, level set to #<level>)
o<t1> endif
o<t2> if [#<level> GT 4]
#<level> = 4
(debug, level reduced to #<level>)
o<t2> endif
o<move> call [#<x1>][#<y1>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x1> = #<_move:x>
#<y1> = #<_move:y>
#<len1> = #<_move:len>
#<phi1> = #<_move:phi>
o<move> call [#<x2>][#<y2>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x2> = #<_move:x>
#<y2> = #<_move:y>
#<len2> = #<_move:len>
#<phi2> = #<_move:phi>
#<fr> = #<feedrate>
s#<rpm> M3 (spindle on)
o<spin> call [#<rpm>]
g0 z #<zsafe>
g0 x #<x1> y #<y1>
f #<feedrate>
g1 z [0 - #<zcut>]
#<dely> = [#<y2> - #<y1>]
#<delx> = [#<x2> - #<x1>]
#<len> = [SQRT[#<delx>*#<delx> + #<dely>*#<dely>]]
#<theta> = ATAN [#<dely>]/[#<delx>] (degrees)
(compute p3 for equilateral triangle)
#<p3x> = [#<x1> + #<len> * COS[#<theta> + 60]]
#<p3y> = [#<y1> + #<len> * SIN[#<theta> + 60]]
(three sides of equilateral triangle)
o<gosper_sub> call [#<level>][#<x1>] [#<y1>] [#<x2>] [#<y2>] [#<fr>]
o<gosper_sub> call [#<level>][#<x2>] [#<y2>] [#<p3x>][#<p3y>][#<fr>]
o<gosper_sub> call [#<level>][#<p3x>][#<p3y>][#<x1>] [#<y1>] [#<fr>]
g0 z #<zsafe>
o<gosper> endsub

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@@ -0,0 +1,154 @@
(info: helix: in/out cutting, cw/ccw dir with radius comp, D-holes)
o<helix> sub
#<toolno> = #1 (=1)
#<rpm> = #2 (=2000)
#<feedrate> = #3 (=10)
#<dir> = #4 (=3 2:cw, 3:ccw)
#<inside> = #5 (=1 1:in, 0:out)
#<cutdepth> = #6 (z cutdepth)
#<zincr> = #7 (z increment)
#<zsafe> = #8 (=0.5)
#<x> = #9 (x center)
#<y> = #10 (y center)
#<hdiam> = #11 (diameter)
#<faceangle> = #12 (=0 face angle)
#<d_angle> = #13 (=0 d angle)
#<zstart> = #14 (=0)
#<spin_notify>= #15 (=0)
#<use_g43> = #16 (=1)
#<h_for_g43> = #17 (=0)
#<verbose> = #18 (=0)
o<loadtool> call [#<toolno>][#<use_g43>][#<h_for_g43>][#<verbose>]
#<tooldiam> = [#5410 + .001]
#<hr> = [#<hdiam>/2]
#<cutdepth> = [-1 * #<cutdepth>]
o<l00> if [#<cutdepth> GT 0.0]
(debug, helix: bad cutdepth #<cutdepth> - EXITING)
(print, helix: bad cutdepth #<cutdepth> - EXITING)
(AXIS,notify, helix: bad cutdepth - EXITING)
m2
o<l00> endif
#<zincr> = [-1 * #<zincr>]
o<l01> if [#<zincr> GT 0.0]
(debug, helix: bad zincr #<zincr> - EXITING)
(print, helix: bad zincr #<zincr> - EXITING)
(AXIS,notify, helix: bad zincr - EXITING)
m2
o<l01> endif
o<l02> if [[#<inside> NE 0] AND [#<inside> NE 1]]
(debug, helix: bad inside specifier #<inside> - EXITING)
(print, helix: bad inside specifier #<inside> - EXITING)
(AXIS,notify, helix: bad inside specifier - EXITING)
m2
o<l02> endif
o<l03> if [[#<dir> NE 2] AND [#<dir> NE 3]]
(debug, helix: bad dir specifier #<dir> - EXITING)
(print, helix: bad dir specifier #<dir> - EXITING)
(AXIS,notify, helix: bad dir specifier - EXITING)
m2
o<l03> endif
#<rtool> = [#<tooldiam> / 2.0]
G40 (cutter radius compensation off)
s#<rpm> m3 (spindle cw)
o<if1> if [#<spin_notify> GT 0]
o<spin> call [#<rpm>]
o<if1> endif
f #<feedrate>
#<delta> = #<d_angle>
#<d2> = [#<d_angle>/2]
(to avoid gouging, start point is arc opposite flat)
(start point x0,y0 and vector to center vx0,vy0)
#<x0> = [#<x> + #<hr> * cos[#<faceangle> + 180]]
#<y0> = [#<y> + #<hr> * sin[#<faceangle> + 180]]
#<vx0> = [#<hr> * cos[#<faceangle>]]
#<vy0> = [#<hr> * sin[#<faceangle>]]
o<entry> call [#<inside>][#<dir>][#<tooldiam>][#<x0>][#<y0>][#<x>][#<y>]
#<prex> = #<_entry:prex> (pre entry point)
#<prey> = #<_entry:prey>
#<vxe> = #<_entry:vx> (vector to arc center)
#<vye> = #<_entry:vy>
(points at the ends of the arc)
(x1,y1 start point of flat, vx1,vy1 vector to center)
(x2,y2 start point of flat, vx2,vy2 vector to center)
o<l08> if [#<dir> eq 2] (cw)
#<x1> = [#<x> + #<hr> * cos[#<faceangle> + #<d2>]]
#<y1> = [#<y> + #<hr> * sin[#<faceangle> + #<d2>]]
#<vx1> = [#<hr> * cos[#<faceangle> + #<d2> + 180]]
#<vy1> = [#<hr> * sin[#<faceangle> + #<d2> + 180]]
#<x2> = [#<x> + #<hr> * cos[#<faceangle> - #<d2>]]
#<y2> = [#<y> + #<hr> * sin[#<faceangle> - #<d2>]]
#<vx2> = [#<hr> * cos[#<faceangle> - #<d2> + 180]]
#<vy2> = [#<hr> * sin[#<faceangle> - #<d2> + 180]]
o<l08> else
#<x2> = [#<x> + #<hr> * cos[#<faceangle> + #<d2>]]
#<y2> = [#<y> + #<hr> * sin[#<faceangle> + #<d2>]]
#<vx2> = [#<hr> * cos[#<faceangle> + #<d2> + 180]]
#<vy2> = [#<hr> * sin[#<faceangle> + #<d2> + 180]]
#<x1> = [#<x> + #<hr> * cos[#<faceangle> - #<d2>]]
#<y1> = [#<y> + #<hr> * sin[#<faceangle> - #<d2>]]
#<vx1> = [#<hr> * cos[#<faceangle> - #<d2> + 180]]
#<vy1> = [#<hr> * sin[#<faceangle> - #<d2> + 180]]
o<l08> endif
g0 z #<zsafe>
o<l10> if [#<inside> NE 0] (inside)
o<l20> if [#<dir> eq 2] (cw)
(debug conventional CW,INSIDE)
g0 x#<prex> y#<prey> z #<zsafe>
/ g42 (cutter radius comp right of path)
g2 x#<x0> y#<y0> i#<vxe> j#<vye>
o<l20> else (ccw)
(debug climb CCW,INSIDE)
g0 x#<prex> y#<prey> z #<zsafe>
/ g41 (cutter radius comp left of path)
g3 x#<x0> y#<y0> i#<vxe> j#<vye>
o<l20> endif
o<l10> else (outside)
o<l30> if [#<dir> eq 2] (2 ==> cw)
(debug,climb CW,OUTSIDE)
g0 x#<prex> y#<prey> z #<zsafe>
/ g41 (cutter radius comp left of path)
g3 x#<x0> y#<y0> i#<vxe> j#<vye>
o<l30> else (3 ==> ccw)
(debug conventional CCW,OUTSIDE)
g0 x#<prex> y#<prey> z #<zsafe>
/ g42 (cutter radius comp right of path)
g2 x#<x0> y#<y0> i#<vxe> j#<vye>
o<l30> endif
o<l10> endif
(entry complete: #<x0>,#<y0>,#<zsafe>)
g0 z [#<zstart> + 0.05] (hardcoded delta)
g1 z #<zstart> (plunge)
#<zcurrent> = #<zstart>
#<_:pass> = 1 (colon makes hidden global var)
o<l30> while [#<zcurrent> GT #<cutdepth>]
#<zcurrent> = [#<zcurrent> + #<zincr>]
o<l32> if [#<zcurrent> LT #<cutdepth>]
#<zcurrent> = #<cutdepth>
o<l32> endif
g#<dir> x#<x1> y#<y1> i#<vx0> j#<vy0> z#<zcurrent>
g1 x#<x2> y#<y2>
g#<dir> x#<x0> y#<y0> i#<vx2> j#<vy2> z#<zcurrent>
#<_:pass> = [#<_:pass> + 1]
o<l30> endwhile
(final traverse at full depth)
g#<dir> x#<x1> y#<y1> i#<vx0> j#<vy0> z#<zcurrent>
g1 x#<x2> y#<y2>
g#<dir> x#<x0> y#<y0> i#<vx2> j#<vy2> z#<zcurrent>
g0 z#<zsafe>
g40
o<helix> endsub

View File

@@ -0,0 +1,29 @@
(info: helix_rtheta: specify center with r,theta, uses helix.ngc)
o<helix_rtheta> sub
#<toolno> = #1 (=1)
#<rpm> = #2 (=2000)
#<feedrate> = #3 (=10)
#<dir> = #4 (=3 2:cw, 3:ccw)
#<inside> = #5 (=1 1:in, 0:out)
#<cutdepth> = #6 (z cutdepth)
#<zincr> = #7 (z increment)
#<zsafe> = #8 (=0.5)
#<hdiam> = #9 (hole diameter)
#<faceangle> = #10 (=0 face angle)
#<d_angle> = #11 (=0 d angle)
#<r> = #12 (r center)
#<theta> = #13 (theta center)
#<zstart> = #14 (=0)
#<spin_notify>= #15 (=0)
#<use_g43> = #16 (=1)
#<h_for_g43> = #17 (=0)
#<verbose> = #18 (=0)
o<loadtool> call [#<toolno>][#<use_g43>][#<h_for_g43>][#<verbose>]
#<tooldiam> = [#5410 + 0.001]
#<x> = [#<r> * COS[#<theta>]]
#<y> = [#<r> * SIN[#<theta>]]
o<helix>call [#<toolno>][#<rpm>][#<feedrate>][#<dir>][#<inside>][#<cutdepth>][#<zincr>][#<zsafe>][#<x>][#<y>][#<hdiam>][#<faceangle>][#<d_angle>][#<zstart>][#<spin_notify>][#<use_g43>][#<h_for_g43>][#<verbose>]
o<helix_rtheta> endsub

View File

@@ -0,0 +1,45 @@
(info: hole_circle: equally spaced, uses helix.ngc)
o<hole_circle> sub
#<toolno> = #1
#<rpm> = #2 (=2000)
#<feedrate> = #3 (=10)
#<dir> = #4 (=3 2:cw, 3:ccw)
#<inside> = #5 (=1 1:in, 0:out)
#<cutdepth> = #6
#<zincr> = #7
#<zsafe> = #8 (=0.5)
#<diam> = #9 (Circle diameter)
#<theta> = #10 (=0 start theta)
#<hdiam> = #11 (hole diameter)
#<n> = #12 (=4 N holes)
#<zstart> = #13 (=0)
#<xctr> = #14 (= 0)
#<yctr> = #15 (= 0)
#<spin_notify>= #16 (= 0)
#<use_g43> = #17 (=1)
#<h_for_g43> = #18 (=0)
#<verbose> = #19 (=0)
o<loadtool> call [#<toolno>][#<use_g43>][#<h_for_g43>][#<verbose>]
#<tooldiam> = [#5410 + .001]
#<i> = 0
#<deltheta> = [360/#<n>]
#<faceangle> = 0 (notused helix item)
#<d_angle> = 0 (notused helix item)
#<r> = [#<diam> / 2]
o<l20> while [#<i> LT #<n>]
#<x> = [#<xctr> + #<r> * COS[#<theta>]]
#<y> = [#<yctr> + #<r> * SIN[#<theta>]]
o<helix>call [#<toolno>][#<rpm>][#<feedrate>][#<dir>][#<inside>][#<cutdepth>][#<zincr>][#<zsafe>][#<x>][#<y>][#<hdiam>][#<faceangle>][#<d_angle>][#<zstart>][#<spin_notify>][#<use_g43>][#<h_for_g43>][#<verbose>]
#<i> = [#<i> + 1]
#<theta> = [#<theta> + #<deltheta>]
#<_feature:> = #<i> (using _feature: here disables stop)
(that would occur in helix at spin sub call)
o<l20> endwhile
o<hole_circle> endsub

View File

@@ -0,0 +1,218 @@
(require: angle at intersection of p1-2 and p1-4 must be obtuse)
(cw traverse: p1,p2,p3,p4)
(ccw traverse: p1,p4,p3,p2)
(info: ihex: internal hexagon, cw/ccw dir, radius compensation)
o<ihex> sub
#<toolno> = #1 (=1)
#<rpm> = #2 (=2000)
#<feedrate> = #3 (=10)
#<dir> = #4 (=2 2conv | 3climb)
#<flatd> = #5 (distance across flats)
#<cutdepth> = #6
#<zincr> = #7
#<zsafe> = #8 (=0.2)
#<zstart> = #9 (=0)
#<scale> = #10 (=1)
#<rotate> = #11 (=0)
#<xoff> = #12 (=0)
#<yoff> = #13 (=0)
#<spin_notify> = #14 (=0)
#<use_g43> = #15 (=1)
#<h_for_g43> = #16 (=0)
#<verbose> = #17 (=0)
o<i0> if [#<scale> EQ 0]
#<scale> = 1.0
(debug, scale was 0, setting #<scale>)
o<i0> endif
o<loadtool> call [#<toolno>][#<use_g43>][#<h_for_g43>][#<verbose>]
#<tooldiam> = [#5410 + .001]
o<dir> if [[#<dir> NE 2] AND [#<dir> NE 3]]
(debug, ihex: direction must be 2 or 3 - EXITING)
(print, ihex: direction must be 2 or 3 - EXITING)
(AXIS,notify, ihex: direction must be 2 or 3 - EXITING)
m2
o<dir> endif
#<f> = [#<flatd>/2]
#<p> = [#<f>/cos[30]]
#<pcos60> = [#<p> * cos[60]]
#<psin60> = [#<p> * sin[60]]
(p1 -> p2 -> is cw)
(apply scale,rotate, then offset to all input points)
#<x1> = #<p>
#<y1> = 0
o<move> call [#<x1>][#<y1>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x1> = #<_move:x>
#<y1> = #<_move:y>
#<x2> = #<pcos60>
#<y2> = [0 - #<psin60>]
o<move> call [#<x2>][#<y2>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x2> = #<_move:x>
#<y2> = #<_move:y>
#<x3> = [0 - #<pcos60>]
#<y3> = [0 - #<psin60>]
o<move> call [#<x3>][#<y3>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x3> = #<_move:x>
#<y3> = #<_move:y>
#<x4> = [0 - #<p>]
#<y4> = 0
o<move> call [#<x4>][#<y4>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x4> = #<_move:x>
#<y4> = #<_move:y>
#<x5> = [0 -# <pcos60>]
#<y5> = #<psin60>
o<move> call [#<x5>][#<y5>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x5> = #<_move:x>
#<y5> = #<_move:y>
#<x6> = #<pcos60>
#<y6> = #<psin60>
o<move> call [#<x6>][#<y6>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x6> = #<_move:x>
#<y6> = #<_move:y>
#<r> = [#<tooldiam>/2]
#<cutdepth> = [0 - #<cutdepth>]
#<zincr> = [0 - #<zincr>]
(get lengths and angles for connecting lines)
o<line> call [#<x1>][#<y1>][#<x2>][#<y2>]
#<phi12> = #<_line:phi>
o<line> call [#<x2>][#<y2>][#<x3>][#<y3>]
#<len23> = #<_line:len>
#<phi23> = #<_line:phi>
#<cos23> = #<_line:cos>
#<sin23> = #<_line:sin>
o<line> call [#<x1>][#<y1>][#<x6>][#<y6>]
#<phi16> = #<_line:phi>
o<line> call [#<x6>][#<y6>][#<x5>][#<y5>]
#<len65> = #<_line:len>
#<phi65> = #<_line:phi>
#<cos65> = #<_line:cos>
#<sin65> = #<_line:sin>
g40 (cutter radius compensation off)
f #<feedrate>
s #<rpm> m3 (spindle cw)
o<if1> if [#<spin_notify> GT 0]
o<spin> call [#<rpm>]
o<if1> endif
g0 z#<zsafe>
#<zcurrent> = #<zstart>
#<pass> = 1
o<wh010> while [#<zcurrent> GT #<cutdepth>]
#<zcurrent> = [#<zcurrent> + #<zincr>]
o<wh020> if [#<zcurrent> LT #<cutdepth>]
#<zcurrent> = #<cutdepth>
o<wh020> endif
o<wh030> if [#<pass> GT 100]
(debug, ihex: too many passes - EXITING)
(print, ihex: too many passes - EXITING)
(AXIS,notify, ihex: too many passes - EXITING)
m2
o<wh030> endif
o<dir00> if [#<dir> EQ 2]
o<aaa10> if [#<pass> EQ 1]
(arc entry along line1-2 where corner 1 is obtuse)
#<ax> = [#<x1> + 1 * #<r> * cos[#<phi12>]] (entry)
#<ay> = [#<y1> + 1 * #<r> * sin[#<phi12>]]
#<bx> = [#<ax> + 2 * #<r> * sin[#<phi12>]] (preentry 1)
#<by> = [#<ay> - 2 * #<r> * cos[#<phi12>]]
#<cx> = [#<bx> + #<r> * cos[#<phi12>]] (preentry 2)
#<cy> = [#<by> + #<r> * sin[#<phi12>]]
#<vx> = [0 - #<r> * sin[#<phi12>]] (r vector)
#<vy> = [0 + #<r> * cos[#<phi12>]]
g0 x #<cx> y #<cy> (preentry 1)
g0 x #<bx> y #<by> (preentry 2)
/ g42 (cutter radius comp right of path)
g2 x #<ax> y #<ay> i #<vx> j #<vy> (arc entry)
#<xfinal_a> = [#<x2>]
#<yfinal_a> = [#<y2>]
(go along the 2-->3 line to exit)
(angle between 1-->2 and 2-->3)
(only necessary for acute angles)
#<angle> = [180 + #<phi23> - #<phi12>]
#<elen> = [#<r> / ABS[TAN[#<angle>/2]]]
#<k> = [#<elen>/#<len23>]
(print angle=#<angle> elen=#<elen> k=#<k>)
o<aaa20> if [#<k> GE 1]
(debug, ihex: can't get in final corner k=#<k> - EXITING)
(print, ihex: can't get in final corner k=#<k> - EXITING)
(AXIS,notify, ihex: can't get in final corner - EXITING)
m2
o<aaa20> endif
#<xfinal_b> = [#<x2> + #<k> * #<len23> * #<cos23>]
#<yfinal_b> = [#<y2> + #<k> * #<len23> * #<sin23>]
g1 z #<zstart> (plunge)
o<aaa10> endif
x #<x2> y #<y2> z#<zcurrent>
x #<x3> y #<y3>
x #<x4> y #<y4>
x #<x5> y #<y5>
x #<x6> y #<y6>
x #<x1> y #<y1>
#<pass> = [#<pass> + 1]
o<dir00> else (dir EQ 3 CCW)
o<bbb10> if [#<pass> EQ 1]
(arc entry along line4-1 where corner 1 is obtuse)
#<ax> = [#<x1> + 1 * #<r> * cos[#<phi16>]] (entry)
#<ay> = [#<y1> + 1 * #<r> * sin[#<phi16>]]
#<bx> = [#<ax> - 2 * #<r> * sin[#<phi16>]] (preentry 1)
#<by> = [#<ay> + 2 * #<r> * cos[#<phi16>]]
#<cx> = [#<bx> + #<r> * cos[#<phi16>]] (preentry 2)
#<cy> = [#<by> + #<r> * sin[#<phi16>]]
#<vx> = [0 + #<r> * sin[#<phi16>]] (r vector)
#<vy> = [0 - #<r> * cos[#<phi16>]]
g0 x #<cx> y #<cy> (preentry 1)
g0 x #<bx> y #<by> (preentry 2)
/ g41 (cutter radius comp left of path)
g3 x #<ax> y #<ay> i #<vx> j #<vy> (arc entry)
#<xfinal_a> = [#<x6>]
#<yfinal_a> = [#<y6>]
(go along the 4-->3 line to exit)
(angle between 4-->3 and 1-->4)
(only necessary for acute angles)
#<angle> = [180 - #<phi16> + #<phi65>]
#<elen> = [#<r> / ABS[TAN[#<angle>/2]]]
#<k> = [#<elen>/#<len65>]
o<bbb20> if [#<k> GE 1]
(debug, ihex: can't get in corner k=#<k> - EXITING)
(print, ihex: can't get in corner k=#<k> - EXITING)
(AXIS,notify, ihex: can't get in corner - EXITING)
m2
o<bbb20> endif
#<xfinal_b> = [#<x6> + 1.01* #<k> * #<len65> * #<cos65>]
#<yfinal_b> = [#<y6> + 1.01* #<k> * #<len65> * #<sin65>]
g1 z #<zstart> (plunge)
o<bbb10> endif
x #<x6> y #<y6> z#<zcurrent>
x #<x5> y #<y5>
x #<x4> y #<y4>
x #<x3> y #<y3>
x #<x2> y #<y2>
x #<x1> y #<y1>
#<pass> = [#<pass> + 1]
o<dir00> endif
o<wh010> endwhile
g1 x #<xfinal_a> y #<yfinal_a>
g1 x #<xfinal_b> y #<yfinal_b>
g0 z #<zsafe>
g40
o<ihex> endsub

View File

@@ -0,0 +1,179 @@
(inside quadrangle, vertex 1 should be largest)
(computes direction for polygon cw or ccw and swaps indices if required)
(ok for non-pathological 4 sided polygons including convex)
(info: iquad: internal quadrilateral, four x,y points, cw/ccw dir, radius comp)
o<iquad> sub
#<toolno> = #1 (=1)
#<rpm> = #2 (=1)
#<dir> = #3 (=2 2conv|3climb)
#<feedrate> = #4 (=10)
#<cutdepth> = #5 (=.1)
#<zincr> = #6 (=.02)
#<zsafe> = #7 (=0.2)
#<zstart> = #8 (=0)
#<x1> = #9
#<y1> = #10
#<x2> = #11
#<y2> = #12
#<x3> = #13
#<y3> = #14
#<x4> = #15
#<y4> = #16
#<scale> = #17 (=1)
#<rotate> = #18 (=0)
#<xoff> = #19 (=0)
#<yoff> = #20 (=0)
#<spin_notify> = #21 (=0)
#<use_g43> = #22 (=1)
#<h_for_g43> = #23 (=0)
#<verbose> = #24 (=0)
o<i0> if [#<scale> EQ 0]
#<scale> = 1.0
(debug, scale was 0, setting #<scale>)
o<i0> endif
o<loadtool> call [#<toolno>][#<use_g43>][#<h_for_g43>][#<verbose>]
#<tooldiam> = [#5410 + .001]
o<l00> if [[#<dir> NE 2] AND [#<dir> NE 3]]
(debug, iquad: bad direction #<dir> - EXITING)
(print, iquad: bad direction #<dir> - EXITING)
(AXIS,notify, iquad: bad direction - EXITING)
m2
o<l00> endif
(compute direction eg cw,ccw for points as specified:)
o<dir> call [4][#<x1>][#<y1>][#<x2>][#<y2>][#<x3>][#<y3>][#<x4>][#<y4>]
#<pointsdir> = #<_dir:>
o<l20> if [#<pointsdir> NE #<dir>]
(print swap for pointsdir=#<pointsdir> user:#<dir>)
(swap 1234 --> 1432)
#<xt> = #<x2>
#<yt> = #<y2>
#<x2> = #<x4>
#<y2> = #<y4>
#<x4> = #<xt>
#<y4> = #<yt>
o<l20> endif
(apply scale, rotate, then offset to all input points)
o<move> call [#<x1>][#<y1>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x1> = #<_move:x>
#<y1> = #<_move:y>
o<move> call [#<x2>][#<y2>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x2> = #<_move:x>
#<y2> = #<_move:y>
o<move> call [#<x3>][#<y3>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x3> = #<_move:x>
#<y3> = #<_move:y>
o<move> call [#<x4>][#<y4>][#<rotate>][#<scale>][#<xoff>][#<yoff>]
#<x4> = #<_move:x>
#<y4> = #<_move:y>
#<r> = [#<tooldiam>/2]
#<cutdepth> = [0 - #<cutdepth>]
#<zincr> = [0 - #<zincr>]
(get lengths and angles for connecting lines)
o<line> call [#<x1>][#<y1>][#<x2>][#<y2>]
#<cos12> = #<_line:cos>
#<sin12> = #<_line:sin>
o<line> call [#<x2>][#<y2>][#<x3>][#<y3>]
#<cos23> = #<_line:cos>
#<sin23> = #<_line:sin>
(compute angles at line intersections:)
o<dot> call [#<x4>][#<y4>][#<x1>][#<y1>][#<x2>][#<y2>]
#<ang412> = #<_dot:ang>
o<dot> call [#<x1>][#<y1>][#<x2>][#<y2>][#<x3>][#<y3>]
#<ang123> = #<_dot:ang>
g40 (cutter radius compensation off)
f #<feedrate>
s #<rpm> m3 (spindle cw)
o<if1> if [#<spin_notify> GT 0]
o<spin> call [#<rpm>]
o<if1> endif
g0 z#<zsafe>
#<zcurrent> = #<zstart>
#<pass> = 1
o<wh010> while [#<zcurrent> GT #<cutdepth>]
#<zcurrent> = [#<zcurrent> + #<zincr>]
o<wh020> if [#<zcurrent> LT #<cutdepth>]
#<zcurrent> = #<cutdepth>
o<wh020> endif
o<wh030> if [#<pass> GT 100]
(debug, iquad: too many passes - EXITING)
(print, iquad: too many passes - EXITING)
(AXIS,notify, iquad: too many passes - EXITING)
m2
o<wh030> endif
o<pas00> if [#<pass> EQ 1]
(entry point:)
(for acute angle: go along the 1-->2 line to enter)
(at a point where tool will fit)
#<elen12> = [ #<r> / [TAN[#<ang412>/2]]]
#<k12> = [#<elen12> / #<r>]
(print entry 12 k=#<k12> elen12=#<elen12> angle=#<angle>)
#<ax> = [#<x1> + #<elen12> * #<cos12>]
#<ay> = [#<y1> + #<elen12> * #<sin12>]
(compute pre-entry points:)
o<dir00> if [#<dir> EQ 2]
#<bx> = [#<ax> + #<r> * #<sin12> - #<r> * #<cos12>]
#<by> = [#<ay> - #<r> * #<cos12> - #<r> * #<sin12>]
#<cx> = [#<bx> + #<r> * #<cos12>]
#<cy> = [#<by> + #<r> * #<sin12>]
#<vx> = [ #<r> * #<cos12>]
#<vy> = [ #<r> * #<sin12>]
o<dir00> else (dir EQ 3 CCW)
#<bx> = [#<ax> - #<r> * #<sin12> - #<r> * #<cos12>]
#<by> = [#<ay> + #<r> * #<cos12> - #<r> * #<sin12>]
#<cx> = [#<bx> + #<r> * #<cos12>]
#<cy> = [#<by> + #<r> * #<sin12>]
#<vx> = [ #<r> * #<cos12>]
#<vy> = [ #<r> * #<sin12>]
o<dir00> endif
g0 x #<cx> y #<cy> (preentry 1)
g0 x #<bx> y #<by> (preentry 2)
o<dir10> if [#<dir> EQ 2]
/ g42 (cutter radius comp right of path)
g2 x #<ax> y #<ay> i #<vx> j #<vy> (arc entry)
o<dir10> else (dir EQ 3 CCW)
/ g41 (cutter radius comp left of path)
g3 x #<ax> y #<ay> i #<vx> j #<vy> (arc entry)
o<dir10> endif
#<xfinal_a> = #<x2>
#<yfinal_a> = #<y2>
(rampdown finishes at point 2, to exit: need to turn corner at 2)
(and go along the 2-->3 line enough to exit)
#<elen23> = [ #<r> / [TAN[#<ang123>/2]]]
#<k23> = [#<elen23> / #<r>]
(print exit 23 k=#<k23> elen23=#<elen23> angle=#<ang123>)
(need a test here: if you go along 23 too far you gouge vertex 3)
#<xfinal_b> = [#<x2> + #<elen23> * #<cos23>]
#<yfinal_b> = [#<y2> + #<elen23> * #<sin23>]
g1 z #<zstart> (plunge to start height todo:g0)
o<pas00> endif
x #<x2> y #<y2> z#<zcurrent> (ramp down to zcurrent)
x #<x3> y #<y3>
x #<x4> y #<y4>
x #<x1> y #<y1>
#<pass> = [#<pass> + 1]
o<wh010> endwhile
(print a= #<xfinal_a> #<yfinal_a> k=#<k23>)
(print b= #<xfinal_b> #<yfinal_b>)
g1 x #<xfinal_a> y #<yfinal_a>
g1 x #<xfinal_b> y #<yfinal_b>
g0 z #<zsafe>
g40
o<iquad> endsub

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -0,0 +1,119 @@
(info: G76 Threading, Specify driveline and offset, use NEGATIVE offset I for External Thread)
; default values:
; external thread example: xi=0.5,k=0.05,i=-0.03
; for majordiam=0.94,minordiam=0.84,i=-0.03
; internal thread example: xi=0.39,k=0.05,i=+0.03
; for majordiam=0.94,minordiam=0.84,i=+0.03
o<g76base> sub
#<toolno> = #1 (= 10)
#<rpm> = #2 (= 200 Spindle RPM)
#<xi> = #3 (= 0.5 X: Xi driveline)
#<zi> = #4 (= -0.5 Z: Zi driveline)
; G76 required items:
#<p> = #5 (= 0.125 P: Pitch, NEG for tpi)
#<z> = #6 (= -1.0 Z: Zf final)
#<i> = #7 (= -0.03 I: Thread peak offset)
#<k> = #8 (= 0.05 K: Full thread depth)
#<j> = #9 (= 0.015 J: Initial cut depth)
; G76 optional items:
#<r> = #10 (= 1.0 R: Depth degression)
#<q> = #11 (= 29.5 Q: Compound slide angle)
#<h> = #12 (= 0 H: No. of spring passes)
#<e> = #13 (= 0.050 E: Taper dist =K typ)
#<l> = #14 (= 2 L: End Taper 0,1,2,3)
; other:
#<spindir> = #15 (=3 Dir: Right=3 Left=4)
#<mode> = #16 (=8 G7/G8 Radius=8 Diam=7)
#<verbose> = #17 (=0 0:silent, 1:verbose)
o<if00> if [#<p> LT 0]
#<p> = ABS[1 / #<p>]
(debug, g76base: Computed pitch = #<p> from tpi)
o<if00> endif
o<if10> if [ [#<l> NE 0] AND [#<l> NE 1] AND [#<l> NE 2] AND [#<l> NE 3] ]
(print, q76base: Require: L = 0 or 1 or 2 or 3 - EXITING)
(debug, q76base: Require: L = 0 or 1 or 2 or 3 - EXITING)
(AXIS,notify, q76base: Require: L = 0 or 1 or 2 or 3 - EXITING)
m2
o<if10> endif
o<if11> if [ [#<spindir> NE 3] AND [#<spindir> NE 4]]
(print, q76base: Dir: 3 for RH 4 for LH - EXITING)
(debug, q76base: Dir: 3 for RH 4 for LH - EXITING)
(AXIS,notify, q76base: Dir: 3 for RH 4 for LH - EXITING)
m2
o<if11> endif
o<if12> if [ [#<mode> NE 7] AND [#<mode> NE 8] ]
(print, q76base: Mode: 7 for D 8 for R - EXITING)
(debug, q76base: Mode: 7 for D 8 for R - EXITING)
(AXIS,notify, q76base: Mode: 7 for D 8 for R - EXITING)
m2
o<if12> endif
o<if20> if [#<_vmajor> lT 2.6]
; no introspection on lathe radius/diameter mode
; so allow only G8 (radius mode)
o<if21> if [#<mode> NE 8]
(print, g76base: v2.5 requires G8 - EXITING)
(debug, g76base: v2.5 requires G8 - EXITING)
(AXIS,notify, g76base: v2.5 requires G8 - EXITING)
m2
o<if21> endif
o<if20> else
; >= 2.6
; use introspection on lathe radius/diameter mode
; to restore mode
o<if22> if [#<_lathe_diameter_mode> EQ 1]
#<restore_mode> = 7 ; diam
o<if22> endif
o<if23> if [#<_lathe_radius_mode> EQ 1]
#<restore_mode> = 8 ; radius
o<if23> endif
o<if24> if [ [#<_lathe_diameter_mode> EQ 0] AND [ #<_lathe_radius_mode> EQ 0] ]
; not supposed to happen:
(print, g76base: unexpected lathe mode - EXITING)
(debug, g76base: unexpected lathe mode - EXITING)
(AXIS,notify, g76base: unexpected lathe mode - EXITING)
m2
o<if24> endif
o<if25> if [ [#<_lathe_diameter_mode> EQ 1] AND [ #<_lathe_radius_mode> EQ 1] ]
; not supposed to happen:
(print, g76base: unexpected lathe mode - EXITING)
(debug, g76base: unexpected lathe mode - EXITING)
(AXIS,notify, g76base: unexpected lathe mode - EXITING)
m2
o<if25> endif
o<if20> endif
G#<mode>
o<if60> if [#<verbose> GT 0]
o<if70> if [#<mode> EQ 7]
(debug, g76base: set G7 DIAMETER mode)
o<if70> else
(debug, g76base: set G8 RADIUS mode)
o<if70> endif
o<if60> endif
o<loadtool> call [#<toolno>]
M#<spindir> S#<rpm>
G0 X#<xi> Z#<zi>
G76 P#<p> Z#<z> I#<i> J#<j> R#<r> K#<k> Q#<q> H#<h> E#<e> L#<l>
o<if80> if [[#<_vmajor> GE 2.6] AND [#<verbose> GT 0]]
(debug, g76base restoring mode to G #<restore_mode>)
o<if80> endif
o<g76base> endsub

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -0,0 +1,69 @@
(info: G76 Threading, Specify Major, Minor diameters, use NEGATIVE offset I for External Thread)
; convenience routine that allows specifying major and
; minor diameters for using G76
; Note: To make the number of passes equal for G7 (diam) and G8 (radius) modes,
; jeq = j_for_G7 = 2 * j_for_G8
o<g76diam> sub
#<toolno> = #1 (= 10)
#<rpm> = #2 (= 200 Spindle RPM)
#<i> = #3 (= -0.03 I: offset NEG:external)
#<zi> = #4 (= -0.5 Z: Zi driveline)
; required items:
#<p> = #5 (= -8 P: Pitch, NEG for tpi)
#<z> = #6 (= -1.0 Z: Zf final)
#<majordiameter> = #7 (= 0.94)
#<minordiameter> = #8 (= 0.84)
#<j> = #9 (= 0.015 Initial RADIAL cut depth)
; G76 optional items:
#<r> = #10 (= 1.0 R: Depth degression)
#<q> = #11 (= 29.5 Q: Compound slide angle)
#<h> = #12 (= 0 H: No. of spring passes)
#<e> = #13 (= 0.05 E: Taper dist =K typ)
#<l> = #14 (= 2 L: End Taper 0,1,2,3)
; other:
#<spindir> = #15 (=3 Dir: Right=3 Left=4)
#<mode> = #16 (=8 G7/G8 Radius=8 Diam=7)
#<verbose> = #17 (=0 0:quiet,1:verbose)
o<if1> if [#<majordiameter> LE #<minordiameter>]
(print, g76diam: major <= minor ? - EXITING)
(debug, g76diam: major <= minor ? - EXITING)
(AXIS,notify, g76diam: major <= minor ? - EXITING)
m2
o<if1> endif
#<jeq> = #<j> ; as-is for radius mode
o<if7> if [#<mode> EQ 8] ; RADIUS
#<k> = [ABS[#<majordiameter> - #<minordiameter>]/2]
o<if8> if [#<i> LE 0] ; EXTERNAL
#<xi> = [#<majordiameter>/2 - #<i>]
o<if8> else ; INTERNAL
#<xi> = [#<minordiameter>/2 - #<i>]
o<if8> endif
o<if7> else ; DIAMETER
#<k> = [ABS[#<majordiameter> - #<minordiameter>]]
#<jeq> = [2 * #<j>] ;workaround g76 behavior in diam mode
o<if9> if [#<i> LE 0] ; EXTERNAL
#<xi> = [#<majordiameter> - #<i>]
o<if9> else ; INTERNAL
#<xi> = [#<minordiameter> - #<i>]
o<if9> endif
o<if7> endif
o<i10> if [#<verbose> GT 0]
(debug, g76diam: driveline xi=#<xi> i=#<i>)
(debug, g76diam: k=#<k> j=#<j>)
o<i10> endif
o<g76base> call [#<toolno>][#<rpm>][#<xi>][#<zi>][#<p>][#<z>][#<i>][#<k>][#<jeq>][#<r>][#<q>][#<h>][#<e>][#<l>][#<spindir>][#<mode>][#<verbose>]
o<g76diam> endsub

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@@ -0,0 +1,56 @@
; Author: jthornton
(info: inside diameter -- lathe boring)
o<id>sub
#<Hole_Dia> = #1 (=0.500 Starting Hole Diameter)
#<Final_Dia> = #2 (=0.625 Final Hole Diameter)
#<Depth_Cut> = #3 (=0.010 Depth of Cut)
#<Spring_Cuts> = #4 (=0 Spring Cuts)
#<Z_StartOfCut> = #5 (=0.100 Z Start of Cut)
#<Z_EndOfCut> = #6 (=-0.600 Z End of Cut)
#<SurfaceSpeed> = #7 (=80 Surface Speed)
#<FeedRate> = #8 (=2 Feed IPM)
#<MaxSpindle_RPM> = #9 (=1500 MAX RPM)
#<ToolNumber> = #10 (=8 Tool Number)
#<Coolant> = #11 (=8 Coolant 8=On 9=Off)
T#<ToolNumber> M6
; G43: toollength offset
; G7: diameter mode
; G96: constant surface speed
G43 G7 G96 D#<MaxSpindle_RPM> S#<SurfaceSpeed>
; Turn the OD
M3 M#<Coolant> ; spindle cw, coolant on/off:w
G0 X#<Hole_Dia> Z#<Z_StartOfCut>
#<Current-Diameter> = #<Hole_Dia>
o100 while [#<Current-Diameter> lt #<Final_Dia>]
O101 if [#<Current-Diameter> + #<Depth_Cut> lt #<Final_Dia>]
#<Current-Diameter> = [#<Current-Diameter> + #<Depth_Cut>]
O101 else
#<Current-Diameter> = #<Final_Dia>
O101 endif
X#<Current-Diameter>
G1 Z#<Z_EndOfCut> F#<FeedRate>
G0 X[#<Current-Diameter>-0.010]
Z#<Z_StartOfCut>
o100 endwhile
o102 while [#<Spring_Cuts> gt 0]
G1 X#<Final_Dia>
Z#<Z_EndOfCut>
X[#<Final_Dia>-0.010]
G0 Z#<Z_StartOfCut>
#<Spring_Cuts> = [#<Spring_Cuts> -1]
o102 endwhile
G0 X[#<Current-Diameter>-0.010]
M5 M9 ; stop spindle, all coolant off
Z#<Z_StartOfCut>
G49 ; cancel tool length offset
G53 G0 X0 Z0 ; move in machine coordinates
o<id>endsub

View File

@@ -0,0 +1,12 @@
(not_a_subfile)
g18 (xz plane)
g20 (inches)
g40 (cancel cutter radius compensation)
g49 (cancel tool lengthoffset)
g90 (absolute distance mode)
g94 (units/min feedrate)
g54 (Coordinate system 1 default)
#<tol> = 0.001
g64 p#<tol> (path control stop)

View File

@@ -0,0 +1,48 @@
; Author: jthornton
(info: outside diameter - lathe turning)
o<od> sub
#<Material_Dia> = #1 (=0.260 Material Diameter)
#<Final_Dia> = #2 (=0.180 Final Diameter)
#<Depth_Cut> = #3 (=0.010 Depth of Cut)
#<Final_Cut> = #4 (=0.000 Final Cut)
#<SurfaceSpeed> = #5 (=100 Surface Speed)
#<FeedRate> = #6 (=2 Feed Rate)
#<Max_RPM> = #7 (=1500 Max Spindle RPM)
#<Z_EndOfCut> = #8 (=-0.5 End of Cut)
#<Z_StartOfCut> = #9 (=0.100 Start of Cut)
#<RToolNumber> = #10 (=6 Roughing Tool)
#<FToolNumber> = #11 (=6 Finishing Tool)
#<Coolant> = #12 (=8 Flood=8, Off=9)
T#<RToolNumber> M6
; G43: toolength offset
; G7: diameter mode
; G96: constant surface speed
G43 G7 G96 D#<Max_RPM> S#<SurfaceSpeed>
; Turn the OD
M3 M#<Coolant> ; spindle cw, coolant on/off
G0 X#<Material_Dia> Z#<Z_StartOfCut>
#<Current_Dia>=#<Material_Dia>
o100 while [#<Current_Dia> gt #<Final_Dia>]
O101 if [#<Current_Dia>-#<Depth_Cut> gt #<Final_Dia>]
#<Current_Dia>=[#<Current_Dia>-#<Depth_Cut>]
O101 else
#<Current_Dia>=#<Final_Dia>
O101 endif
X#<Current_Dia>
G1 Z#<Z_EndOfCut> F#<FeedRate>
G0 X[#<Current_Dia>+0.025]
Z#<Z_StartOfCut>
o100 endwhile
G0 X[#<Current_Dia>+0.025]
M5 M9 ; stop spindle, all coolant off
Z#<Z_StartOfCut>
G49 ; cancel tool length offset compensation
G53 G0 X0 Z0 ; move in machine coordinates
o<od> endsub

Some files were not shown because too many files have changed in this diff Show More