# Posts Tagged CNC

### Monthly Image: Digital Machinist 14.4 Cover

Posted by Ed in Machine Shop, Photography & Images on 2020-01-15

I ain’t getting richer, but I did get mah pitcher onna cover of th’ Digital Machinist:

I just caught George Bulliss in a weak moment. [grin]

It’s the diamond drag holder on the CNC 3018-Pro, before the XL axis extension hackage., with the probe camera stuck to the left side.

You can say you knew me before …

### Drag Knife Cuttery: Entry & Exit Moves

Posted by Ed in Machine Shop, Software on 2019-12-30

The first pass at cutting laminated decks for the Homage Tektronix Circuit Computer left little uncut snippets at the starting point of the cut. The point of the drag knife blade trundles along behind the cutting edge and, when the ending point equals the starting point, leaves an un-cut sliver as it’s retracted vertically:

The knife blade isn’t aligned in any particular direction, so it can leave a nick on either side as it enters the deck vertically at the start of the cut.

Gradually entering the deck along the cut line gives the blade enough time to swivel around to the proper alignment before it gets down to serious cutting. Continuing the final cut past the starting point then allows the blade to recut anything remaining from the entry move.

The middle and top decks have windows exposing the scales:

The paths are basically two arcs connected by semicircular cuts, but with ramps on each end recutting the entry and exit paths:

The entry path in the upper left slants downward from the `TravelZ`

level of 1.5 (-ish) mm to Z=0, with the nose of the blade holder flush against the surface and the blade sunk to its full length. The vertical path to Z=-2 (-ish) increases the cutting pressure from roughly the preload value to preload + 2*(spring rate), so the blade won’t ride up under the cutting forces.

The path then goes completely around the window at Z=-2, then ramps up to the `TravelZ`

level again.

All of which produces a neat cutout that sticks to the Cricut mat when I peel the rest of the deck off:

That’s a middle deck before I started laminating them, but you get the general idea.

The GCMC code (extracted from the complete lump) looks like this:

```
local WindowArc = 54deg;
local ac = -17 * ScaleArc + ScaleRT/2; // center of window arc
local r0 = DeckRad - ScaleHeight; // outer
local r1 = DeckRad - 2 * ScaleHeight; // inner
local aw = WindowArc - to_deg(atan(ScaleHeight,(r0 + r1)/2)); // window arc minus endcaps
p0 = r0 * [cos(ac + aw/2),sin(ac + aw/2),-];
p1 = r0 * [cos(ac - aw/2),sin(ac - aw/2),-];
local p2 = r1 * [cos(ac - aw/2),sin(ac - aw/2),-];
local p3 = r1 * [cos(ac + aw/2),sin(ac + aw/2),-];
goto(p3);
arc_cw(p0 +| [-,-,0],ScaleHeight/2); // blade enters surface
move([-,-,KnifeZ]); // apply pressure
arc_cw(p1,r0); // smallest arc
arc_cw(p2,ScaleHeight/2); // half a circle
arc_ccw(p3,r1);
arc_cw(p0,ScaleHeight/2);
arc_cw(p1 +| [-,-,TravelZ],r0); // exit from cut
goto([0,0,-]);
goto([-,-,SafeZ]);
```

Having measured the angular position of the window and its size on the original Tek CC, I compute the coordinates of the four points where the semicircular “end caps” meet the longer arcs, then connect the dots with arc_xx() functions to generate the G-Code commands. As always, using the proper radius signs requires trial & error.

While I was at it, I added entry & exit moves for the deck’s central pivot hole and outer perimeter.

I’m pretty sure the right CAM package would take care of that, but GCMC operates well below the CAM level.

### Homage Tektronix Circuit Computer: Pen Plotter Version

Posted by Ed in Electronics Workbench, Machine Shop, Software on 2019-12-23

A reproduction circular slide rule from the mid-1960s may not be the cutting edge of consumer demand, but the pen version of a Tektronix Circuit Computer came out pretty well:

A Bash script compiles the GCMC code with eight different parameter combinations to produce pairs of G-Code files to draw (“engrave” being aspirational) and cut (“mill”, likewise) the three decks and the cursor.

The CNC 3018XL with a Pilot V5RT pen draws the deck scales on white paper:

Better paper definitely produces better results, so I must rummage through the Big Box o’ Paper to see what lies within. Laminating the decks improves their durability and matches the original Tek surface finish.

The MPCNC with a drag knife blade cuts through a laminated deck like butter:

Setting the XY origin to dead center on each deck requires carefully calibrating the USB video camera, with the end result accurate to maybe ±0.1 mm around the entire perimeter. Both machines move equal linear distances along both axes, which was definitely comforting.

Having made half a dozen cursors from various bits of acrylic, none of which look particularly good, demonstrates my engraving hand is too weak for a complete slide rule:

With logarithmic scales in hand, however, adapting the GCMC source code to produce general-purpose circular slide rules with only two decks and smaller diameters may be the way to improve my engraving-fu, as a full-scale Tektronix Circuit Computer would chew up three square-foot plastic sheets.

A general-purpose slide rule would need multi-color (well, at least bi-color) labels and digits for red “inverse” scales to remind you (well, me) they read backwards. Some slipsticks use left-slanting italics, left-pointing markers (“<2”), or other weirdness, but they’re all *different*.

An early small-scale version engraved on ABS came out OK, modulo poor ink fill:

Engraving the decks on hard drive platters doesn’t count:

All in all, it’s been an interesting exercise and, as you may have guessed, will become a Digital Machinist column.

The GCMC and Bash source code as a GitHub Gist:

### Tek Circuit Computer: Drag Knife Deck Cutting

Posted by Ed in Machine Shop, Software on 2019-12-09

Creating a paper version of the Tektronix Circuit Computer requires nothing more than a drag knife to cut the deck outlines:

The middle deck is a disk with a notch exposing the FL scale, a cutout window exposing the inductive time constant / risetime scale, and a wee circle for the Chicago screw in the middle:

Three angles define the notch:

```
FLNotchArc = 85deg; // width exposing FL scale
FLRampArc = 7deg; // … width of entry & exit ramps
FLNotchOffset = 2deg; // … start angle from 0°
```

Given those, along with the deck radius and notch height (equals the underlying scale height), calculate four points defining the start and end of the ramps and connect the dots:

```
local a0 = FLNotchOffset;
local p0 = DeckRad * [cos(a0),sin(a0),-];
local a1 = a0 + FLNotchArc;
local p1 = DeckRad * [cos(a1),sin(a1),-];
goto(p0);
move([-,-,KnifeZ]);
arc_cw(p1,-DeckRad); // largest arc
local r = DeckRad - ScaleHeight;
local a3 = a1 - FLRampArc;
local p3 = r * [cos(a3),sin(a3),-];
local a4 = a0 + FLRampArc;
local p4 = r * [cos(a4),sin(a4),-];
move(p3);
arc_cw(p4,r); // smallest arc
move(p0); // end of notch
arc_cw([DeckRad,0,-],DeckRad); // round off corner
```

The `arc_cw()`

functions draw arcs, as you’d expect, with a positive radius tracing the shortest arc and a negative radius for the longest arc. Although I know how that works, I must still preview the result to verify the G-Code does what I want, not what I said.

The unhappy result of a wrong sign:

GCMC uses the (signed) radius to generate the XY coordinates and IJ offsets for `G2`

commands in the preferred center format:

```
G0 X88.846 Y3.103
G1 Z-2.000
G2 X4.653 Y88.778 I-88.846 J-3.103
```

Cutting the window starts from its angular width and offset, which are hardcoded magic numbers from the Tek artifact, and proceeds similarly:

```
local WindowArc = 39deg;
local ac = -6 * ScaleArc; // center of window arc
local r0 = DeckRad - ScaleHeight; // outer
local r1 = DeckRad - 2 * ScaleHeight; // inner
local aw = WindowArc - to_deg(atan(ScaleHeight,(r0 + r1)/2)); // window arc minus endcaps
local p0 = r0 * [cos(ac + aw/2),sin(ac + aw/2),-];
local p1 = r0 * [cos(ac - aw/2),sin(ac - aw/2),-];
local p2 = r1 * [cos(ac - aw/2),sin(ac - aw/2),-];
local p3 = r1 * [cos(ac + aw/2),sin(ac + aw/2),-];
goto(p0);
move([-,-,KnifeZ]);
arc_cw(p1,r0); // smallest arc
arc_cw(p2,ScaleHeight/2); // half a circle
arc_ccw(p3,r1);
arc_cw(p0,ScaleHeight/2);
```

Trust me on this: incorrect radius signs generate unrecognizable outlines. Which, of course, is why you preview the G-Code before actually cutting anything:

A similar hunk of code cuts the top deck; the bottom deck is a simple circle.

The workflow, such as it is:

- Tape a sheet of paper (Index stock, Basis 110 = 10 mil = 0.25 mm) at the center of the 3018-ProXL platform
- Plot (“engrave”) the scales with a pen
- Affix paper to a Cricut sticky mat taped to the MPCNC platform
- Touch off the origin at the middle
- Drag-cut (“mill”) the outlines

Less complex than it may appear, but the GCMC file now spits out two G-Code files per deck: one to engrave / draw the scales on the 3018 and another to mill / cut the outlines on the MPCNC.

### Tek Circuit Computer: Acrylic Cursor Hairline

Posted by Ed in Machine Shop, Software on 2019-12-05

A slide rule needs a cursor with a hairline to align numbers on its scales:

The GCMC code generating the hairline is basically a move scratching one line into the surface with the diamond bit:

```
feedrate(ScaleSpeed);
goto([-,-,TravelZ]);
repeat(2) {
goto([DeckTopOD/2 - 3*ScaleHeight,0,-]);
move([-,-,EngraveZ]);
move([DeckBottomOD/2 + ScaleHeight,0,-]);
goto([-,-,TravelZ]);
}
```

Two passes make the scratch deep enough to hold engraving crayon / lacquer / ink, without making it much wider. Laser engraving would surely work better.

In lieu of actually milling the cursor, this code scratches the perimeter:

```
local dr = DeckBottomOD/2;
local hr = CursorHubOD/2;
local a = atan(hr - CursorTipWidth/2,dr); // rough & ready approximation
local p0 = hr * [sin(a),cos(a),-]; // upper tangent point on hub
local c1 = [dr - CursorTipRadius,CursorTipWidth/2 - CursorTipRadius*cos(a),-];
local p1 = c1 + [CursorTipRadius*sin(a),CursorTipRadius*cos(a),-];
local p2 = c1 + [CursorTipRadius,0,-]; // around tip radius
feedrate(KnifeSpeed);
goto([-,-,TravelZ]);
goto([-hr,0,-]);
move([-,-,EngraveZ]);
repeat(3) {
arc_cw(p0,hr);
move(p1);
arc_cw(p2,CursorTipRadius);
move([p2.x,-p2.y,-]);
arc_cw([p1.x,-p1.y,-],CursorTipRadius);
move([p0.x,-p0.y,-]);
arc_cw([-hr,0,-],hr);
}
```

Three passes makes it deep enough to snap along the line:

If you look closely, though, you’ll find a little divot over on the left along the bottom edge, so I really must machine the thing.

Were I to go into production, I’d have to figure out a fixture, but I think I can just clamp a rough-cut acrylic rectangle to the Sherline’s table, mill half the perimeter, re-clamp without moving anything, then mill the other half.

Subtractive machining is such a bother!

The pivot holding the cursor and decks together is a “Chicago screw“, a.k.a. a “sex bolt“. I am *not* making this up.

### GCMC: Circular Slide Rule Scales

Posted by Ed in Machine Shop, Software on 2019-12-02

The Tektronix Circuit Computer, being a specialized circular slide rule, requires logarithmic scales bent around arcs:

Each decade spans 18°, except for the F_{L} scale’s 36° span to extract the square root of the LC product:

`FL = 1 / (2π · sqrt(LC))`

The tick marks can point inward or outward from their baseline radius, with corresponding scale labels reading either inward or outward.

There being no (easy) way to algorithmically set the tick lengths, I used a (pair of) tables (a.k.a. vector lists):

```
TickScaleNarrow = {
[1.0,TickMajor],
[1.1,TickMinor],[1.2,TickMinor],[1.3,TickMinor],[1.4,TickMinor],
[1.5,TickMid],
[1.6,TickMinor],[1.7,TickMinor],[1.8,TickMinor],[1.9,TickMinor],
[2.0,TickMajor],
[2.2,TickMinor],[2.4,TickMinor],[2.6,TickMinor],[2.8,TickMinor],
[3.0,TickMajor],
… and so on …
```

The first number in each vector is the tick value in the decade, the log of which corresponds to its angular position. The second gives its length, with three constants matching up to the actual lengths on the Tek scales.

The Circuit Computer labels only three ticks within each decade in the familiar (to EE bears, anyhow) 1, 2, 5 sequence. Their logs are 0.0, 0.3, and 0.7, spacing them neatly at the 1/3 decade points.

Pop quiz: If you wanted to label *two* evenly spaced ticks per decade, you’d mark 1 and …

Generating the L (inductance) scale on the bottom deck goes like this:

```
Radius = DeckRad - ScaleSpace;
MinLog = -9;
MaxLog = 6;
Arc = -ScaleArc;
dec = 1;
offset = 0deg;
for (logval = MinLog; logval < MaxLog; logval++) {
a = offset + logval * Arc;
DrawTicks(Radius,TickScaleNarrow,OUTWARD,a,Arc,dec,INWARD,FALSE);
dec = (dec == 100) ? 1 : 10 * dec;
}
a = offset + MaxLog * Arc;
DrawTicks(Radius,TickScaleNarrow,OUTWARD,a,Arc,100,INWARD,TRUE);
```

The L scale covers 1 nH to 1 MH (!), as set by the `MinLog`

and `MaxLog`

values. `Arc`

sets the angular size of each decade from `ScaleArc`

, with the negative sign indicating the values increase in the clockwise direction.

The first decade starts with a tick labeled 1, so `dec`

= 1. The next decade has `dec`

= 10 and the third has `dec`

= 100. Maybe I should have used the log values 0, 1, and 2, but that seemed too intricate.

The angular `offset`

is zero because this is the outermost scale, so 1.0 H will be at 0° (the picture is rotated about half a turns, so you’ll find it off to the left). All other scales on the deck have a nonzero offset to put their unit tick at the proper angle with respect to this one.

The scales have legends for each group of three decades, positioned in the middle of the group:

```
logval = MinLog + 1.5;
a = offset + logval * Arc;
ArcLegend("nH - nanohenry x10^-9",r,a,INWARD);
logval += 3;
a = offset + logval * Arc;
ArcLegend("μH - microhenry x10^-6",r,a,INWARD);
```

I wish there were a clean way to draw exponents, as the GCMC Hershey font does not include superscripts, but the characters already live at the small end of what’s do-able with a ballpoint pen cartridge. Engraving will surely work better, but stylin’ exponents are definitely in the nature of fine tuning.

With all that in hand, the scales look just like they should:

The GCMC source code as a GitHub Gist:

### GCMC Radial Text

Posted by Ed in Machine Shop, Software on 2019-11-29

The Tektronix Circuit Computer needs text along radial lines:

Fortunately, this doesn’t require nearly as much effort as the text-on-arcs code, because GCMC includes functions to rotate paths around the origin:

`return rotate_xy(TextPath,Angle) + CenterPt;`

The only trick is figuring out how to handle the justification, given the overall path length:

```
local pl = TextPath[-1].x;
local ji = (Justify == TEXT_LEFT) ? 0mm :
(Justify == TEXT_CENTERED) ? -pl/2 :
(Justify == TEXT_RIGHT) ? -pl :
0mm;
```

A testcase showed it worked:

With that in hand, I took the liberty of slightly simplifying the original Tek layout:

If lives depended on it, one could duplicate the Tek layout, but they don’t and I didn’t. Fancy typography isn’t a GCMC thing.

And, yeah, laser printing is *way* crisper than a pen drawing.

The GCMC source code as a GitHub Gist:

## Blowback