The variant name is not injected in the variables that you can use. In addition to that, the "maximum_value_warning" in your snippet is missing an "if".
I have given this some thought. What you could do (but it is not officially supported, so it might break in some future version of Cura) is define a new value in your machine definition:
"_material_print_temperature_maximum_value": {
"label": "Maximum Printing Temperature",
"description": "This is a private setting, please ignore",
"type": "float",
"default_value": 230,
"enabled": false,
"settable_per_extruder": true
},
"material_print_temperature": {
"minimum_value": "0",
"maximum_value_warning": "_material_print_temperature_maximum_value - 5",
"maximum_value": "_material_print_temperature_maximum_value"
},
This adds a new, "private" setting to your machine type only, which can not be made visible in the settings panel.
Then in your PTFE variant, you can just define a value for that setting (the other variants will use the default specified 230):
[values]
_material_print_temperature_maximum_value = 300
Edited by ahoeben
- 1
Recommended Posts
ahoeben 1,986
You cannot do that via a variant file. The cfg files can only have values; for the definition of a setting, you need to use the .def.json. You could use a Python expression in your printer or extruder definition like this:
"default_material_print_temperature": { "minimum_value_warning": "0", "maximum_value_warning": "230", "maximum_value": "300 if machine_nozzle_size == 0.4 else 235", "minimum_value": "0" }
Ofcourse you'll most likely want to use something else than the machine_nozzle_size to detect this particular variant.
Link to post
Share on other sites
schpongo 1
Thanks for the answer.
I like the approach, but I would need to be able to get the current variant name in the definition file.
I'm not sure how much python code I can actually use but I'm thinking of something like this:
"material_print_temperature": { "minimum_value": "0", "minimum_value_warning": "0", "maximum_value_warning": "230 variant_name.find('PTFE') > 0 else 300", "maximum_value": "235 if variant_name.find('PTFE') > 0 else 300" },
But this doesn't work, I guess because the variable "variant_name" doesn't exit.
Does anyone have any input on this?
Greetings
Daniel
Link to post
Share on other sites