Welcome! Log In Create A New Profile

Advanced

z lift before finishing print

Posted by clogs51 
z lift before finishing print
January 13, 2015 02:03AM
I have noticed that sometimes,when a print is finished,the nozzle will hit some part of the print on it,s way to being homed.
At best,that leaves an unsightly mark,at worst, the print is damaged.
Am I correct in thinking I can add a g-code to the slicer settings to lift the z axis,say 20mm,before the homing command?
Can anyone more familiar with coding suggest a code to use for this?Many thanks.
Hans.
Re: z lift before finishing print
January 13, 2015 02:32AM
most slicers have a gcode.end section where you can add what ever gcode you like to the end of the print.
Re: z lift before finishing print
January 13, 2015 02:33AM
Im only a newbie but I think its something like

G1 Z10: move Z up by 10mm, leaving others alone,
Re: z lift before finishing print
January 13, 2015 03:14PM
On my printer that would send Z to 10mm from where ever it was however I vaguely recall an option box to use absolute instead of relative positioning which I changed preferring absolute.
Test it first by sending G1 Z10 F5000 then G1 Z5 F5000. If it goes higher to 15mm it is relative, if it goesback down to 5mm it is absolute. The F5000 is just the speed of the move.
Re: z lift before finishing print
January 13, 2015 03:23PM
That,s what i was looking for thanks guys.
Re: z lift before finishing print
January 19, 2015 12:21AM
I put G1 Z30 F3000 in the end code in slic3r,but it doesn't seem to do anything.
In fact,today was the worst,as a 5 hour print got stuck on the nozzle,deforming it badly.
I also tried G0 instead of G1,as I read somewhere that they are basically the same command,but no lifting is occurring.
I'm loathe to print anything large now,because it ends up being destroyed right at the end,wasting huge amounts of filament.
Re: z lift before finishing print
January 19, 2015 03:29PM
You don't need to do a 5 hour print to check that you have the right end codes to do a 5mm lift at the end of a print. Try it out on a 3 minute print until you get the end code correct.

What has probably gone wrong with your end code is that F3000 is perhaps way too fast for your Z axis to be able to move. If set too fast, you will just hear a brief buzzing from the steppers and they wont move. I don't know what your printer is, but if it uses lead screw(s) for Z axis then the Z axis will not respond fast like the X and Y do.

Here is an example end code that switches off heating, lifts Z axis and then homes X and Y and moves the part to the middle with the fan on full so that the part cools quicker (you may need to change things to suit your printer):

M104 S0 ; turn off head
M140 S0 ; turn off bed
G91 ; relative movements
G1 F150 ; slow Z rate
G1 Z5 ; Z up 5mm
G90 ; back to absolute
G28 X0 ; home X axis
G28 Y0 ; home Y axis
G0 X100 ; move head to middle
G0 Y20 ; move head in a little
M106 S255 ; turn fan on high
M8 ; disable motors


My Prusa Mendel i2 inspired Repstrap with welded steel frame: [youtu.be]
And my Smartrap derived Briefcase 3D printer: [youtu.be]
Re: z lift before finishing print
January 19, 2015 03:57PM
Sounds like the maximum Z setting is incorrect. If you send G1 Z30 F3000 to the printer manually does it work? Try sending a level near your Z maximum to the printer. Eg - if your maximum height is 200 try G1 Z150 F3000. This leaves some room in case of a Z calibration error smiling smiley
Re: z lift before finishing print
January 19, 2015 04:49PM
@N.glasson - learn something everyday. I didn't know about the G90 and G91 to toggle relative and absolute. Thanks
Re: z lift before finishing print
January 19, 2015 07:09PM
I ran the lift code manually,and that works fine,but It still won't work in a print situation.
I have the z lifting and e retracting between print layers,but that is a setting in pronterface.
It's strange they don't provide any lifting at the end of a print,especially an irregular surface .
I have the "3d printing for dummies" book,and I'm sure there is something about retracting in it,
but i can't remember if this was after a print finishing.I'll have another pee3k,and see if i can find it.
Re: z lift before finishing print
January 19, 2015 07:48PM
If it works manually but not when coded into "end codes", I think you are either putting your end codes in the wrong place or your slicer is not incorporating them into your G code. I'd suggest putting something else obvious in the end code on your slicer and see if it works. Something like:

G1 X150 Y150 F3000 ; Move to X = 150 & Y = 150
G4 S2 ; Dwell for 2 seconds
G1 X50 Y50 F3000; Move to X = 50 & Y = 50

If that works try the sample of code I listed previously. Type it on the command line first to see that it all makes sense.

I'd also try opening one of your G code files with a text editor (notepad) and searching near the end of the file for your end codes that your slicer should have put in there. It doesn't make sense for the Z axis to lift when you send commands manually and when you are printing, but not when the command is in end codes.


My Prusa Mendel i2 inspired Repstrap with welded steel frame: [youtu.be]
And my Smartrap derived Briefcase 3D printer: [youtu.be]
Re: z lift before finishing print
January 19, 2015 10:56PM
slice a new small object, and paste the contents of the exported gcode here, have someone from the forums, replace the end code with the advised end code, copy the new code we give you in its entirety and replace that with what is in your exported gcode file, save th change and then load the new exported code. and print that

Retraction refers to when the fillament being feed into the hotend is pulled back out to stop fillament coming out of the hotend, this is normally done when moving the hotend and not wanting to la down plastic, like from one object to another, retraction is not lifting the Z axis at all.

Edited 1 time(s). Last edit at 01/19/2015 10:59PM by Zerker.
Re: z lift before finishing print
January 20, 2015 12:16AM
I can't remember if it's in Pronterface or Sli3er,but there is a setting to move Z up at the same time as retracting filament,which is what i have activated.
Iirc,it,s 3mm for both movements.
I have tried the whole g-code that Neil provided,but it's still no go.
I agree that either I'm not putting the g code in the right place,or it's just not being actioned by the software.
I have added the gcode under the "printer settings" in Sli3er,which is where the "end" gcode is.
I don't know where else I could put it.
That would only leave the "not being incorporated".
I have used a simple washer file,which takes about 2min. to print,re-slicing it after every change in the g code.
I just have to find a program that i can read the sliced g code file with,as my comp keeps telling me it can't open the file.
The annoying thing is,my broadband doesn't work in my (steel) workshop,where the printer lives,so i have to either write it down,
or save it in a notepad file,and bring it inside to work on.Thank god for USB sticks.
Re: z lift before finishing print
January 20, 2015 01:36AM
In windows explorer, find your gcode file then right click and "open with" then select "notepad". That will let you view the contents of a gcode file. It is just a text file. If using mac or linux you will need to find equivalent methods - I'm not so familiar with those OS's.


My Prusa Mendel i2 inspired Repstrap with welded steel frame: [youtu.be]
And my Smartrap derived Briefcase 3D printer: [youtu.be]
Re: z lift before finishing print
January 21, 2015 12:31AM
I've just find out how to open a gcode file in pronterface.Under the "tools" tab is an "edit" button.
Provided the file is loaded,this button shows the gcode for that file.
Which leads me to a curious thing.
Just before the end gcode,their is a line stating Gsomething Z10 F12000.
That seems ridiculously fast.Perhaps that's why my inserted z-lift code was ignored.
I've re-sliced a file with this figure reduced to 200,so I'll give that a try tomorrow.
Incidentally,the previous files i had used to test the z-lift code i had entered showed that code without fail.
So i'm still at a loss why this wasn't implemented by Pronterface.
Re: z lift before finishing print
February 06, 2015 12:47AM
Finally worked out why this lift thing wasn't being activated.The change made to the end g-code has
to be saved by clicking on the relevant icon!Then close and re-open program.
Duh!

Edited 1 time(s). Last edit at 02/06/2015 12:48AM by clogs51.
Re: z lift before finishing print
February 10, 2015 01:31AM
Rats.That,s not it either!
I had a long look at the gcode of some prints,and have come up with a possible cause.
Say a print is 30mm high,if i enter a gcode of Z5,my z-axis is trying to move down through my print to reach a height of 5mm.
So what i will try next,is to enter a value of 35mm just before the end gcode,5mm more than the last print layer height.
e.g G1 Z35 F5000.A bit of gamble,but,i learn through doing,and making mistakesgrinning smiley
Will report in due course.Though I still don't understand why the all the suggestions made didn't work for me.
Re: z lift before finishing print
February 10, 2015 04:42PM
As I posted on Jan 20 above, you need a G91 code in the end code before the G1 Z5. G91 makes subsequent movements relative to the current position, rather than absolute (absolute = relative to zero). If you do it as you suggest, then you will need to change your end code every time you print a model that has a different height.

Edited 1 time(s). Last edit at 02/10/2015 05:11PM by n.glasson.


My Prusa Mendel i2 inspired Repstrap with welded steel frame: [youtu.be]
And my Smartrap derived Briefcase 3D printer: [youtu.be]
Re: z lift before finishing print
February 13, 2015 02:20AM
I've gone back through all posts in this thread,and noted down each and every suggestion.
Yet nothing seems to make my printer head lift before homing after finishing a print.
The code works fine when used manually in pronterface,but once in the gcode file,nix,nada,zip,nuffink.
Even my own suggestion of adding the code manually to the file was rubbish.grinning smiley
I'm going to try upgrading to the latest Marlin version,and see how that pans out.
Re: z lift before finishing print
February 15, 2015 11:34PM
So you slice the file, export your Gcode, replace the end of your Gcode text to be the commands you want. save the file
upload the file into pronterface and hit print, and it still does not execute the code that is at the end of the file?
Re: z lift before finishing print
February 16, 2015 01:21AM
How about loading this: http://www.thingiverse.com/thing:684485 into your slicer, switching loops, minimum extrusion distance and brim to zero in print settings then compiling the G-code. Open resulting G-code in notepad and copy and paste into a message here. Then the assembled experts can see what your start and end codes are.


My Prusa Mendel i2 inspired Repstrap with welded steel frame: [youtu.be]
And my Smartrap derived Briefcase 3D printer: [youtu.be]
Re: z lift before finishing print
February 16, 2015 07:01PM
Ok,here is the g-code with the lift code included:
; generated by Slic3r 1.0.0RC2 on 2015-02-17 at 10:32:44

; layer_height = 0.25
; perimeters = 3
; top_solid_layers = 3
; bottom_solid_layers = 3
; fill_density = 0.4
; perimeter_speed = 50
; infill_speed = 80
; travel_speed = 130
; nozzle_diameter = 0.4
; filament_diameter = 1.72
; extrusion_multiplier = 1
; perimeters extrusion width = 0.40mm
; infill extrusion width = 0.53mm
; solid infill extrusion width = 0.53mm
; top infill extrusion width = 0.53mm
; first layer extrusion width = 0.70mm

G21 ; set units to millimeters
M107
M190 S50 ; wait for bed temperature to be reached
M104 S185 ; set temperature
G28 ; home all axes
G1 Z5 F200 ; lift nozzle
M109 S185 ; wait for temperature to be reached
G90 ; use absolute coordinates
G92 E0
M82 ; use absolute distances for extrusion
G1 F1800.000 E-3.00000
G1 Z3.350 F7800.000
G92 E0
G1 X99.523 Y100.341 F7800.000
G1 Z0.350 F7800.000
G1 E3.00000 F1800.000
G1 X100.477 Y99.659 E3.11225 F600.000
G1 X100.000 Y100.000 F7800.000
G1 X100.341 Y100.477 E3.16837 F600.000
G1 X100.000 Y100.000 F7800.000
G1 X99.659 Y99.523 E3.22449 F600.000
M106 S255
G1 F1800.000 E0.22449
G1 Z3.600 F7800.000
G92 E0
G1 X99.700 Y99.700 F7800.000
G1 Z0.600 F7800.000
G1 E3.00000 F1800.000
G1 X100.300 Y99.700 E3.02582 F600.000
G1 X100.300 Y100.300 E3.05165
G1 X99.700 Y100.300 E3.07747
G1 X99.700 Y99.760 E3.10071
G1 X100.046 Y99.900 F7800.000
G1 F1800.000 E0.10071
G1 Z3.850 F7800.000
G92 E0
G1 X100.300 Y99.700 F7800.000
G1 Z0.850 F7800.000
G1 E3.00000 F1800.000
G1 X100.300 Y100.300 E3.02582 F600.000
G1 X99.700 Y100.300 E3.05165
G1 X99.700 Y99.700 E3.07747
G1 X100.240 Y99.700 E3.10071
G1 X100.100 Y100.046 F7800.000
G1 F1800.000 E0.10071
G1 Z4.100 F7800.000
G92 E0
G1 X100.300 Y100.300 F7800.000
G1 Z1.100 F7800.000
G1 E3.00000 F1800.000
G1 X99.700 Y100.300 E3.02582 F600.000
G1 X99.700 Y99.700 E3.05165
G1 X100.300 Y99.700 E3.07747
G1 X100.300 Y100.240 E3.10071
G1 X99.954 Y100.100 F7800.000
G1 F1800.000 E0.10071
G1 Z4.100 F7800.000
G92 E0
M107
G91 F150
G1 Z10
G90
M104 S0 ; turn off temperature
G28 X0 ; home X axis
G28 Y0 ; home Y axis
M84 ; disable motors
; filament used = -2.5mm (-0.0cm3)



Here without the lift code:

; generated by Slic3r 1.0.0RC2 on 2015-02-17 at 10:33:37

; layer_height = 0.25
; perimeters = 3
; top_solid_layers = 3
; bottom_solid_layers = 3
; fill_density = 0.4
; perimeter_speed = 50
; infill_speed = 80
; travel_speed = 130
; nozzle_diameter = 0.4
; filament_diameter = 1.72
; extrusion_multiplier = 1
; perimeters extrusion width = 0.40mm
; infill extrusion width = 0.53mm
; solid infill extrusion width = 0.53mm
; top infill extrusion width = 0.53mm
; first layer extrusion width = 0.70mm

G21 ; set units to millimeters
M107
M190 S50 ; wait for bed temperature to be reached
M104 S185 ; set temperature
G28 ; home all axes
G1 Z5 F200 ; lift nozzle
M109 S185 ; wait for temperature to be reached
G90 ; use absolute coordinates
G92 E0
M82 ; use absolute distances for extrusion
G1 F1800.000 E-3.00000
G1 Z3.350 F7800.000
G92 E0
G1 X99.523 Y100.341 F7800.000
G1 Z0.350 F7800.000
G1 E3.00000 F1800.000
G1 X100.477 Y99.659 E3.11225 F600.000
G1 X100.000 Y100.000 F7800.000
G1 X100.341 Y100.477 E3.16837 F600.000
G1 X100.000 Y100.000 F7800.000
G1 X99.659 Y99.523 E3.22449 F600.000
M106 S255
G1 F1800.000 E0.22449
G1 Z3.600 F7800.000
G92 E0
G1 X99.700 Y99.700 F7800.000
G1 Z0.600 F7800.000
G1 E3.00000 F1800.000
G1 X100.300 Y99.700 E3.02582 F600.000
G1 X100.300 Y100.300 E3.05165
G1 X99.700 Y100.300 E3.07747
G1 X99.700 Y99.760 E3.10071
G1 X100.046 Y99.900 F7800.000
G1 F1800.000 E0.10071
G1 Z3.850 F7800.000
G92 E0
G1 X100.300 Y99.700 F7800.000
G1 Z0.850 F7800.000
G1 E3.00000 F1800.000
G1 X100.300 Y100.300 E3.02582 F600.000
G1 X99.700 Y100.300 E3.05165
G1 X99.700 Y99.700 E3.07747
G1 X100.240 Y99.700 E3.10071
G1 X100.100 Y100.046 F7800.000
G1 F1800.000 E0.10071
G1 Z4.100 F7800.000
G92 E0
G1 X100.300 Y100.300 F7800.000
G1 Z1.100 F7800.000
G1 E3.00000 F1800.000
G1 X99.700 Y100.300 E3.02582 F600.000
G1 X99.700 Y99.700 E3.05165
G1 X100.300 Y99.700 E3.07747
G1 X100.300 Y100.240 E3.10071
G1 X99.954 Y100.100 F7800.000
G1 F1800.000 E0.10071
G1 Z4.100 F7800.000
G92 E0
M107

M104 S0 ; turn off temperature
G28 X0 ; home X axis
G28 Y0 ; home Y axis
M84 ; disable motors
; filament used = -2.5mm (-0.0cm3)


Upgrading Marlin would get me into a whole new heap of trouble.
I'll save that for another time.
I just want to mention that I appreciate all the effort you guys put into
helping programming-poor souls like me.Thanks very much.
Hans.
Re: z lift before finishing print
February 16, 2015 10:52PM
As expected these two code examples are identical except for the 3 lines of end code starting at line 80.

On line 80 of the first G-code you have G91 F150. This is not correct.

G91 is a stand alone G-code that switches to relative positioning, it should not have the Feedrate code after it
In my example on 20 Jan the four lines of code suggested here are:

G91 ; relative movements
G1 F150 ; slow Z rate
G1 Z5 ; Z up 5mm
G90 ; back to absolute

Note that anything after the semicolon is a comment and is not executed. Comments are good as they let you make sense of the G-Code when you read it.

I'm not sure how the firmware would respond to the error on line 80. I suspect it would just interpret that line as an error and either crash at that point or skip that line and move on. If your print finishes but doesn't turn off the temperature or zero the X and Y axes it would be the former, if it tries to drive the extruder down thru a model (on a model taller than 10mm) then it would be the later. It might also just switch to relative motion at line 80 and not change speed, in which case the Z axis might just stall and not respond to such a large movement demanded at the previously high feedrate. Best to just fix the error and make it work as it should. I think you are very close now.


My Prusa Mendel i2 inspired Repstrap with welded steel frame: [youtu.be]
And my Smartrap derived Briefcase 3D printer: [youtu.be]
Re: z lift before finishing print
August 11, 2019 07:11PM
I know this is a 5 year old post, but thanks for the info. I found it very helpful.
Sorry, only registered users may post in this forum.

Click here to login