Announcement

Collapse
No announcement yet.

Universal Template for gCode Start Code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Universal Template for gCode Start Code

    At the beginning of every 3d print, most slicers will include a block of gcode, designed to set up your printer for a successful print. Here is the gcode I use for my Marlin based printers. Please note that if you have an auto bed leveling system (ABL) available you should uncomment the "g29" that will run the ABL before each print.

    ; DrVax May 2020 Start Code
    ; Added set temp before printint index line
    ; Added set bed temp before print
    ; This first section is for printers with ABL
    M104 S200 ; heat up extruder before calibrating bed
    M140 S40 ; same for bed
    G28 ; Home all axes
    ; G29 ; Probe the bed with the ABL ; **** uncomment this line if you have a always on ABL *****
    G92 E0 ; Reset Extruder
    M140 S{material_bed_temperature_layer_0}
    M190 S{material_bed_temperature_layer_0}
    M104 S{material_print_temperature_layer_0}
    M109 S{material_print_temperature_layer_0} ; Wait for extruder to get back up to temperature
    G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
    G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
    G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
    G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
    G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
    G92 E0 ; Reset Extruder
    G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
    ; DrVax a number of viewers have mentioned that the following M140,190,104,109 commands are redundant.
    ; They maybe but if your printer is already at the correct temperature they will execute immediately
    M140 S{material_bed_temperature_layer_0}
    M190 S{material_bed_temperature_layer_0}
    M104 S{material_print_temperature_layer_0}
    M109 S{material_print_temperature_layer_0} ; Wait for extruder to get back up to temperature
    ; End of custom start GCode

  • #2
    curious about the Z0.3 for drawing your purge line every time I have mine any higher than 0.15 it gets drug over to the model printing area and screws with my prints
    Mind you I am having issues currently with my prints with or with out my purge line.
    My last print which I just stopped because I noting some things wrong with it only 6 hours into the print, which brought me to you lol sorry if I use you as a crutch
    Judging by the actual print that was already printed I am guessing that the underlying issue is with my x axis gantry not being level, as I have already leveled the bed and some where around layer 45 and 60 I noticed the print had a side step to it but not exactly a full side step more like one side has a shelf effect and almost a complete angled edge along the Z axis of one side and the other side was fairly straight I have pictures of the partial failed print if you or some one want to see what I am talking about
    I have it sliced at 0.1 layer thickness with a 0.12 initial layer thickness if this helps any.

    Comment


    • #3
      A z height of 0.3 is quite high. Consider that people often print the first layer at .20mm, I used .3mm since I am extruding a significant amount of filament. If you have to print the purge line at .15 then your bed might be too low which would also explain your difficulties with prints sticking. When you check your bed height with a piece of paper, or as I prefer a post-it note, the note should have significant resistance when you try and move it. If it moves freely your bed may be too low.

      Comment


      • #4
        Ok I was under the impression that the paper test should feel like it is barely touching it like it moves freely but can feel a slight gritty feel to it as the paper moves past the tip.
        So I need to feel it tug it when it moves past the tip?

        Comment


        • #5
          Sorry for the rookie question but is there a similar template available for the end code?

          Comment


          • #6
            Often the standard end code works fine. The end code is really not critical for print success, if done well it just moves the hot end (print head) out of the way to make it easy to get the print off the printer.

            This end code, which ships in Cura 4.6.1 does a good job. Basically it retracts a bit of filament to reduce blobs on top of the print, moves the hot end away from the print to a safe area, then moves the print head to the top of the Z range, turns everything off except for the Z motor. The Z motor is left on so the print head will not crash back down into the print.

            G91 ;Relative positioning
            G1 E-2 F2700 ;Retract a bit
            G1 E-2 Z0.2 F2400 ;Retract and raise Z
            G1 X5 Y5 F3000 ;Wipe out
            G1 Z10 ;Raise Z more
            G90 ;Absolute positionning

            G1 X0 Y{machine_depth} ;Present print
            M106 S0 ;Turn-off fan
            M104 S0 ;Turn-off hotend
            M140 S0 ;Turn-off bed

            M84 X Y E ;Disable all steppers but Z



            Comment


            • #7
              Hello Irv
              At the end of a print, my Artillery Genius returns the nozzle to the home position, so sending the print to the rear of the machine. I then have to manually pull the bed forward to access the model. How would I change the gcode to reverse this manoeuvre, so the bed ends up at the front? Sorry for the noob question, but I’ve never touched a line of code in my life. Thanks.

              Comment


              • #8
                Originally posted by Stuart View Post
                Hello Irv
                At the end of a print, my Artillery Genius returns the nozzle to the home position, so sending the print to the rear of the machine. I then have to manually pull the bed forward to access the model. How would I change the gcode to reverse this manoeuvre, so the bed ends up at the front? Sorry for the noob question, but I’ve never touched a line of code in my life. Thanks.
                Move the bed and extruder to the position to where you want it to position itself at by using the move axis method in the controls "NOT BY MOVING THE BED BY HAND" take note of the coordinates , then edit the Gcode to those coordinates.
                Make sure that the move to that location does not cross the path of any part of your print...
                Last edited by Buzz1971; 05-22-2020, 12:29 PM.

                Comment


                • #9
                  Thanks Buzz, I'll try your suggestion over the weekend.

                  Comment


                  • #10
                    The M104 and M140 are "set temp and continue" codes. The M109 and M190 are "set temp and wait" codes. So M140, M190, M104, M109 means, "Bed set-go, Bed set-wait, Hotend set-go, Hotend set-wait". In other words, after the first G92 E0, you just need M190 and M109. The temperature calls after the second G92 E0 (and G1 Z2.0 F...), don't do anything at all, because they are the same as the previous calls.

                    Comment


                    • irvshapiro
                      irvshapiro commented
                      Editing a comment
                      You are correct.

                  • #11
                    I noticed that this start code has the bed heat to full temperature before commencing to heat up the extruder with this setup on my Anet ET4. How do you get it to heat both at the same time to save a bit of time before the print can begin?

                    Thanks... Hal

                    Comment


                    • BBummer
                      BBummer commented
                      Editing a comment
                      Do you mean that the hot end waits at 200° until the bed gets to full temp, or it stays at room temperature until the bed is up to full temp before it starts?

                    • irvshapiro
                      irvshapiro commented
                      Editing a comment
                      All you have to change is put both of the set temperature commands before the wait for temperature commands. I would wait for the extruder first, then the bed, since the bed takes longer to heat up.

                  • #12
                    Thanks for the reply....

                    The nozzle remains at room temp until the bed is fully up to temp. As a work around, I've started preheat before sending it to print. Preheat allows both to heat at the same time so apparently the ET4 is capable. Do you know how to get this to happen by modifying Irv's start code?

                    Comment


                    • #13
                      Irv's start code, as shown above, should preheat the hot end to 200, the bed to 40, and home the axes, all at the same time. It would also start the bed leveling, if that is enabled.

                      Can you post the first section (everything before ;layer 0) of the gcode that your slicer is generating?

                      Comment


                      • #14
                        I've been tweaking Irv's start code based specifically for my Anet ET4. It's working great for me now.

                        See what you think...

                        ; based on Dr Vax May 2020 start code modified for the Anet ET4
                        M140 S{material_bed_temperature_layer_0}
                        ; heat up bed
                        M104 S{material_print_temperature_layer_0}
                        ; heat up extruder
                        ; without an auto level system all G29 associated commands have been deleted
                        G28
                        ; home all axes
                        M109 S{material_print_temperature_layer_0}
                        ; wait for extruder to heat up
                        M190 S{material_bed_temperature_layer_0}
                        ; wait for the bed to heat up
                        G1 Z2.0 F3000
                        ; move Z-axis up to prevent scratching bed
                        G1 X0.2 Y20 Z0.3 F5000.0
                        ; move to start position
                        G1 X0.2 Y200.0 Z0.3 F1000.0 E15
                        ; draw first line
                        G1 X0.4 Y200.0 Z0.3 F5000.0
                        ; move to right a little
                        G1 X0.4 Y20 Z0.3 F1500.0 E30
                        ; draw second line
                        G1 Z2.0 F3000
                        ; move z-axis up to prevent scratching bed
                        ; end of custom start code

                        Comment


                        • BBummer
                          BBummer commented
                          Editing a comment
                          In practical terms, Irv's code just pauses the heating of the hot end at 200 until the bed is at full temp, yours does not. So the difference from the time that you start the program until plastic is flowing with your code vs. his, is just the time that it takes the hot end to heat from 200 to the initial layer temp. If you are using PLA, that could be maybe 15 (?) seconds, a few more for higher temperature filaments. It really just depends on your equipment.
                          Personally, my goal isn't to get a print started as soon as possible, it's to get a good print finished as soon as practical. I don't want to start printing until the entire bed is at full temperature, because nothing wastes more time and filament than prints that fail due to poor bed adhesion. The problem here is that the bed's thermistor is measuring at one small spot on the bottom, but the bed covers a wide area, and we print on the top. It takes time for the heat to be conducted through all of the bed material. Because of this, the control gets the signal that the bed is at temp before the surface has had a chance to stabilize all the way through to the print surface and to the edges.
                          I also don't want my hot end to be at full temp for any longer than absolutely necessary before I start putting plastic through it. That causes oozing, which isn't a big issue, but it's not helpful either. I run a much shorter purge line than is normal too, and I wouldn't be able to do that if I let the nozzle ooze excessively. In addition, the continuous flow of filament helps keep the plastic above the heat break cool and solid. If we let the plastic sit for a long period, then it might melt in places that it normally doesn't, which could lead to nozzle jams/clogs down the road. If that's happening, then you are working on your hot end, instead of printing parts. (Worse yet, this problem is unlikely be traced back to the start code, it'll be blamed on "bad filament" or a worn out extruder, etc.)
                          While homing during the preheat is a great way to shorten the start time, there are some good reasons for letting your bed get to temp at least a few seconds before the hot end does. I do it a little differently that Irv's code, but the timing is about the same.

                          ps. If you are doing any kind of volume production, there are actually better ways to speed up the process with the end code than there are in the start code.

                      • #15
                        Thanks for the response. I see your points. I don't run production, just personal pleasure use. As I said. this start code is only for an Anet ET4.

                        With the Anet ET4, there is not a heated bed requirement for bed level because the manufacturer didn't see fit to provide the capability. I have no need for 200/40 degree preheat. The preparation menu on this printer does have a preheat option which carries the bed to 60 degrees and 220 degrees and does them both at the same time. My logic is why not send g-code to bringing the extruder and bed to the temperatures that you intend to print with, regardless of material.

                        The heating happens while the printer homes (G28), which on this printer is up at Z250 which does take some time. It pauses until the temperatures come up then prints the 2 purge lines. As far as bed temp goes, I have not had one bed adhesion failure since Irv put me on to Magigoo. I was just trying to adapt a start g-code to this printer and pass the information along to other ET4 users.

                        Comment

                        Working...
                        X