mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Expose approximateMaterialDiameter of the definition
This way we can request that from QML. Contributes to issue CURA-2822.
This commit is contained in:
parent
503aa00137
commit
fc96dfec4e
2 changed files with 37 additions and 0 deletions
|
@ -107,6 +107,21 @@ class GlobalStack(CuraContainerStack):
|
|||
def setNextStack(self, next_stack: ContainerStack) -> None:
|
||||
raise Exceptions.InvalidOperationError("Global stack cannot have a next stack!")
|
||||
|
||||
## Gets the approximate filament diameter that the machine requires.
|
||||
#
|
||||
# The approximate material diameter is the material diameter rounded to
|
||||
# the nearest millimetre.
|
||||
#
|
||||
# If the machine has no requirement for the diameter, -1 is returned.
|
||||
#
|
||||
# \return The approximate filament diameter for the printer, as a string.
|
||||
@pyqtProperty(str)
|
||||
def approximateMaterialDiameter(self) -> str:
|
||||
material_diameter = self.definition.getMetaDataEntry("material_diameter")
|
||||
if material_diameter is None:
|
||||
return "-1"
|
||||
return str(round(float(self.definition.getMetaDataEntry("material_diameter")))) #Round, then convert back to string.
|
||||
|
||||
# protected:
|
||||
|
||||
# Determine whether or not we should try to get the "resolve" property instead of the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue