G-Code tricks and examples

Tip: Set temps with custom g-code

I have been printing on my TAZ 2.1 now without my PC. Here is what I did to make that easy.
I used to use Printrun (which ships with your TAZ), to level the bed, heat the components and execute the print. Now I find I hardly level the bed at all, unless I move the TAZ. Since I wasn’t using Printrun to level anymore, I figured it was time to figure out how to use the SD card to print, which is easier than you think.

I made a folder on the SD card, dropped my g-code files into it, took it to the printer, slid it into the SD slot (after figuring out the label on the SD card points away from you), then had to set temperatures on the bed and nozzle from the LCD screen, and then started the g-code file on the card. Easy, but I don’t have time to sit around waiting for the components to come to temperature before I can execute the print. When I used to use Printrun, I had my components up to temperature because I had just leveled the bed before the print, but like I said, no more leveling. So, here comes the g-coding.

Went to http://reprap.org/wiki/G-code and read up on some g-code. I found three codes that would help solve my problem standing around waiting for components to heat up. They are M104, M190, & M109. Below is the custom g-code that I insert into the beginning of my g-code files. I have put explanations next to the codes:

G28 ; home all axes
M104 S165 ; set extruder to 165 degrees and immediately return control to host
M190 S85 ; set bed temperature to 85 and wait until temperature arrives before returning control to host
M109 S220 ; set extruder to 220 degrees and wait until temperature arrives before returning control to host


Now, here are some things to keep in mind. I print with natural ABS, and I use the temperatures of 85 for the bed and 220 for the nozzle and have not had any problems. If you use a different material, adjust the temperatures accordingly. I also have the 12V bed, so yes, it takes a long time to come up to temperature. The nozzle gets to temperature much faster and sits there slowly oozing plastic while the bed catches up. That is why I send the M104 code to get the nozzle up to 75% of my desired temperature, which does not ooze. The M190 code executes right after the M104 code starts, this starts the slow process of bringing my bed up to temperature. When the bed finally gets to temperature, and only after it reaches the temperature, the M109 code sends to finish bringing the nozzle up to temperature, and after the nozzle reaches that temperature the print will begin.

What I like about this is: now I put the SD card in the TAZ, turn it on, select the g-code file on the LCD screen, and then walk away. Everything comes up to temperature and only starts printing when the machine is ready.
I could use the M116 code which “Waits for all temperatures and other slowly-changing variables to arrive at their set values,” but I don’t like my nozzle to sit there at 220 waiting for the bed to catch up. Perhaps on the new 24V beds, this would be the route I take.

Hope this helps other newbies like me. If you have a cool g-code trick or tip, please share with a good description newbies like me can follow and understand. Also if I am doing something wrong, or could be doing it better, I’m totally open to advice.

Thanks!

Trick: Hybrid G-Code File

I was printing a guide for my dremel tool that threads directly onto the tool. :smiley:
01.jpg
02.jpg
This needs to be printed with support material for the window at the top, but the support material would also gunk up the threads at the bottom. I know there is a setting to adjust support material in slic3r, but I didn’t really understand it. :confused:


I kept changing the angle for the overhang threshold but it didn’t seem to make a difference when I exported g-code. It would continue to put support material down in the threads at the base. Then I remembered reading somewhere about cutting and splicing g-code. :bulb:

So, I exported two g-code files, one with supports, and the other one without. Opened both separately in http://gcode.ws/ and scrolled up through the layers until I came to the last layer before the window started in my dremel guide. You can click the tabs at the top of the internet screen for http://gcode.ws/ to “GCode” and it will show you all the code highlighted for the current layer you are looking at. I copied all the non-support code before this layer, and copied from my other internet browser, all the supported code after and including that layer. Now I had two blocks of code I put into a blank g-code file. Now when I print, the bottom portion with the threads prints cleanly without supports, and when it gets to the top it prints with supports. :wink:




(If you are a real pixel peeper, you can see there isn’t a good fill between my outer and inner layers. I am going to increase the outer diameter of my guide so it gives more room for better infill, though the guide still worked just fine.)

Hope this helps others.

Cool, thanks for the tips.

I have been thinking to do the same with the temp setting G-code Slic3r generates, putting it on the SD card makes it even better! (Slic3r generates M190 - M104 - G28 - M109, which takes forever).

I’m not sure if it’s possible to do through G-code, but a manual bed leveling probe cycle would be very useful. Tricky part is the input that advances and loops through the points. Alternatively a continuous motion could take a pause or delay command while adjusting the screws.

Your hybrid g-code trick I’ll try for sure!

PS: you can speed up your temps a bit if you start heating the extruder when the bed reaches ~70C. You can time it so both temps reach target at about the same time.

I’ll give it a try and time my machine to find out. I am curious how much of a time difference it takes for the bed at different ambient room temperatures. Another experiment I’ll put on the list to do.