9 hours ago, ahoeben said:You don't have to implement anything in Python; Cura already handles inheritance for you. Define the "value" of "klipper_retract_speed" as "klipper_retraction_speed". The "value" is a string that gets evaluated by Python, and all registered settings are available as variables in that string. You can also set the value to "klipper_rectraction_speed * 1.05" to have the value 5% higher than that of the "main" setting.
Thank you Aldo, I don't think my question was very clear. If I understand correctly, I believe you're referring to the initial setting definition. My issue is that I've already defined the inheritance for such settings. In this example, the initial values are defined by Cura's retraction settings but I'm trying to change the inheritance in Python after the user modifies a value as described above.
"klipper_retraction_speed": {
"label": "Retraction Speed",
"description": "The speed in mm/s which...",
"type": "float",
"unit": "mm/s",
"default_value": 0,
"value": "retraction_speed",
"minimum_value": "0",
"minimum_value_warning": "5 if klipper_retract_speed >= 1 or klipper_retract_prime_speed >= 1 else 0",
"maximum_value_warning": "99",
"enabled": "resolveOrValue('machine_firmware_retract')",
"settable_per_mesh": false,
"settable_per_extruder": true,
"children": {
"klipper_retract_speed": {
"label": "Retract Speed",
"description": "The speed at which...",
"type": "float",
"unit": "mm/s",
"default_value": 0,
"value": "retraction_retract_speed",
"minimum_value": "0",
"minimum_value_warning": "5 if klipper_retract_speed >= 1 else 0",
"maximum_value_warning": "99",
"enabled": "resolveOrValue('machine_firmware_retract')",
"settable_per_mesh": false,
"settable_per_extruder": true
},
So my question is, is there way to easily adjust the value in Python so it's recognized as an expression or is this simply too unorthodox? If there is, there are a few other situations where I'd like to implement this as well.
For reference, here is the repo for the plugin I'm working on.
I truly appreciate the help!
Recommended Posts
ahoeben 2,014
You don't have to implement anything in Python; Cura already handles inheritance for you. Define the "value" of "klipper_retract_speed" as "klipper_retraction_speed". The "value" is a string that gets evaluated by Python, and all registered settings are available as variables in that string. You can also set the value to "klipper_rectraction_speed * 1.05" to have the value 5% higher than that of the "main" setting.
Link to post
Share on other sites