Skip to content

Profiles & Settings

Jaime van Kessel edited this page Feb 10, 2022 · 10 revisions

Cura uses a stacked profile system. A schematic overview of this can be seen in the image below.

Settings

Each of the entries in the stack (eg; User, Quality, Material, etc) describes a profile. When we want to find out how much infill percentage should be used ("infill_sparse_density"), we simply ask the extruder stack what value it has. The extruder stack will then ask each of the profiles that it has (in sequence) if they have a value for the requested setting. The first profile to give an answer will define what the result is.

A slightly more complicated situation occurs when the value of a setting is defined by a function. Let's take the following example into consideration. We have a setting "foo" which value is defined by the formula "=bar / 2". This is defined in the quality profile of the left extruder. The value of "bar" is defined in the material only and is set to 50.

When we ask for the value of "foo", we expect to get 25 as a result. The following calls will be made in order:

  1. extruder_stack.getProperty("foo", "value")
  2. user.getProperty("foo", "value") -> Returns None
  3. quality_changes.getProperty("foo", "value") -> Returns None
  4. intent.getProperty("foo", "value") -> Returns None
  5. quality.getProperty("foo", "value") -> Returns "=bar/2"
  6. user.getProperty("bar", "value") -> returns None
  7. quality_changes.getProperty("bar", "value) -> Returns None
  8. intent.getProperty("bar", "value) -> Returns None
  9. quality.getProperty("bar", "value) -> Returns None
  10. material.getProperty("bar", "value) -> Returns 50

Profiles

The profiles have some interdependency with one other, as can be seen in the picture below.

User

The user settings are all changes that are not stored to any profile. In the interface, a circular reset icon is shown for each of these settings. They are completely independant of the quality, quality_changes or intent. They are only "tied" to a machine.

Quality Changes

Quality changes contain the settings that the user changed and stored to a profile. As such, a single profile generated by a user contains at least 2 files (one quality_change for the extruder and one for the global stack). The quality changes are only tied to the quality_type, since they describe a "delta" to be applied over a quality. So even if a quality changes because a material changes, the quality changes profile could stay the same (since it's only link, the quality_type remained the same)

Intent

Intent profiles contain settings that modify the quality by giving them an intent (eg: "Engineering" or "Smooth").). These profiles depend on the material, variant and quality_type

Quality

Quality profiles hold the resolution of the print by setting the layer height. Since all extruders must have the same layer height, this value is set in the global_stack part of the quality.

Material

Hold all the settings as defined by the active material.

Variant

The variant, in case of the extruder, hold settings that have to do with nozzle size or specific settings that relate to this.

Definition changes

If a user makes changes to a certain machine, but not to such a degree that it should be considered an entirely new type of machines, the settings are stored here.

Definition

The machine default settings.

Code

All of this logic is handled by a number of classes. This section will explain how these work together. Make sure that you understand the previous sections before continuing on with this. If you're not planning to write python code / create custom plugins, it's likely that you won't need to read this.

ContainerStack

A container stack is the basic "stack" concept. As the name implies, it's a stack of containers (InstanceContainer, DefinitionContainer, etc). As a rule of thumb, the bottom container in the stack is a DefinitionContainer and the stacks above it are InstanceContainers. This ensures that if no InstanceContainer overrides a value that the default value as set by the definition is used.

ExtruderStack

The extruder stack is a specialised ContainerStack that represents a single extruder. It always has a GlobalStack set as it's next stack.

GlobalStack

The GlobalStack is a specialized Containerstack that represents the basic / global settings of a machine / printer.

InstanceContainer

An instance container is an unsorted set of SettingInstance objects that together form a profile. Looking at the image at the top of the page, you can see a number of InstanceContainer. "User", "quality_changes", etc; All of these are instance containers. These will be serialized (stored) to .inst.cfg files. Instance containers can only change the "value" of a given setting instance!

DefinitionContainer

An DefinitionContainer is an unsorted set of SettingDefinition objects that together form a the definition of an Extruder or a Printer. In order to define a single 3D printer, you will need two of these profiles (one to be used in the ExtruderStack and one to be used in the GlobalStack). Note that settings that are defined in the setting definition of an extruder should not be defined in the global definition; If the value of a property is asked of the ExtruderStack and it exists in it's SettingDefinition, it will never continue asking the next stack. Setting definitions can define a number of properties, including value, warning values, types of the setting, etc.

Clone this wiki locally