ghostkeeper 105
It's not currently possible, or at least not easily.
We expose all settings through the bracket syntax in the start and end g-code, but nothing other than those settings except the current date and time. Those are the only thing you can use when typing start/end g-code in the interface with the Machine Settings menu. See here for the source code that handles the bracket syntax: https://github.com/Ultimaker/Cura/blob/6a053a9f46c56a94cfaf611cb55376b4d0ad09d1/plugins/CuraEngineBackend/StartSliceJob.py#L270-L285
When you're writing a definition file (.def.json) a few more things will be possible if you specify the "value" property instead of "default_value". The "value" property can be any arbitrary Python expression, so you could make calculations like "G29 P" + str(int(machine_width / 25)) or something, and all the setting names have already been filled in as variables. There are other (hidden) functions available then as well, for instance extruderValues(setting_name) which gets a list of all values for a setting for each extruder. But there is nothing there either that can get the size of the print.
Warning: I'm getting gradually more technical here...
There is a vulnerability of sorts that allows you to devise a setting value that escapes the sandboxed environment in which the setting expressions are evaluated, and you can obtain data from the internals of Cura this way, including the dimensions and positions of the models. I won't disclose it here. But doing this will have problems with updating the setting value if the build volume changes, so it's not going to work reliably.
Also for the purpose of bed levelling you'd probably want to know the size of the final print rather than the size of the input models. The actual print can be quite different due to brims, rafts and horizontal expansion (of model and/or support). Most of these can be predicted beforehand (you know the desired brim width and such). Some of them can't though, for instance if you have conical support enabled. In those cases it is really impossible to get the dimensions of the print before slicing has completed.
I'll shoot in a feature request ticket to add the size of the input models as a key replacement for the bracket syntax. No promises, of course. Our backlog is long.
https://github.com/Ultimaker/Cura/blob/6a053a9f46c56a94cfaf611cb55376b4d0ad09d1/plugins/CuraEngineBackend/StartSliceJob.py#L275Edited by ghostkeeper
Saying that I'll make a feature request.
Recommended Posts
gr5 2,294
@ghostkeeper probably knows the answer to this one.
Link to post
Share on other sites