Browse Source

parsing method printer nozzles

CURA-11138
saumya.jain 1 year ago
parent
commit
1a139f44bc

+ 3 - 0
cura/Machines/Models/CompatibleMachineModel.py

@@ -51,6 +51,9 @@ class CompatibleMachineModel(ListModel):
         for output_device in machine_manager.printerOutputDevices:
             for printer in output_device.printers:
                 extruder_configs = dict()
+                # If the printer name already exist in the queue skip it
+                if printer.name in [item["name"] for item in self.items]:
+                    continue
 
                 # initialize & add current active material:
                 for extruder in printer.extruders:

+ 14 - 1
cura/PrinterOutput/Models/ExtruderConfigurationModel.py

@@ -40,9 +40,22 @@ class ExtruderConfigurationModel(QObject):
 
     def setHotendID(self, hotend_id: Optional[str]) -> None:
         if self._hotend_id != hotend_id:
-            self._hotend_id = hotend_id
+            self._hotend_id = ExtruderConfigurationModel.getHotendIdIfMakerbot(hotend_id)
             self.extruderConfigurationChanged.emit()
 
+    @staticmethod
+    def getHotendIdIfMakerbot(hotendId) -> str:
+        _EXTRUDER_NAME_MAP = {
+            "mk14_hot":"1XA",
+            "mk14_hot_s":"2XA",
+            "mk14_c":"1C",
+            "mk14":"1A",
+            "mk14_s":"2A"
+        }
+        if hotendId in _EXTRUDER_NAME_MAP:
+            return _EXTRUDER_NAME_MAP[hotendId]
+        return hotendId
+
     @pyqtProperty(str, fset = setHotendID, notify = extruderConfigurationChanged)
     def hotendID(self) -> Optional[str]:
         return self._hotend_id