mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Fix edge cases with ultimaker2 and whatever other machines that may get affected
CURA-4617
This commit is contained in:
parent
f0dca021d8
commit
6b3e130349
1 changed files with 27 additions and 14 deletions
|
@ -751,12 +751,15 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
if stack.definitionChanges == self._container_registry.getEmptyInstanceContainer():
|
if stack.definitionChanges == self._container_registry.getEmptyInstanceContainer():
|
||||||
stack.setDefinitionChanges(CuraStackBuilder.createDefinitionChangesContainer(stack, stack.getId() + "_settings"))
|
stack.setDefinitionChanges(CuraStackBuilder.createDefinitionChangesContainer(stack, stack.getId() + "_settings"))
|
||||||
|
|
||||||
extruder_stacks.append(stack)
|
if stack.getMetaDataEntry("type") == "extruder_train":
|
||||||
|
extruder_stacks.append(stack)
|
||||||
|
|
||||||
# If not extruder stacks were saved in the project file (pre 3.1) create one manually
|
# If not extruder stacks were saved in the project file (pre 3.1) create one manually
|
||||||
# We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this
|
# We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this
|
||||||
if not extruder_stacks:
|
if not extruder_stacks:
|
||||||
extruder_stacks.append(self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder"))
|
stack = self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder")
|
||||||
|
if stack:
|
||||||
|
extruder_stacks.append(stack)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
||||||
|
@ -801,24 +804,34 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
quality_containers = self._container_registry.findInstanceContainers(definition = global_stack.definition.getId(),
|
quality_containers = self._container_registry.findInstanceContainers(definition = global_stack.definition.getId(),
|
||||||
type = "quality",
|
type = "quality",
|
||||||
quality_type = quality_type)
|
quality_type = quality_type)
|
||||||
|
quality_containers = [q for q in quality_containers if q.getMetaDataEntry("material", "") == ""]
|
||||||
if quality_containers:
|
if quality_containers:
|
||||||
global_stack.quality = quality_containers[0]
|
global_stack.quality = quality_containers[0]
|
||||||
else:
|
else:
|
||||||
# the quality_type of the quality profile cannot be found.
|
# look for "fdmprinter" qualities if the machine-specific qualities cannot be found
|
||||||
# this can happen if a quality_type has been removed in a newer version, for example:
|
quality_containers = self._container_registry.findInstanceContainers(definition = "fdmprinter",
|
||||||
# "extra_coarse" is removed from 2.7 to 3.0
|
type = "quality",
|
||||||
# in this case, the quality will be reset to "normal"
|
quality_type = quality_type)
|
||||||
quality_containers = self._container_registry.findInstanceContainers(
|
quality_containers = [q for q in quality_containers if q.getMetaDataEntry("material", "") == ""]
|
||||||
definition = global_stack.definition.getId(),
|
|
||||||
type = "quality",
|
|
||||||
quality_type = "normal")
|
|
||||||
if quality_containers:
|
if quality_containers:
|
||||||
global_stack.quality = quality_containers[0]
|
global_stack.quality = quality_containers[0]
|
||||||
else:
|
else:
|
||||||
# This should not happen!
|
# the quality_type of the quality profile cannot be found.
|
||||||
Logger.log("e", "Cannot find quality normal for global stack [%s] [%s]",
|
# this can happen if a quality_type has been removed in a newer version, for example:
|
||||||
global_stack.getId(), global_stack.definition.getId())
|
# "extra_coarse" is removed from 2.7 to 3.0
|
||||||
global_stack.quality = self._container_registry.findInstanceContainers(id = "empty_quality")
|
# in this case, the quality will be reset to "normal"
|
||||||
|
quality_containers = self._container_registry.findInstanceContainers(
|
||||||
|
definition = global_stack.definition.getId(),
|
||||||
|
type = "quality",
|
||||||
|
quality_type = "normal")
|
||||||
|
quality_containers = [q for q in quality_containers if q.getMetaDataEntry("material", "") == ""]
|
||||||
|
if quality_containers:
|
||||||
|
global_stack.quality = quality_containers[0]
|
||||||
|
else:
|
||||||
|
# This should not happen!
|
||||||
|
Logger.log("e", "Cannot find quality normal for global stack [%s] [%s]",
|
||||||
|
global_stack.getId(), global_stack.definition.getId())
|
||||||
|
global_stack.quality = self._container_registry.findInstanceContainers(id = "empty_quality")[0]
|
||||||
|
|
||||||
# Replacing the old containers if resolve is "new".
|
# Replacing the old containers if resolve is "new".
|
||||||
# When resolve is "new", some containers will get renamed, so all the other containers that reference to those
|
# When resolve is "new", some containers will get renamed, so all the other containers that reference to those
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue