A Little Counter Intelligence

So I’m printing out a couple sets of Magic: The Gathering +1/-1 counters for an Etsy customer and I run into a problem. The red ABS +1/+1 counters are printing fine, but the -1/-1 black PLA counters are getting all feshnicket about midway up the print.

feshnicket couner

Good enough for a pickup game at Casa de Zheng, but one of these might show up at a tournament somewhere and we can’t have our customers looking anything less than their best.

If you don’t have your own 3D printer, you can get these counters on Shapeways, and if you do have your own printer head over to The Forge and print them at home. They’re in the Miniatures section.

These fellas are pretty small, so the newly-extruded PLA isn’t cooling off before the extruder head comes around to the same X-Y position on the next layer. Gooey plastic gets smudged a little bit and the edge of the counter becomes irregular. Fugly.

The solution is a little bit of custom gCode. A brief pause between layers gives the PLA time to stiffen before the extruder drags itself over the same spot.

The gCode needed for this is G4, or “dwell,” with a parameter measured in milliseconds. You’ll also want to move the extruder head out of the way while it dwells so that it doesn’t continue pumping heat into the print.

Here’s the gCode that needs to be added after each layer. Everything in parentheses is a comment and might make your interpreter go to la-la land.

G91 (set to RELATIVE positioning)
G1 Y10 F3900.0 (move 10mm in Y)
G4 P5000 (wait for 5 seconds)
G1 Y-10 F3900.0 (move -10mm in Y)
G90 (reset ABSOLUTE positioning)

You could add this with a Find/Replace in a text editor; just search for (</layer>) and append the gCode above to the end.

OSX’s TextEdit will actually let you add carriage returns to your find/replace fields if you hit CTRL-Q and then hit the return key. But saving that output gave me some weird text encoding errors, demanding that I switch from UTF-8 and it’s not 1994 anymore so WTF Apple.

It’d take me longer to figure out that text-encoding problem than it would to write a short Python script to do the job. Assuming you’re on a Mac and have in_file.gcode on your Desktop:

import os

# read the input file
f=open(‘/Users/zheng3/Desktop/in_file.gcode’, ‘r’)
#Windows and Linux paths are left as an exercise for the reader.
content=f.readlines()
f.close

gCode=’G91\nG1 Y10 F3900.0\nG4 P5000\nG1 Y-10 F3900.0\nG90\n’
# the \n puts a carriage return after each line.

for i in range(len(content)):

if ‘()’ in content[i]:
content[i]=content[i]+gCode

#write the output file
f=open(‘/Users/zheng3/Desktop/out_file.gcode’,’w’)
f.write(“”.join(content))
f.close

Then fire up out_file.gcode in ReplicatorG and a few minutes later, you’ve got yourself a decent print. Nice print on the left, yeechy print on the right.

fixed

What do you think?