Jump to content

How do i add gcode to raise extruder to max height when print completed?


windy54

Recommended Posts

Posted · How do i add gcode to raise extruder to max height when print completed?

Hi,

I am new to CURA 5.6, also this is my first post so apologies if it is in the wrong place.

 

When my print is finished I want to raise the extruder to maximum height and move the bed to the front.

 

How do i do this?

 

Do I have to create a python script?

 

Is there no where I can just add the G-code commands?

 

Is this what the retract continue script does?

 

I have done some searching but cant find an answer, mine you baed on my past experience I have probably entered the wrong question !

 

thanks 

Steve

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    In the Cura go to Manage Printers and then Machine Settings.  In the lower left textbox is the "Ending Gcode".  It is the script that shuts down the machine.  Copy what you have there (use CTRL+V) and paste it here.

     

     

    You need something like...

    G0 F{speed_travel*60} Y{machine_depth} Z{machine_height}

    Cura would replace the keywords and you would get something like

    G0 F7200 Y230 Z250

    But exactly where it goes in the ending gcode is important so post what you have and let us know what printer we are talking about because some have the zero in the rear and some ending gcodes include G28 homing commands or go into relative movement, so you will likely need something different.

     

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    Hoping Windy54 will forgive the intrusion by another newbie...

     

    I just saw this thread and I've had exactly the same question, but I have a heads-up for Windy54: Any keystroke you make while within the start or end G-code windows will be there; there's no 'undo' that I could find short of re-installing the printer. Also, in my copy of v5.6.0, Start G-code is on the lower left, and End G-code is on the lower right.

     

    Again, begging Windy54's forgiveness, my Creality Ender-3 v3 SE End G-code screenshot is attached (Cura wouldn't let me copy/paste). Based on your earlier post, it would seem that I'd need to change the 5th line, "G1 Z10 ;" to a larger Z value to move the extruder up higher at the end of a print. Am I on the right track?

     

    Thanks!

    (And I hope Windy54 benefits, as well.)

     

    enderEndGcode.jpg

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?
    4 minutes ago, rv7charlie said:

    Again, begging Windy54's forgiveness, my Creality Ender-3 v3 SE End G-code screenshot is attached (Cura wouldn't let me copy/paste). Based on your earlier post, it would seem that I'd need to change the 5th line, "G1 Z10 ;" to a larger Z value to move the extruder up higher at the end of a print. Am I on the right track?

    You are definitely on the right track. That code will raise it by 10mm. But if you really want to raise it to maximum height, then remove that line and change one a couple of lines down that says:

    G1 X0 Y{machine_depth}

    and replace it with:

    G0 X0 Y{machine_depth} Z{machine_height}

     

    Going to the top after every print requires patience though: specifically when you start the next print and it has to slowly go alllllllllllllllllllllllllllllllllllllll the way down. 

    • Like 1
    Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    That sounds good. I don't really need it to go all the way up, but the SE has a magnetic bed and while it's fairly easy to remove the build plate, it's tricky to get it back on without scratching up the underlying heated bed. Also hard to inspect the nozzle for residue after the print. I think I'll try changing the '10' to around '50'; that should give me plenty of room.

    I appreciate the help!

    • Like 1
    Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?
    44 minutes ago, rv7charlie said:

    That sounds good. I don't really need it to go all the way up, but the SE has a magnetic bed and while it's fairly easy to remove the build plate, it's tricky to get it back on without scratching up the underlying heated bed. Also hard to inspect the nozzle for residue after the print. I think I'll try changing the '10' to around '50'; that should give me plenty of room.

    I appreciate the help!

    My problem isn't the nozzle scratching the heat bed, it's when the nozzle decides to go down while you're changing filament and melts a hole through the top layer of the bed (revealing the magnetic sheet below)

    • Laugh 1
    Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    There is a problem with a “generic” idea of “go up 10”. What happens when you’re printing something that is less then 10mm from max height? That’s when you get “bad things”. From your Z steppers. Ask me how I know this. 
     

    the better move is to put this in place of the “raise 10” 

    G90; Absolute positioning

    G0 F5000 Y{machine_depth} Z{machine_height}
     

    2 hours ago, Slashee_the_Cow said:

    Going to the top after every print requires patience though: specifically when you start the next print and it has to slowly go alllllllllllllllllllllllllllllllllllllll the way down. 

    G28 Z

    its not happening at F5000 but make it the first line of start up. I use G28. Then a single G0 F5000 to set travel speed for the rest of set up. Heat bed, run G28 Z with bed at operating temp. Then let the rest run. 


    I had to fiddle with octo to get the filament changes working right. But I’m 100% octo these days. I bet my stuff won’t work from firmware. 

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?
    6 hours ago, jaysenodell said:

    Ask me how I know this.

    I don't need to. Except when it's the X axis it's more painful because it's trying to move so much faster (wasn't trying to move at the end of a print, it got bumped when OctoPrint accidentally disengaged the motors and the head got moved).

     

    6 hours ago, jaysenodell said:

    G28 Z

    That's just "home Z axis". If that's your first line and you're looking to save time you should probably do this:

    M140 S{material_bed_temperature_layer_0} ; Start preheating the bed
    G90 ; Absolute positioning
    G0 F1800 Z50 ; Move to 5cm above bed at max Z speed (may be different for your printer)
    G28 X Y ; Home X and Y axes in case bed is still heating up
    M190 S{material_bed_temperature_layer_0} ; Wait for bed to finish heating up before you home Z due to expansion
    G28 Z ; Home Z axis now that bed is hot

     

    6 hours ago, jaysenodell said:

    I had to fiddle with octo to get the filament changes working right. But I’m 100% octo these days. I bet my stuff won’t work from firmware. 

    I still can't get it to not behave like a toddler throwing a tantrum when I have an M0 in my code. It's still in the "pausing" state by the time I've finished changing filament, gotten back to my computer and sent an M108 through the terminal (which then puts OctoPrint in the "paused" state so I can actually resume it).

     

    6 hours ago, jaysenodell said:

    There is a problem with a “generic” idea of “go up 10”. What happens when you’re printing something that is less then 10mm from max height? That’s when you get “bad things”.

    The "bad things" in this case being firmware. Any decent firmware wouldn't blindly follow a relative move command beyond its boundaries. But a lot of the cheaper manufacturers out there are letting people down on the firmware side.

     

    The best way of moving up either a certain distance or to the top of the build volume if the relative movement is too high is a post-processing script. I've done some work on one but I still need to work out the bugs (the main one being that after it moves up it starts extruding filament endlessly for no reason, I'm probably just inserting my commands in the wrong place).

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    thanks for responses, I could not find the start and end gcode windows, I see they are in the printer settings window,

     

    so I am in business.

     

    Well, I will be once I have repaired my Balco touch, extruder temperature is all over the place and it is not feeeding filament so a strip down is required.

  • Link to post
    Share on other sites

    Posted (edited) · How do i add gcode to raise extruder to max height when print completed?

    Thanks to windy54 for letting me tag along on this subject.

    So, if altering "G1 Z10" isn't a great idea,  but I don't want to take the extruder all the way to the top at the end of the print, I need to learn what G-codes actually mean. 😉 I see that 'G0' means 'absolute positioning'.  For 'F5000', I've only found this (on a web site about start & end G-codes):

    'G0 F5000 Z20: This command moves the Z axis up 20mm to allow the filament to ooze freely.' 

    The Cura G-code for my Ender SE doesn't have the 'F5000'; is it needed? 

    Does 'Y{machine_depth}  mean to move the Y axis to the Y limit defined in Cura's file for any particular machine? 

    Instead of using:

    "G0 F5000 Y{machine_depth} Z{machine_height}",

    Would it work to use 'G0 Y{machine_depth} Z50', to move the extruder up 50 mm above the print surface?

    Or, is there some other command, some conditional expression, to leave the extruder at least 50 mm above the bed but above the end of a print, without exceeding the Z axis max limit?

     

    I'd have expected any sensible printer design to have a physical limit switch for the Z axis, like the X & Y, but I confess that I forgot to check when I was in the shop today. That's on my list for tomorrow. 😉

     

    Thank you all again for your help!

    Edited by rv7charlie
  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?
    2 hours ago, rv7charlie said:

     I see that 'G0' means 'absolute positioning'.

    Sorry, but you're starting off on the wrong foot. G0 and G1 are both "linear move", the convention is to use G0 for travel moves or G1 for anything which involves extruding filament.

     

    Absolute positioning is G90, relative positioning is G91.

     

    2 hours ago, rv7charlie said:

    For 'F5000', I've only found this (on a web site about start & end G-codes):

    'G0 F5000 Z20: This command moves the Z axis up 20mm to allow the filament to ooze freely.' 

    The Cura G-code for my Ender SE doesn't have the 'F5000'; is it needed? 

    The F parameter for G0, G1 (and G2 and G3) indicates the speed in millimetres per minute. If the parameter is left out then it will uses the last value that was supplied for that axis.

     

    The E3V3SE can't actually move that fast on the Z axis, if you set it to over the maximum it'll just go as fast as possible but according to the specs it can move 30mm/s on the Z axis which would make it F1800.

     

    2 hours ago, rv7charlie said:

    Does 'Y{machine_depth}  mean to move the Y axis to the Y limit defined in Cura's file for any particular machine? 

    Yes: the machine depth specified in the definition file for the printer you're using.

     

    2 hours ago, rv7charlie said:

    Instead of using:

    "G0 F5000 Y{machine_depth} Z{machine_height}",

    Would it work to use 'G0 Y{machine_depth} Z50', to move the extruder up 50 mm above the print surface?

    That won't necessarily move the print head up. It will move it to 50mm. If you're printing something anywhere near that high (or higher) you run the risk of running into your print.

     

    2 hours ago, rv7charlie said:

    Or, is there some other command, some conditional expression, to leave the extruder at least 50 mm above the bed but above the end of a print, without exceeding the Z axis max limit?

    You'd need a post-processing script. The replacement patterns and basic conditionals can't take the position of the print head in to account

    • Like 1
    Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?
    5 hours ago, Slashee_the_Cow said:

    The F parameter for G0, G1 (and G2 and G3) indicates the speed in millimetres per minute. If the parameter is left out then it will uses the last value that was supplied for that axis.

    With some firmare (say marlin on creality) you set G0 FXXX as a single entity to provide a "default" for all travel moves until someother line supplies F in a G0. 

    G0 F5000 ;Set G0 feedrate to 5000
    G0 X10 Y10 Z10 ;move to 10,10,10 at 5000
    G0 X200 Y200 Z200 ;move to 200,200,200 at 5000
    G1 F1000 X10 ;move to 10,200,200 at 1000
    G0 X200 Y10 Z10 ;move to 200,10,10 at 5000
    G0 F1000 X10 ;move to 10,10,10 at 1000
    G0 X200 Y200 Z200 ;move to 200,200,200 at 1000

    The same works for G1. These are throw back convenices to manual coding when entering F rates could get ... WtF?!? over complicated actions. It's still widely used in CNC as well as there is still a lot of hand coding there too. 

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    You can query the printer for "where are you right now" using M114 but it requires a USB connection that can read the response and then the response would need to be parsed.

    Parsing a response requires an additional app as Cura doesn't really "communicate" (it's "send" only), and although Pronterface will display a response, it doesn't do any parsing.

    You can see that all of that goes well beyond what can be done in your Ending G-code.

     

    This is a response to M114 from my older Ender 3 Pro.  The last three numbers are the "steps" that have been sent to get it to the current XYZ location.

    X:111.22 Y:111.22 Z:5.20 E:1123.57 Count X:8880 Y:9280 Z:2080

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?
    15 minutes ago, jaysenodell said:

    With some firmare (say marlin on creality) you set G0 FXXX as a single entity to provide a "default" for all travel moves until someother line supplies F in a G0. 

    <snip>

    The same works for G1.

    The Marlin 2.0 standard provides an option for a printer to keep separate feed rate values for G0 and G1, but some printers don't bother using that and just share the feed rate values as G1 is just an alias for G0.

     

    27 minutes ago, jaysenodell said:
    G0 F5000 ;Set G0 feedrate to 5000
    G0 X10 Y10 Z10 ;move to 10,10,10 at 5000
    G0 X200 Y200 Z200 ;move to 200,200,200 at 5000
    G1 F1000 X10 ;move to 10,200,200 at 1000
    G0 X200 Y10 Z10 ;move to 200,10,10 at 5000
    G0 F1000 X10 ;move to 10,10,10 at 1000
    G0 X200 Y200 Z200 ;move to 200,200,200 at 1000

    Assuming we are keeping separate feed rates for G0 and G1, line 6 will decelerate from 5000mm/min to 1000mm/min over the course of the move, not simply switch to being 1000 (which would require a G0 F1000 beforehand).

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    "line 6 will decelerate from 5000mm/min to 1000mm/min over the course of the move," 

    ???

    Line 6 should be a move back to X10 at 1000mm/min.  There can be no "gradual change over the course of the move" from 5000 to 1000.

     

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    @GregValiant I'm just going by possibly misinterpreting this example from the Marlin docs:

    image.thumb.png.b4fb0c46587798e3755b0656f23856b7.png

    In my "my brain takes everything literally" mode (default and only option available), it says it does the move, accelerating to a feed rate of 3000, implying it's starting at 1500 and then increasing over the move, not "does the move above at 3000 (if possible)".

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    I don't see that on my machine.  If the firmware is configured that way then that's what it is.  I moved the F parameter to the end and it made no difference.  Other slicers always put the feedrate at the end.

     

    The parameter is in the line for that move and it should be obeyed as an absolute value for the move.

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    Y'all have been very helpful (and patient) with my typical technique of learning a new subject by starting somewhere in the middle and randomly working my way to the edges.

     

    The 'F5000' phrase now makes more sense; it would seem that there's no reason to take it out since it can only (potentially) improve movement speed after the print is finished.

     

    It would seem that the earlier recommendation to use:

    G0 X0 Y{machine_depth} Z{machine_height}

    makes the most sense, since I did a quick check on the printer, and moving the extruder from max height to 'home' only took about 1:25. For my hobby purposes this isn't a big deal, since it will only slow the start of printing slightly, beyond the time it takes to start when using the Cura slicer to prepare the print. Cura seems to heat the bed to operating temp before starting to heat the extruder. This obviously takes longer than using the printer's firmware 'preheat' option which heats both at the same time, but I've decided that it's acceptable for me because the firmware preheat just causes the extruder to drool for several minutes before I get the print loaded up. 

     

    Can the 'F5000' be inserted in the line quoted above, and (or) is there any reason to do it? 

     

    Finally, I took a look at the physical limit switches on the Ender SE. there's one to limit bed travel to the rear, and one for extruder travel to the left, but no others. From my background of doing hardware maintenance on industrial equipment back in the previous century, this seems very strange. Industrial gear always had physical switches to limit (stop) powered movement before damage could be done. It looks as if the SE uses them only to determine some 'home' reference point, with no hardware protection from excessive excursions. Is this a common cost saving measure with hobby equipment?

     

    Again, thanks to all for your assistance.

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    I have a third end stop switch for the Z (but I don't have ABL).

    There is no "positive" end stop switch for any axis.  That's in the firmware and that's why "relative" moves can be a problem.

    Some firmware is configured to respond to M211 which is "set or disable software endstops".

     

    The firmware should stop a move to something like X1000 but a relative move of X1000 might slip through.  That would be ugly and the printer could hurt itself.

     

    Congratulations on your system of "Start in the middle and work both ways".  It is just like my system of "Randomly stumble in the dark" only different.

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    I really need to finish my "Move Up When Done" script. Right now it works in that it'll move up either a certain amount or to the ceiling (whichever is lower) and it doesn't work in that after it's moved it sits there pissing filament constantly. Probably just inserting my code in the wrong place.

     

    Although I am curious how often people are printing stuff at least 200mm high that moving up 50mm would be a problem.

     

    Although as it turns out, Creality are smart enough to get some things right (amongst the many wrong), so maybe this is all moot, at least for an E3V3SE.

    Sorry about the camera work. Makeshift phone stand on top of shoebox on top of box from flatpack shelves is not the world's greatest tripod. I was polite enough to speed some bits up to 300% speed so you're not spending literally five minutes watching a print head move.

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?
    9 hours ago, Slashee_the_Cow said:

    Although I am curious how often people are printing stuff at least 200mm high that moving up 50mm would be a problem

    I mean... I may be manufacturing a product that fits this so... every day? 

     

    My tubes are being ordered pretty standard at 450-500mm I print them in 3-4 sections to make them fit nice nice. I'm expecting some "big ones" that will be 700+mm soon. 

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    I'm getting the same thing on my older Ender 3 Pro.  Even if it's a relative move, max height is max height.

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?
    11 minutes ago, jaysenodell said:

    I mean... I may be manufacturing a product that fits this so... every day? 

    If you're going to be mass producing something then the easiest thing to do to get it to the height you want is just edit the gcode file and replace whatever the ending gcode put in with exactly what you want.

     

    But as my test showed a relative move will never exceed the height limit, unless for whatever reason the gantry has been moved since it was last homed.

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?
    6 minutes ago, GregValiant said:

    I'm getting the same thing on my older Ender 3 Pro

    The current firmware from Creality on a E3S1P will grind the Z if you try to past the top. And it will drive the nozzel right throught the plate. The software stopes are ... non-effective. I've not altered the firmware on this since the last reload. That reload included a factor reset of the EEPROM. When I querry the system it returns the correct build volume so it knows where to stop. It just doesn't. 

  • Link to post
    Share on other sites

    Posted · How do i add gcode to raise extruder to max height when print completed?

    If you have a terminal connection to the printer, send it an M211 to see whether the software endstops are on. If they aren't, M211 S1 will turn them on.

    • Like 1
    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.8 Stable released 🎉
        In the Cura 5.8 stable release, everyone can now tune their Z seams to look better than ever. Method series users get access to new material profiles, and the base Method model now has a printer profile, meaning the whole Method series is now supported in Cura!
        • 5 replies
      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Thanks
          • Like
        • 3 replies
    ×
    ×
    • Create New...