Question regarding conditional gcoding with Slic3r PE
 
Notifications
Clear all

Question regarding conditional gcoding with Slic3r PE  

  RSS
DerBierBaon
(@derbierbaon)
Eminent Member
Question regarding conditional gcoding with Slic3r PE

Hi guys,

I've hit a little bump regarding information I can find about the usable parameters with the conditional gcode. I wanted to add a "if"-statement to my end gcode which should read out the current z-height after the print and if it's below 50mm it should movethe extruder up to z=50mm and if it's above it should ignore it.

My idea was: {if layer_z < 50} G1 Z50

But I only found input on the non-PE Slic3r and there it was mentioned that the layer_z parameter was only available in the before/after layer change gcode.

Any infos on where I can read up on this or maybe a solution?

Help would be greatly appreciated 🙂

Regards
-DerBierBaron

Posted : 04/06/2018 7:41 pm
Vojtěch Bubník
(@vojtech-bubnik)
Admin
Re: Question regarding conditional gcoding with Slic3r PE

https://github.com/prusa3d/Slic3r/wiki/Slic3r-Prusa-Edition-Macro-Language

Posted : 04/06/2018 8:03 pm
DerBierBaon
(@derbierbaon)
Eminent Member
Topic starter answered:
Re: Question regarding conditional gcoding with Slic3r PE

Thanks for the reply.

But that seems to be a problem though: On that page under "scalar variables" it says:

layer_z (only available in layer change GCode)
layer_num (only available in layer change GCode)

I don't have any idea how to implement my idea to the layer change gcode instead of the end gcode. If I just put my statement from my first post there every program will stop after the first layer...

Any ideas how it could still be implemented? maybe with "==" and another statement?

Regards,
-DerBierBaron

Posted : 05/06/2018 5:06 pm
Vojtěch Bubník
(@vojtech-bubnik)
Admin
Re: Question regarding conditional gcoding with Slic3r PE

Sorry, but I don't understand what you want to achieve.

> {if layer_z < 50} G1 Z50

it should be
{if layer_z < 50} G1 Z50 {endif}

It should work in the layer change G-code, but I don't understand what you want to achieve. Such a G-code will break your print.

Posted : 05/06/2018 8:04 pm
richard.l
(@richard-l)
Moderator
Re: Question regarding conditional gcoding with Slic3r PE


Sorry, but I don't understand what you want to achieve.

> {if layer_z < 50} G1 Z50

it should be
{if layer_z < 50} G1 Z50 {endif}

It should work in the layer change G-code, but I don't understand what you want to achieve. Such a G-code will break your print.

I believe he is wanting to place this in the End G-Code script so that if the finished print is less than 50mm high it will raise the z-axis to 50mm when complete. I think a better solution is what I have in my end g-code ...

G91 ; Use relative coordinates
G1 Z10.0 F5000 ; Lift Nozzle by 10.0mm
G90 ; Use Absolute Coordinates
G1 X0 Y200; move bed to front and home x
M84 ; disable motors

Posted : 06/06/2018 4:06 pm
DerBierBaon
(@derbierbaon)
Eminent Member
Topic starter answered:
Re: Question regarding conditional gcoding with Slic3r PE

Hi there,

yes richard.l is right. What I'd like to make is that the extruder should lift itself up to at least 50mm after the print, which is not possible with the {if....}-code I posted earlier. I want this due to the troubles I am having with the mesh bed leveling and a heated up PINDA 2 probe. Usually I do this after every print now, i.e. I manually lift the extruder with the move axis function in the menu. The reason I am doing that is to let the PINDA cool off more easily in between prints, so that it can't be kept warm by the heatbed.

Therefore the code I posted will not work (which is what I wrote earlier) and I now would like to find a way to do this nontheless.

richard.l your solution is one way to work around my problem. I could lift off 50mm instead of your 10mm. But wouldn't this push the x-carriage against the top guide braces on the frame for pieces at that height? Similar to what is done for z-calibration?

Regards,
-DerBierBaron

Posted : 06/06/2018 6:29 pm
richard.l
(@richard-l)
Moderator
Re: Question regarding conditional gcoding with Slic3r PE


richard.l your solution is one way to work around my problem. I could lift off 50mm instead of your 10mm. But wouldn't this push the x-carriage against the top guide braces on the frame for pieces at that height? Similar to what is done for z-calibration?

I don't think so because the firmware is limiting the z-axis height to I believe 210. Once there it stops. I haven't tried it but I can this evening when I get off work.

Posted : 06/06/2018 8:17 pm
Share: