stevendom57
Posts: 6
Joined: Sun Dec 21, 2014 10:23 am

Layer Change Script for Specific Layers

Hi,

I have been using S3D for about a year now and really like it.

I am finally getting to do more custom scripts. Is it possible to write a layer change script that only runs before/after specific layers?

For example. I would like to have the gcode M322 Z2.0 run before layer 10 and M322 Z4.0 run before layer 20. Is that possible?

Thanks

Steven
CompoundCarl
Posts: 2005
Joined: Wed Aug 05, 2015 7:23 am

Re: Layer Change Script for Specific Layers

Sure, just all the following lines to the "additional commands for post-processing" section on the Scripts tab

{REPLACE "; layer 10\n" "; layer 10\nM322 Z2.0\n"}
{REPLACE "; layer 20\n" "; layer 20\nM322 Z4.0\n"}
stevendom57
Posts: 6
Joined: Sun Dec 21, 2014 10:23 am

Re: Layer Change Script for Specific Layers

This does not seem to be working in 3.0.2. I put

{REPLACE "; layer 12\n" "; layer 12\nM322 Z2.38\n"}
{REPLACE "; layer 15\n" "; layer 15\nM322 Z2.98\n"}
{REPLACE "; layer 21\n" "; layer 21\nM322 Z4.18\n"}

in the post processing command and saved the output to my desktop. When I edited the gcode file with notepad I could see the replace statements as comments but the actual lines for layer 15 did not change. I am using a FFCP. Is there anything else I need to set?
stevendom57
Posts: 6
Joined: Sun Dec 21, 2014 10:23 am

Re: Layer Change Script for Specific Layers

Never mind. After looking closely at the gcode file I see that the Layer comment line is actually

; layer 12, Z = 2.3

I just need to replace the statement with

{REPLACE "; layer 12," "M322 Z2.38\n; layer 12,"}
stevendom57
Posts: 6
Joined: Sun Dec 21, 2014 10:23 am

Re: Layer Change Script for Specific Layers

Is there a comment character for the REPLACE command so that I can leave the command in the post processing editbox but comment it out and not have it execute? Being able to do this will allow me to know the format of the command the next time I need it without having to look it up.

Return to “General Discussion and Tips”