feedrapidcutter width
The idea
Like APT, you describe the part with geometry, then steer the cutter along a line or circle until it reaches another one. Swarf works out the cutter offset, the corners and the arcs. Units are millimetres, angles are degrees.
Geometry
| (x, y) · (x, y, z) | A point. Points can be added and scaled: p + (5, 0), p.x. |
| xaxis · yaxis · origin | Built-in lines and the origin. |
| line(p1, p2) | Through two points. line(through: p, angle: 30) for a direction. |
| hline(y) · vline(x) | Horizontal and vertical lines. |
| parallel(l, 5, north) | Offset copy of a line. Sides: east west north south. parallel(l, p) passes through p. |
| perp(l, p) | Square to l, through p. |
| circle(center, r) | Also circle(c, p) through a point, circle(c, l) touching a line, circle(p1, p2, p3). |
| tangent(p, c, left) | From a point, touching c; left or right as seen from p. |
| tangent(c1, c2, left, right) | Touching two circles, sides as seen from c1 toward c2. |
| tangent(c, 30, north) | Touching c at 30°, on the north side. |
| fillet(l1, l2, 8, toward: p) | Radius-8 circle in the corner of l1 and l2 that holds p. |
| intersect(a, b, east) | Crossing point; add a side when there are two. |
| on(c, 45) · polar(r, a) · center(c) | Point on a circle, polar point, centre. |
Cutting
| tool 6 · feed 300 · spindle 1200 | Cutter diameter, feed in mm/min, spindle rpm (spindle off, ccw). coolant on. |
| from (x, y, z) | Where the cutter starts. |
| move p · rapid p · move by (dx, dy, dz) | Straight moves; rapid is G00. |
| up 5 · down 2 | Along the tool axis. |
| approach to l1 floor -3 | Put the cutter against l1 (to, on or past it) with its tip on the floor. approach to l1 and to l2 floor 0 goes to the corner. |
| right along l1 past l2 | Turn left, right, go ahead or back along l1 until to, past, on or tangent l2. Lines and circles both work. |
The cutter stays on the side of the line or circle it is already on. TO and PAST are judged in the direction of travel.
Programming
| r = 5 · let r = 5 | Variables. Inside a function they are local. |
| for i in 1..10 step 2 { } | Loops include the end value. repeat 4 { }. |
| if a > 3 and b { } else { } | Comparisons, and, or, not. |
| def hole(x, y, d = 6) { } | Functions with defaults; return a value if you like. |
| sin cos tan asin acos atan atan2 | In degrees. Also sqrt abs min max floor ceil round hypot dist, and ^ for powers. |
| print "r =", r · # comment | Print to the Console tab. Comments start with # or //. |
Swarf is a spiritual successor to YU APT 98 (Mašinska škola Pančevo, 1991–1998) and its parent PERSONAL APT. The examples are ports of programs from that disk.