Archive for category Software

CNC 3018-Pro: Collet Pen Holder

Along the same lines as the MPCNC pen holder, I now have one for the 3018:

CNC3018 - Collet pen holder - assembled
CNC3018 – Collet pen holder – assembled

The body happened to be slightly longer than two LM12UU linear bearings stacked end-to-end, which I didn’t realize must be a constraint until I was pressing them into place:

CNC 3018-Pro Collet Holder - LM12UU - solid model
CNC 3018-Pro Collet Holder – LM12UU – solid model

In the unlikely event I need another one, the code will sprout a max() function in the appropriate spot.

Drilling the aluminum rod for the knurled ring produced a really nice chip:

CNC3018 - Collet pen holder - drilling knurled ring
CNC3018 – Collet pen holder – drilling knurled ring

Yeah, a good drill will produce two chips, but I’ll take what I can get.

There’s not much left of the original holder after turning it down to 8 mm so it fits inside the 12 mm rod:

CNC3018 - Collet pen holder - turning collet OD
CNC3018 – Collet pen holder – turning collet OD

Confronted by so much shiny aluminum, I realized I didn’t need an 8 mm hole through the rod, so I cut off the collet shaft and drilled out the back end to clear the flanges on the ink tubes:

CNC3018 - Collet pen holder - drilling out collet
CNC3018 – Collet pen holder – drilling out collet

I figured things would eventually go badly if I trimmed enough ink-filled crimps:

Collet holder - pen cartridge locating flanges
Collet holder – pen cartridge locating flanges

The OpenSCAD source code as a GitHub Gist:

, ,

Leave a comment

ID3 Tagging From File Names

The Forester can play MP3 files from a USB flash drive and, given the utter craptitude of radio stations around here, I dumped a bunch of CD tracks onto a drive. For historic reasons, very few of the tracks had ID3 tags, so the Forester’s display showed only gnarly file names for the last few years.

This burst of Bash line noise runs through the directory of album directories, extracts the relevant information from the directory and track names, then pops the tags in place:

for d in * ; do for f in $(ls $d) ; do art=$(echo $d | cut -d- -f1 | tr '_' ' ' | sed 's/-/ - /g') ; alb=$(echo $d | cut --complement -d- -f1 | tr '_' ' ' | sed 's/-/ - /g') ; t=$(echo $f | cut -d- -f1) ; s=$(echo ${f%.*} | cut --complement -d- -f1 | tr '_' ' ' | sed 's/-/ - /g') ; id3tag -2 -a"$art" -A"$alb" -s"$s" -t$t $d/$f ; done ; done

It’s (marginally) easier to see this way:

for d in * ; do 
 for f in $(ls $d) ; do 
  art=$(echo $d | cut -d- -f1 | tr '_' ' ' | sed 's/-/ - /g')
  alb=$(echo $d | cut --complement -d- -f1 | tr '_' ' ' | sed 's/-/ - /g')
  t=$(echo $f | cut -d- -f1)
  s=$(echo ${f%.*} | cut --complement -d- -f1 | tr '_' ' ' | sed 's/-/ - /g')
  id3tag -2 -a"$art" -A"$alb" -s"$s" -t$t $d/$f
 done
done

What’s going on:

  • cut – extracts track number and song title
  • tr – convert underscores to spaces
  • sed – put spaces around hyphens

The id3tag program can install either ID3V1 or ID3V2 tags on each pass, so I just recalled the command, edited the -1 to -2, and ran the whole mess again.

After a bit of manual cleanup, things looked pretty good.

Although the id3ren program seemed as though it could do the trick, it’s really intended to rename files from existing tags. Making it go the other way rapidly became a steel-cage death match; I gave up.

2 Comments

Manjaro Linux VNC Setup

I installed the XFCE flavor of Manjaro Linux (beside Win 8.1 Pro) on a new-to-me Dell Latitude 7250 serving as our new Token Windows box and carry-along-able Linux laptop.

Manjaro being an offshoot of Arch, they have plenty of guides and references, with How to Set up X11VNC Server being most useful at the moment. This box needs only a VNC server and apparently works with ‑xdamage for faster updates.

With the laptop plugged into an external display and Manjaro set up to use both displays, the X11VNC server feeds both to the client with the proper positioning, producing a truly panoramic, albeit scaled, view:

WinFlip - X11VNC dual screen
WinFlip – X11VNC dual screen

TightVNC on Windows does much the same thing, although (AFAICT) Windows doesn’t allow different background pictures on the two screens; that’s irrelevant to my mmmm use case.

Leave a comment

MPCNC: Z-Axis Probed Height Map to Solid Model

I set up an orthotic shoe insert on the MPCNC and unleashed the Z-Axis height probe on it:

Orthotic - bottom probing
Orthotic – bottom probing

In principle, the grid keeps the object aligned with the machine axes and the blocks put the upper surface more-or-less parallel with the platform. The XY origin, at the G28 location I’ve been using for tool changes, is on the midline of the sole, with Z touched off by probing the platform beside the sole.

The only interesting part of the orthotic is the rigid white plastic plate, which extends about 20 mm into a pocket in the black foam, so the probe area excludes the bendy part.

I’m abusing the bCNC Auto-level probe routine to get the height map, because it produces a tidy file of XYZ coordinates with three header lines describing the overall probe area:

-50 140 39
-50 50 21
-2 35 500

-50 -50 0.11
-45 -50 0.06
-40 -50 0.005

The first two lines give the X and Y coordinate ranges and number of samples. The third line is the Z axis range and probe speed (?). After that, it’s just probed XYZ coordinates, all the way down.

Meshlab can import ASC files consisting of XYZ coordinates, with the ability to skip a specific number of header lines:

Meshlab ASC file import - header lines
Meshlab ASC file import – header lines

If you don’t skip those three lines, then you get three additional points, far off in XYZ space, that will confuse the next step.

Checking the Grid Triangulation box (the default) produces a nicely lofted sheet:

Orthotic - R bottom triangulated
Orthotic – R bottom triangulated

It is, however, a single-sided sheet, not a manifold 3D object. After a few days of screwing around, I’m unable to find any (automatic, reliable, non-manual) way to solidify the thing in Meshlab, so just save it as a PLY file in ASCII format:

Meshlab PLY file export - unchecked Binary Encoding
Meshlab PLY file export – unchecked Binary Encoding

Import it into Meshmixer, Ctrl-A to select the whole thing, click (Select →) Edit → Extrude, pick Y-Axis and Flat EndType, then extrude a convenient base in the negative direction:

Meshmixer - Y-Axis extrusion
Meshmixer – Y-Axis extrusion

For whatever reason, some 3D programs show machine-tool coordinates with Z pointing upward and others aim the Z axis at your face. Both must have made sense at the time, because Meshmixer defaults to swapping the Y and Z coordinates on import / export.

The Density slider controls the number of generated faces in the extruded section, so tune for best results.

I have no idea what Harden does.

Accept the result and you have a solid object suitable for further modeling.

,

2 Comments

3D Foot Scanning

The Poughkeepsie Library makes a 3DSystems Sense scanner (V1) available to patrons and, after a bit of to-and-fro, I managed to get a not-awful scan of Mary’s right leg:

Mary - R foot - complete
Mary – R foot – complete

This was accomplished under field conditions in a cramped room hosting a Spanish-language “introduction to computers” class. We propped her leg across the edge of a table with her sock as a cushion.

The depth image resolution seems to be 1 mm and the software attempts to stitch multiple views from different angles into a consistent 3D model. The scanner requires a steady hand and a steady model to successfully glue new data onto the existing model; what seem small misalignments derail the matching.

The software has several presets, of which “Head” produces the best results. I have no idea what the algorithm thinks of her foot; maybe it’s been trained on some truly ugly faces.

Exporting the solid model as either STL or PLY allows import into (Windows-only) Meshmixer, wherein I sawed off the pieces we won’t need:

Mary R foot trimmed
Mary R foot trimmed

If only I had a foot fetish …

The 3DSystems software requires a fairly specific Windows 8 (or 10, which is so not happening) + Intel hardware configuration, which recently arrived as a $250 off-lease Dell Latitude 7250 laptop. It works fine through VNC, so I can use it from the Comfy Desk.

However, using a 3D scanner in your own home isn’t actually private:

3DSystems Sense Scanner - EULA
3DSystems Sense Scanner – EULA

All your data are belong to them:

3D Systems may also automatically collect and report back to 3D Systems information about the Software and Licensee’s usage along with limited information about the Device, 3D Printer, and/or other third-party applications. If 3D Systems implements automated data collection practices then Licensee may opt out of providing such data if Licensee has a license that authorizes Commercial Use.

Oh, and then you must activate the software before using it. The library IT folks tell me I can install & activate the scanner on my system without derailing their setup. I have my doubts, but we’ll see how it goes.

I must get into photogrammetry, ideally from the sofware libre branch as described there. The openMVG repo seems promising.

2 Comments

GCMC Platter Engraving

Engraving Spirograph / Guilloché patterns on scrap CDs and hard drive platters now works better than ever:

Spirograph - 674203941 - preview
Spirograph – 674203941 – preview

After, that is, I realized:

  • Any Rotor will work, as long as it’s smaller than the Stator
  • You must pick pen offset L so the pattern never crosses the stator center point
  • L ≥ 1 is perfectly fine
  • You must scale the resulting pattern to fit the actual space on the disk

One of my final doodles showing how the variables relate to each other, although the Wikipedia article may be useful for the underlying math and other posts have more pix on various machines:

Spirograph Scaling doodles
Spirograph Scaling doodles

Cheat sheet:

  • Stator has tooth count (∝ radius) R
  • Rotor has tooth count (∝ radius) r
  • K = r/R, so if you normalize R=1, K=r
  • Pen offset L puts it at radius rL in the rotor

Picking a suitable rotor requires iterating with random choices until one fits:

  RotorTeeth = Stators[-1];
  n = 0;
  while (RotorTeeth >= floor(0.95 * StatorTeeth) || RotorTeeth < 5) {
    RotorTeeth = (XORshift() & 0x007f);       // this is why Stator can't have more than 127 teeth
    n++;
  }
  comment("Rotor: ",RotorTeeth," in ",n," iterations");

The 5% buffer on the high end ensures there will be an L keeping a hole in the middle of the pattern. Requiring at least five teeth on the low end just seems like a Good Idea.

Given the stator & rotor tooth counts, iterate on random L values until one works:

  n = 0;
  do {
    L = (to_float((XORshift() & 0x1f) + 1) / 32.0) * (1.0/K - 1.0);   // allow L > 1.0
    n++;
  } while (L >= (1.0/K - 1.0) || L < 0.01);
}
comment("Offset L: ", L," in ",n," iterations");

With L chosen to leave a hole in the middle of the pattern, then the pattern traced by the pen in the rotor is centered at 1.0 – K (the normalized Stator radius minus the normalized Rotor radius) and varies by ±LK (the offset times the normalized Rotor radius) on either side:

RotorMin = 1.0 - 2*K;
comment("Rotor Min: ",RotorMin);

BandCtr = 1.0 - K;                      // band center radius
BandMin = BandCtr - L*K;                //  ... min radius
BandMax = BandCtr + L*K;                //  ... max radius

BandAmpl = BandMax - BandCtr;

comment("Band Min: ",BandMin," Ctr: ",BandCtr," Max: ",BandMax);

Knowing that, rescaling the pattern to fit the disk limits goes like this:

FillPath = {};

foreach (Path; pt) {

  a = atan_xy(pt);                      // recover angle to point
  r = length(pt);                       //  ... radius to point

  br = (r - BandCtr) / BandAmpl;        // remove center bias, rescale to 1.0 amplitude
  dr = br * (OuterRad - MidRad);        // rescale to fill disk
  pr = dr + MidRad;                     // set at disk centerline

  x = pr * cos(a);                      // find new XY coords
  y = pr * sin(a);

  FillPath += {[x,y]};
}

comment("Path has ",count(FillPath)," points");

The final step prunes coordinates so close together as to produce no useful motion, which I define to be 0.2 mm:

PointList = {FillPath[0]};                // must include first point

lp = FillPath[0];
n = 0;

foreach (FillPath; pt) {
  if (length(pt - lp) <= Snuggly) {       // discard too-snuggly point
    n++;
  }
  else {
    PointList += {pt};                    // otherwise, add it to output
    lp = pt;
  }
}

PointList += {FillPath[-1]};                // ensure closure at last point

comment("Pruned ",n," points, ",count(PointList)," remaining");

The top of the resulting G-Code file contains all the various settings for debugging:

(Disk type: CD)
(Outer Diameter: 117.000mm)
(        Radius: 58.500mm)
(Inner Diameter: 38.000mm)
(        Radius: 19.000mm)
(Mid Diameter: 77.500mm)
(      Radius: 38.750mm)
(Legend Diameter: 30.000mm)
(         Radius: 15.000mm)
(PRNG seed: 674203941)
(Stator 8: 71)
(Rotor: 12 in 1 iterations)
(Dia ratio K: 0.169 1/K: 5.917)
(GCD: 1)
(Lobes: 71)
(Turns: 12)
(Offset L: 3.227 in 1 iterations)
(Rotor Min: 0.662)
(Band Min: 0.286 Ctr: 0.831 Max: 1.376)
(Path has 43201 points)
(Pruned 14235 points, 28968 remaining)

The GCMC source code as a GitHub Gist:

, ,

1 Comment

CNC 3018-Pro: Hard Drive Platter Fixture

A variation on the CD fixture produces a 3.5 inch hard drive platter fixture:

Platter Fixtures - Hard Drive on 3018
Platter Fixtures – Hard Drive on 3018

Which needed just a touch of milling for a snug fit around the platter:

CNC 3018-Pro - HD platter fixture - test fit
CNC 3018-Pro – HD platter fixture – test fit

Tape it down on the 3018’s platform, set XY=0 at the center, and It Just Works™:

CNC 3018-Pro - HD platter fixture - 70 g
CNC 3018-Pro – HD platter fixture – 70 g

The rather faint line shows engraving at -1.0 mm = 70 g downforce isn’t quite enough. Another test with the same pattern at -3.0 mm = 140 g came out better:

CNC 3018-Pro - HD platter fixture - 140 g
CNC 3018-Pro – HD platter fixture – 140 g

It’s in the same OpenSCAD file as the CD fixture, in the unlikely event you need one.

, , ,

3 Comments