Monday, August 6, 2012

Killing the blob

(Killing the blob part 2 and 3.)

Last time I hacked the gcode I ended up giving up and reverting to the way it was before. However some recent discussion, including a video by Andrew, plus my mounting frustration with the problems I'll enumerate below have inspired me to try again.

The condensed version of this discussion is: Why not use a 3D model and generated GCode to guide modification of the pre-print routine? Long version after the jump.


Do you see that line from the corner to the first print? That's bad. The point of it is to let the extruder prime itself a bit before printing. This solution, while being the most compact in terms of lines of gcode, is not the best. There is a blob at the start but worse there is a blob at the end of the line where your print starts that must be cut off. Plus my discard bucket is filling up with these stringy boogers. So instead we're going to prime the pump with a little logo that is small, compact, and could potentially be given away or that will at least take up less room in your recycling bucket.
To start we need our logo. I designed mine in blender, you could use whatever you want. Make sure the base is flat keeping in mind that all we're going to use is the first layer. You may also want to keep the poly count relatively low. Make it small, mine is less than 12mm square, and position it in the corner of the replicator build platform, at or around -110,-74. I use a cube the size of the Replicator build platform envelope to help me with placement.
There it is in the corner
Then I open up ReplicatorG, open the logo STL, verify that it's in the corner, and generate the gcode.
You might want to make the layer height slightly more than you usually would, turn the speed down, no extra shells, acceleration off (if you can) and if you're using a plugin like skin turn it off for this one. The infill, however, does not matter at all.

Once the gocde is generated go to the gcode tab and scroll down. You may want to have the RepRap GCode reference open at this point. At the top you may recognize the start.gcode that you're already using. Past that there is a bunch of setup stuff (the pause while it process all this is is the reason for the blob on the first part of a plate that needs to be cleaned up). Then there's the first layer. That's the code we want.
Keep that open while you locate your start.gcode files, which for me are under my ReplicatorG directory at \ReplicatorG\replicatorg-0037\machines\replicator. You'll notice there are 3 start.gocde files; Dualstrusion_start.gcode, Single_Head_start.gcode, and Dual_Head_start.gcode. These are for the different types of machines and the different ways you can print. If you have the dual headed replicator edit the dual_head_start. If you have a single head model edit the single_head start. For what we're doing there's not much difference between the two. But I'm not gonna mess with the Dualstrusion for now.

By the way, don't be a dufus. Make a copy of all of these files and either save the copy as a backup or edit the copy and switch to it..

Almost everything we're looking for happens after the line that reads "(**** end homing ****)". The lines we're looking for looks like this:

G0 X-110.5 Y-74 (Position Nozzle)
G0 Z0.2 (Position Height)
M108 R4.0 (Set Extruder Speed)
M101 (Start Extruder)
G4 P1500 (Create Anchor)

That really is tiny and elegant in terms of code, but I want more.

Eventually we're just going to modify the (Position Nozzle) line and replace the (Create Anchor) line with the lines from the first layer from our logo. So back to the gcode tab. Checking against the RepRap GCode reference it looks like those first G1 lines in the logo's first layer are to move to the initial position and set the acceleration. It was too much of a pain for me to turn it off. Checking against the ZigZag example given by Tyler Pope I don't want those acceleration commands there, but that means all the E codes on the G1 lines for movement are going to have to be edited out too, and there are a ton of them. It's a pain, but it's gotta be done. We could also slow down the speed like in the zigzag by changing the F commands in the G1 lines, which would mean we could hopefully skip the infill steps.

We're also going to want to end with an M103 command to stop the extruder so it doesn't draw that useless booger line to our part and start us off with a blob.

So referring to our generated gcode and the ZigZag example we replace the lines shown above in our start.gcode, save, cross our fingers, and test.
Well it works... mostly. There's some improvement that could be made and only time will tell if this will be an improvement over the default in the long run. But I think I can go with this.

The best part in my opinion is the customizability. Make your own logo and edit your own start.gcode files. Or, like Tai Cullum suggested, a little calibration test at the start of the print

If you'd like to use this start.gcode here's the source. Locate the "(**** end homing ****)" line and replace the lines that follow with this:
(**** end homing ****)
G1 Z150 F3300.0 (move to waiting position)
G130 X20 Y20 Z20 A20 B20 (Lower stepper Vrefs while heating)
M6 T0 (wait for toolhead, and HBP to reach temperature)
G130 X127 Y127 Z40 A127 B127 (Set Stepper motor Vref to defaults)
M108 R3.0 T0
G1 X-107.07 Y-63.58 F5400.0 (Position Nozzle)
G0 Z0.14 (Position Height)
M108 R4.0 (Set Extruder Speed)
M101 (Start Extruder)
G1 X-107.07 Y-63.58 Z0.1 F1000
G1 X-105.51 Y-64.53 Z0.1 F1000
G1 X-103.4 Y-62.98 Z0.1 F1000
G1 X-103.15 Y-62.86 Z0.1 F1000
G1 X-102.87 Y-63.03 Z0.1 F1000
G1 X-102.84 Y-63.3 Z0.1 F1000
G1 X-103.13 Y-65.9 Z0.1 F1000
G1 X-101.52 Y-66.78 Z0.1 F1000
G1 X-99.92 Y-65.9 Z0.1 F1000
G1 X-100.21 Y-63.3 Z0.1 F1000
G1 X-100.18 Y-63.03 Z0.1 F1000
G1 X-99.9 Y-62.86 Z0.1 F1000
G1 X-99.64 Y-62.98 Z0.1 F1000
G1 X-97.54 Y-64.53 Z0.1 F1000
G1 X-95.97 Y-63.58 Z0.1 F1000
G1 X-95.93 Y-61.75 Z0.1 F1000
G1 X-98.33 Y-60.7 Z0.1 F1000
G1 X-98.55 Y-60.54 Z0.1 F1000
G1 X-98.55 Y-60.21 Z0.1 F1000
G1 X-98.33 Y-60.05 Z0.1 F1000
G1 X-95.93 Y-59.0 Z0.1 F1000
G1 X-95.97 Y-57.17 Z0.1 F1000
G1 X-97.54 Y-56.22 Z0.1 F1000
G1 X-99.64 Y-57.77 Z0.1 F1000
G1 X-99.9 Y-57.88 Z0.1 F1000
G1 X-100.18 Y-57.72 Z0.1 F1000
G1 X-100.21 Y-57.45 Z0.1 F1000
G1 X-99.92 Y-54.84 Z0.1 F1000
G1 X-101.52 Y-53.97 Z0.1 F1000
G1 X-103.13 Y-54.84 Z0.1 F1000
G1 X-102.84 Y-57.45 Z0.1 F1000
G1 X-102.87 Y-57.72 Z0.1 F1000
G1 X-103.15 Y-57.88 Z0.1 F1000
G1 X-103.4 Y-57.77 Z0.1 F1000
G1 X-105.51 Y-56.22 Z0.1 F1000
G1 X-107.07 Y-57.17 Z0.1 F1000
G1 X-107.12 Y-59.0 Z0.1 F1000
G1 X-104.72 Y-60.05 Z0.1 F1000
G1 X-104.49 Y-60.21 Z0.1 F1000
G1 X-104.49 Y-60.54 Z0.1 F1000
G1 X-104.72 Y-60.7 Z0.1 F1000
G1 X-107.12 Y-61.75 Z0.1 F1000
G1 X-107.07 Y-63.57 Z0.1 F1000
M103
(**** end of start.gcode ****)

1 comment:

  1. Insightful and the best thing to come away with here, for me, is to have an icon or logo printed every time instead of wasted anchor lines.

    Keep it up!!!

    Andrew

    ReplyDelete

Note: Only a member of this blog may post a comment.