mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-04 09:35:10 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
f50e78d9bb
@ -56,12 +56,15 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
|
|||||||
self._connection_state_before_timeout = None # type: Optional[ConnectionState]
|
self._connection_state_before_timeout = None # type: Optional[ConnectionState]
|
||||||
|
|
||||||
printer_type = self._properties.get(b"machine", b"").decode("utf-8")
|
printer_type = self._properties.get(b"machine", b"").decode("utf-8")
|
||||||
if printer_type.startswith("9511"):
|
printer_type_identifiers = {
|
||||||
self._printer_type = "ultimaker3_extended"
|
"9066": "ultimaker3",
|
||||||
elif printer_type.startswith("9066"):
|
"9511": "ultimaker3_extended"
|
||||||
self._printer_type = "ultimaker3"
|
}
|
||||||
else:
|
self._printer_type = "Unknown"
|
||||||
self._printer_type = "unknown"
|
for key, value in printer_type_identifiers.items():
|
||||||
|
if printer_type.startswith(key):
|
||||||
|
self._printer_type = value
|
||||||
|
break
|
||||||
|
|
||||||
def requestWrite(self, nodes, file_name=None, filter_by_machine=False, file_handler=None, **kwargs) -> None:
|
def requestWrite(self, nodes, file_name=None, filter_by_machine=False, file_handler=None, **kwargs) -> None:
|
||||||
raise NotImplementedError("requestWrite needs to be implemented")
|
raise NotImplementedError("requestWrite needs to be implemented")
|
||||||
|
@ -265,13 +265,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
for material_container_file in material_container_files:
|
for material_container_file in material_container_files:
|
||||||
container_id = self._stripFileToId(material_container_file)
|
container_id = self._stripFileToId(material_container_file)
|
||||||
|
|
||||||
from hashlib import sha1
|
|
||||||
hex_container_id = sha1(container_id.encode('utf-8')).hexdigest()
|
|
||||||
|
|
||||||
serialized = archive.open(material_container_file).read().decode("utf-8")
|
serialized = archive.open(material_container_file).read().decode("utf-8")
|
||||||
metadata_list = xml_material_profile.deserializeMetadata(serialized, hex_container_id)
|
metadata_list = xml_material_profile.deserializeMetadata(serialized, container_id)
|
||||||
reverse_map = {metadata["id"].replace(hex_container_id, container_id): container_id.replace(hex_container_id, container_id)
|
reverse_map = {metadata["id"]: container_id for metadata in metadata_list}
|
||||||
for metadata in metadata_list}
|
|
||||||
reverse_material_id_dict.update(reverse_map)
|
reverse_material_id_dict.update(reverse_map)
|
||||||
|
|
||||||
material_labels.append(self._getMaterialLabelFromSerialized(serialized))
|
material_labels.append(self._getMaterialLabelFromSerialized(serialized))
|
||||||
@ -754,15 +750,13 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
quality_changes_containers = self._container_registry.findInstanceContainers(name = quality_changes_name,
|
quality_changes_containers = self._container_registry.findInstanceContainers(name = quality_changes_name,
|
||||||
type = "quality_changes")
|
type = "quality_changes")
|
||||||
for container in quality_changes_containers:
|
for container in quality_changes_containers:
|
||||||
extruder_definition_id = container.getMetaDataEntry("extruder")
|
extruder_position = container.getMetaDataEntry("position")
|
||||||
if not extruder_definition_id:
|
if extruder_position is None:
|
||||||
quality_changes_info.global_info.container = container
|
quality_changes_info.global_info.container = container
|
||||||
else:
|
else:
|
||||||
extruder_definition_metadata = self._container_registry.findDefinitionContainersMetadata(id = extruder_definition_id)[0]
|
if extruder_position not in quality_changes_info.extruder_info_dict:
|
||||||
position = extruder_definition_metadata["position"]
|
quality_changes_info.extruder_info_dict[extruder_position] = ContainerInfo(None, None, None)
|
||||||
if position not in quality_changes_info.extruder_info_dict:
|
container_info = quality_changes_info.extruder_info_dict[extruder_position]
|
||||||
quality_changes_info.extruder_info_dict[position] = ContainerInfo(None, None, None)
|
|
||||||
container_info = quality_changes_info.extruder_info_dict[position]
|
|
||||||
container_info.container = container
|
container_info.container = container
|
||||||
|
|
||||||
# If there is no quality changes for any extruder, create one.
|
# If there is no quality changes for any extruder, create one.
|
||||||
|
@ -838,14 +838,10 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
if machine_compatibility:
|
if machine_compatibility:
|
||||||
new_material_id = container_id + "_" + machine_id
|
new_material_id = container_id + "_" + machine_id
|
||||||
|
|
||||||
# The child or derived material container may already exist. This can happen when a material in a
|
# Do not look for existing container/container metadata with the same ID although they may exist.
|
||||||
# project file and the a material in Cura have the same ID.
|
# In project loading and perhaps some other places, we only want to get information (metadata)
|
||||||
# In the case if a derived material already exists, override that material container because if
|
# from a file without changing the current state of the system. If we overwrite the existing
|
||||||
# the data in the parent material has been changed, the derived ones should be updated too.
|
# metadata here, deserializeMetadata() will not be safe for retrieving information.
|
||||||
found_materials = ContainerRegistry.getInstance().findInstanceContainersMetadata(id = new_material_id)
|
|
||||||
if found_materials:
|
|
||||||
new_material_metadata = found_materials[0]
|
|
||||||
else:
|
|
||||||
new_material_metadata = {}
|
new_material_metadata = {}
|
||||||
|
|
||||||
new_material_metadata.update(base_metadata)
|
new_material_metadata.update(base_metadata)
|
||||||
@ -854,7 +850,6 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
new_material_metadata["machine_manufacturer"] = machine_manufacturer
|
new_material_metadata["machine_manufacturer"] = machine_manufacturer
|
||||||
new_material_metadata["definition"] = machine_id
|
new_material_metadata["definition"] = machine_id
|
||||||
|
|
||||||
if len(found_materials) == 0: #This is a new material.
|
|
||||||
result_metadata.append(new_material_metadata)
|
result_metadata.append(new_material_metadata)
|
||||||
|
|
||||||
buildplates = machine.iterfind("./um:buildplate", cls.__namespaces)
|
buildplates = machine.iterfind("./um:buildplate", cls.__namespaces)
|
||||||
@ -866,12 +861,12 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
if buildplate_id is None:
|
if buildplate_id is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
variant_containers = ContainerRegistry.getInstance().findInstanceContainersMetadata(id = buildplate_id)
|
variant_metadata = ContainerRegistry.getInstance().findInstanceContainersMetadata(id = buildplate_id)
|
||||||
if not variant_containers:
|
if not variant_metadata:
|
||||||
# It is not really properly defined what "ID" is so also search for variants by name.
|
# It is not really properly defined what "ID" is so also search for variants by name.
|
||||||
variant_containers = ContainerRegistry.getInstance().findInstanceContainersMetadata(definition = machine_id, name = buildplate_id)
|
variant_metadata = ContainerRegistry.getInstance().findInstanceContainersMetadata(definition = machine_id, name = buildplate_id)
|
||||||
|
|
||||||
if not variant_containers:
|
if not variant_metadata:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
settings = buildplate.iterfind("./um:setting", cls.__namespaces)
|
settings = buildplate.iterfind("./um:setting", cls.__namespaces)
|
||||||
@ -900,11 +895,7 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
|
|
||||||
new_hotend_specific_material_id = container_id + "_" + machine_id + "_" + hotend_name.replace(" ", "_")
|
new_hotend_specific_material_id = container_id + "_" + machine_id + "_" + hotend_name.replace(" ", "_")
|
||||||
|
|
||||||
# Same as machine compatibility, keep the derived material containers consistent with the parent material
|
# Same as above, do not overwrite existing metadata.
|
||||||
found_materials = ContainerRegistry.getInstance().findInstanceContainersMetadata(id = new_hotend_specific_material_id)
|
|
||||||
if found_materials:
|
|
||||||
new_hotend_material_metadata = found_materials[0]
|
|
||||||
else:
|
|
||||||
new_hotend_material_metadata = {}
|
new_hotend_material_metadata = {}
|
||||||
|
|
||||||
new_hotend_material_metadata.update(base_metadata)
|
new_hotend_material_metadata.update(base_metadata)
|
||||||
@ -917,7 +908,6 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
new_hotend_material_metadata["buildplate_compatible"] = buildplate_map["buildplate_compatible"]
|
new_hotend_material_metadata["buildplate_compatible"] = buildplate_map["buildplate_compatible"]
|
||||||
new_hotend_material_metadata["buildplate_recommended"] = buildplate_map["buildplate_recommended"]
|
new_hotend_material_metadata["buildplate_recommended"] = buildplate_map["buildplate_recommended"]
|
||||||
|
|
||||||
if len(found_materials) == 0:
|
|
||||||
result_metadata.append(new_hotend_material_metadata)
|
result_metadata.append(new_hotend_material_metadata)
|
||||||
|
|
||||||
# there is only one ID for a machine. Once we have reached here, it means we have already found
|
# there is only one ID for a machine. Once we have reached here, it means we have already found
|
||||||
|
38
resources/definitions/printrbot_simple_makers_kit.def.json
Normal file
38
resources/definitions/printrbot_simple_makers_kit.def.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"name": "Printrbot Simple Maker's Kit (1405)",
|
||||||
|
"inherits": "fdmprinter",
|
||||||
|
"metadata": {
|
||||||
|
"visible": true,
|
||||||
|
"author": "Timur Tabi",
|
||||||
|
"manufacturer": "Printrbot",
|
||||||
|
"file_formats": "text/x-gcode"
|
||||||
|
},
|
||||||
|
|
||||||
|
"overrides": {
|
||||||
|
"machine_name": { "default_value": "Printrbot Simple Maker's Kit (1405)" },
|
||||||
|
"machine_heated_bed": { "default_value": false },
|
||||||
|
"machine_width": { "default_value": 100 },
|
||||||
|
"machine_depth": { "default_value": 100 },
|
||||||
|
"machine_height": { "default_value": 115 },
|
||||||
|
"material_diameter": { "default_value": 1.75 },
|
||||||
|
"machine_nozzle_size": { "default_value": 0.4 },
|
||||||
|
"machine_head_with_fans_polygon": {
|
||||||
|
"default_value": [
|
||||||
|
[-40, 1000],
|
||||||
|
[-40, -10],
|
||||||
|
[60, 1000],
|
||||||
|
[60, -10]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gantry_height": { "default_value": 1000 },
|
||||||
|
"machine_gcode_flavor": { "default_value": "RepRap (Marlin/Sprinter)" },
|
||||||
|
|
||||||
|
"machine_start_gcode": {
|
||||||
|
"default_value": "G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;home X/Y\nG28 Z0 ;home Z\nG92 E0 ;zero the extruded length\nG29 ;initiate auto bed leveling sequence"
|
||||||
|
},
|
||||||
|
"machine_end_gcode": {
|
||||||
|
"default_value": "M104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nM106 S0 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit\nG1 Z+1 E-5 F9000 ;move Z up a bit and retract even more\nG28 X0 Y0 ;home X/Y, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -347,7 +347,8 @@ Column
|
|||||||
id: materialSelection
|
id: materialSelection
|
||||||
|
|
||||||
property var activeExtruder: Cura.MachineManager.activeStack
|
property var activeExtruder: Cura.MachineManager.activeStack
|
||||||
property var currentRootMaterialName: activeExtruder.material.name
|
property var hasActiveExtruder: activeExtruder != null
|
||||||
|
property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : ""
|
||||||
|
|
||||||
text: currentRootMaterialName
|
text: currentRootMaterialName
|
||||||
tooltip: currentRootMaterialName
|
tooltip: currentRootMaterialName
|
||||||
@ -366,6 +367,10 @@ Column
|
|||||||
property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported
|
property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported
|
||||||
|
|
||||||
function isMaterialSupported () {
|
function isMaterialSupported () {
|
||||||
|
if (!hasActiveExtruder)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible") == "True"
|
return Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible") == "True"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ UM.Dialog
|
|||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: Cura.MachineManager.activeMachine.definition.name
|
text: (Cura.MachineManager.activeMachine == null) ? "" : Cura.MachineManager.activeMachine.definition.name
|
||||||
width: (parent.width / 3) | 0
|
width: (parent.width / 3) | 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user