Jump to content
Ultimaker Community of 3D Printing Experts

Change "maximum_value_warning" via variants file


Recommended Posts

Posted · Change "maximum_value_warning" via variants file

Hey, 

 

I have a printer with one extruder and two different hotends. One of them is an all metal hotend which supports temperatures of up top 300°C. The second hotend is a PTFE lined one which only supports temperatures of up to 245°C. In my printer definition file I've set:

"default_material_print_temperature": {
	"minimum_value_warning": "0",
	"maximum_value_warning": "230",
	"maximum_value": "235",
	"minimum_value": "0"
}

Now I would like the variants file for the all metal hotend to change the warning and min/max values. But since the variants file has a different format I'm not sure how to do that. I've tried:

[values]
machine_nozzle_size = 0.4
material_print_temperature_maximum_value = 300 

but this didn't work. 
How would I go about achieving this?

Greetings 
Daniel

  • Link to post
    Share on other sites
    Posted · Change "maximum_value_warning" via variants file

    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.

    • Like 2
    Link to post
    Share on other sites
    Posted · Change "maximum_value_warning" via variants file
    On 3/4/2020 at 3:05 PM, ahoeben said:

    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.

     

    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
    Posted (edited) · Change "maximum_value_warning" via variants file

    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
    • Like 1
    Link to post
    Share on other sites
    • 3 weeks later...
    Posted · Change "maximum_value_warning" via variants file

    Hey thanks for the answer! I'm sorry that it took me so long to reply. 

    I tried what you suggested but didn't have any luck. It seems like I can't define new values in cura. Did you try you code?
     

  • Link to post
    Share on other sites
    Posted · Change "maximum_value_warning" via variants file

    I tried my code, but only with a different printer definition (the Ultimaker Original) because I don't have a complete definition for the FunMat printer.

  • Link to post
    Share on other sites
    Posted · Change "maximum_value_warning" via variants file
    On 3/27/2020 at 7:23 PM, ahoeben said:

    I tried my code, but only with a different printer definition (the Ultimaker Original) because I don't have a complete definition for the FunMat printer.

     

    I've spent some more time trying to accomplish this, but so far I've been unsuccessful. I used your example and copy pasted it into the "overrides":{...} section of my definition. I did not add anything to my variants file because I wanted to check if this worked before. But what you suggested simply does not work for me. The "Printing temperature" is always marked red (see image). So I tried adjusting you code. I add and removed the following fields:
    - "unit": "°C",
    - "type": "float",
    - "value": 210,
    - "enabled": true,
    - "settable_per_extruder": true,
    - "settable_per_mesh": false,

    I also tried moving the definition of "_material_print_temperature_maximum_value" to the "metadata": {...} section or creating my own section before or in "overrides": {...} named "own_values": {...}  which then contained the definition of "_material_print_temperature_maximum_value". But this all didn't work. I also tried using "_material_print_temperature_maximum_value" in other places (e.g. "material_print_temperature_layer_0") as the actual value and not just to calculate the warning. This lead to the values turning to zero (disabled?). Last I copied your code into the definition file from the original Ultimaker: 
     

    "overrides": {
    	"_material_print_temperature_maximum_value": {
    	"label": "Maximum Printing Temperature",
    	"description": "This is a private setting, please ignore",
    	"type": "float",
    	"default_value": 222,
    	"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" 
    },

    But this also leads to the "Printing Temperature" being marked red (see image). 

    To me it seems my definition of the new value is not working as I also can't use it as a value for other predefined definitions.
     

    Screenshot 2020-03-30 at 17.05.49.png

  • Link to post
    Share on other sites
    Posted · Change "maximum_value_warning" via variants file

    Sorry, the definition for the private "_material_print_temperature_maximum_value" setting must be in a "settings" section, like so:

    "settings": {
    	"material": {
    		"children": {
    			"_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
    			}
    		}
    	}
    },
    "overrides": {
    	"material_print_temperature": {
    		"minimum_value": "0",
    		"maximum_value_warning": "_material_print_temperature_maximum_value - 5",
    		"maximum_value": "_material_print_temperature_maximum_value" 
    	},
    	...
    }

     

    • Like 1
    Link to post
    Share on other sites
    Posted · Change "maximum_value_warning" via variants file

    Thanks, that works like a charm!!!

    • Like 1
    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • Create New...