How to send ${LayerThickness} to printer at each exposure


I would like to send the layer thickness of my design to each layer exposure to my printer on COMx.

The issue I am facing is that the layer thickness that is sent is the one under the “Slice height” and doesn’t correspond to my design thickness.

Any advice?



This gives you the variables that you can use in your gcode program:

Notice that one of the variables is:

That job corresponds to this object:

Which allows you to call this method:

Putting all of that together gives you your design thickness like this:
${LayerThickness * job.getTotalSlices()}


Hi Wes

Thanks for the feedback… But I can’t manage doing it.

I can’t understand your help. I would like to get the LayerThickness of the current printing job and your proposal is to the LayerThickness by the job.getTotalSlides().

I would have been expecting a variable like “job.LayerThickness()” but this variable seems not to exist. Or better stated I can’t find a variable that indicates the current job layer thickness.

Could you, please, be more explicit in your explanations. That would be nice.

Thanks / Mohamed


I’ve documented the precise command here:


I have read all this even before you make me aware about it.
I can’t see how this could solve my issue.
The “LayerThickness = The height in MM of the each slice.” parameter doesn’t indicate the layer thickness (or slice height) of the current job, but it indicates the value that is not related to the current job. Please, look at the annexed figure.

Having the number of slices (84 in my case) multiplied by 0.1 (Ink configuration default), i.e. equals 8.4 doesn’t help. I would like to see there my job slice height which is 0.300 mm in my case.
Thank you.


That would be:


Hi Wes

I seems very difficult for me to ask questions. Here is on further trial.
When generating my printable job, the slicer generates the following slacer.json file inside the SLAcer compressed folder:

“imageExtension”: “png”,
“imageDirectory”: “slices”,
“screenWidth”: “1920”,
“screenHeight”: “1080”,
“screenSize”: “154”,
“screenUnit”: “mm”,
“layersNumber”: 84,
“layersHeight”: 0.3,
“exposureTime”: 3000,
“liftingSpeed”: 50,
“liftingHeight”: 3

Is there any way to send the layersHeight value (as indicated in this slacer.json file here above) to my printer which is on COM 101? In this case this layersHeight value is 0.3 and not 0.1.

Sorry for insisting. I would like just to be clear in my asking.

Thank you for your help.

PS: When sending ${job.getZLiftDistance()} as you proposed, this will send the value 50 to my printer!!! i.e. it sends the liftingHeight (according to this slacer.json file). This is not what I would like.


We don’t know about anything in a zip of images file other than the images themselves. The printer will print using what is configured on the settings screen. Any additional files present in the zip file are ignored.

The slacer.json created by slacer.js is just a reference to what settings were in place at the time of slicing, however, Photonic3D will always print using the actual resolution and settings of the currently configured and started printer.


James is correct, we didn’t really have anything like that, but I liked the idea of printables contributing attributes to a printJob. You should be able to do this now:

This is only available in the dev version. Let me know if this works for you.


I don’t really understand what you mean or how to interpret your saying. I am currently extracting some useful information for driving my printer from the compressed SLAcer ZIP file and I thought it would be nice to have the variables in this slacer.json file available as parameters for driving any specific driver. That is my thought and my contribution. I would welcome some more non-CWS GCode Templates settings.

What I am sure about is that the ${LayerThickness} template variable doesn’t reflect the job layer thickness set in the slicer. Unless I did misunderstand the spirit of Photonic3D and how to use it.

I am willing to positively contribute to Photonic3D and not undermining its performance in any way.

Many thanks.


Hi Wes

I did try what you suggested and this seems to be accepted in these non-CWS GCode Templates settings. When testing it says:

I am wondering if it wouldn’t be a good idea to make the parameter values in the slacer.json file somehow available for driving specific printers.

I would be glad to help improving Photonic3D and please, let me know if I have to do some further testing for you.

Many thanks for your help.


Whoops. Try out:


Hi Wes

Here is what the test button under printer configuration says:

Of course, Photonic3D stops printing because of this message.



Notice how the quotes around layersHeight point in different directions? That’s not just a font difference, these editors are actually changing the characters in text to \u201c. You can’t just copy and paste from editors that attempt to modify and build smart quotes. You’ll need to copy the snippet and replace the quotes with normal quotes.



…and yes you will have a different problem when you press the “test” button, because there isn’t a printableFile available at the time that you pressed the button. To fix this, you will either need to dedicate this printer configuration to only printing files generated by slacer, or follow the directions given to you in the tip from the error:

Tip: If the failing expression is known to be legally refer to something that’s sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (!myDefault, ( ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${job.getContributions().getSettings(… [in template “${job.getContributions().getSettings().get(“layersHeight”)}” at line 1, column 1] ----