mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 15:35:54 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
75a0604871
@ -111,7 +111,7 @@ class CuraApplication(QtApplication):
|
||||
self._i18n_catalog = None
|
||||
self._previous_active_tool = None
|
||||
self._platform_activity = False
|
||||
self._scene_boundingbox = AxisAlignedBox()
|
||||
self._scene_bounding_box = AxisAlignedBox()
|
||||
self._job_name = None
|
||||
self._center_after_select = False
|
||||
self._camera_animation = None
|
||||
@ -389,26 +389,26 @@ class CuraApplication(QtApplication):
|
||||
|
||||
@pyqtProperty(str, notify = sceneBoundingBoxChanged)
|
||||
def getSceneBoundingBoxString(self):
|
||||
return self._i18n_catalog.i18nc("@info", "%(width).1f x %(depth).1f x %(height).1f mm") % {'width' : self._scene_boundingbox.width.item(), 'depth': self._scene_boundingbox.depth.item(), 'height' : self._scene_boundingbox.height.item()}
|
||||
return self._i18n_catalog.i18nc("@info", "%(width).1f x %(depth).1f x %(height).1f mm") % {'width' : self._scene_bounding_box.width.item(), 'depth': self._scene_bounding_box.depth.item(), 'height' : self._scene_bounding_box.height.item()}
|
||||
|
||||
def updatePlatformActivity(self, node = None):
|
||||
count = 0
|
||||
scene_boundingbox = None
|
||||
scene_bounding_box = None
|
||||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||
if type(node) is not SceneNode or not node.getMeshData():
|
||||
continue
|
||||
|
||||
count += 1
|
||||
if not scene_boundingbox:
|
||||
scene_boundingbox = copy.deepcopy(node.getBoundingBox())
|
||||
if not scene_bounding_box:
|
||||
scene_bounding_box = copy.deepcopy(node.getBoundingBox())
|
||||
else:
|
||||
scene_boundingbox += node.getBoundingBox()
|
||||
scene_bounding_box += node.getBoundingBox()
|
||||
|
||||
if not scene_boundingbox:
|
||||
scene_boundingbox = AxisAlignedBox()
|
||||
if not scene_bounding_box:
|
||||
scene_bounding_box = AxisAlignedBox()
|
||||
|
||||
if repr(self._scene_boundingbox) != repr(scene_boundingbox):
|
||||
self._scene_boundingbox = scene_boundingbox
|
||||
if repr(self._scene_bounding_box) != repr(scene_bounding_box):
|
||||
self._scene_bounding_box = scene_bounding_box
|
||||
self.sceneBoundingBoxChanged.emit()
|
||||
|
||||
self._platform_activity = True if count > 0 else False
|
||||
|
@ -5,6 +5,8 @@ from UM.Preferences import Preferences
|
||||
|
||||
import UM.Settings
|
||||
|
||||
import re
|
||||
|
||||
class MachineManagerModel(QObject):
|
||||
def __init__(self, parent = None):
|
||||
super().__init__(parent)
|
||||
@ -64,6 +66,7 @@ class MachineManagerModel(QObject):
|
||||
definitions = UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id=definition_id)
|
||||
if definitions:
|
||||
definition = definitions[0]
|
||||
name = self._uniqueMachineName(name, definition.getName())
|
||||
|
||||
new_global_stack = UM.Settings.ContainerStack(name)
|
||||
new_global_stack.addMetaDataEntry("type", "machine")
|
||||
@ -127,6 +130,25 @@ class MachineManagerModel(QObject):
|
||||
|
||||
Application.getInstance().setGlobalContainerStack(new_global_stack)
|
||||
|
||||
# Create a name that is not empty and unique
|
||||
def _uniqueMachineName(self, name, fallback_name):
|
||||
name = name.strip()
|
||||
num_check = re.compile("(.*?)\s*#\d$").match(name)
|
||||
if(num_check):
|
||||
name = num_check.group(1)
|
||||
if name == "":
|
||||
name = fallback_name
|
||||
unique_name = name
|
||||
i = 1
|
||||
|
||||
#Check both the id and the name, because they may not be the same and it is better if they are both unique
|
||||
while UM.Settings.ContainerRegistry.getInstance().findContainers(None, id = unique_name) or \
|
||||
UM.Settings.ContainerRegistry.getInstance().findContainers(None, name = unique_name):
|
||||
i = i + 1
|
||||
unique_name = "%s #%d" % (name, i)
|
||||
|
||||
return unique_name
|
||||
|
||||
@pyqtProperty(str, notify = globalContainerChanged)
|
||||
def activeMachineName(self):
|
||||
if self._global_container_stack:
|
||||
@ -239,6 +261,7 @@ class MachineManagerModel(QObject):
|
||||
def renameMachine(self, machine_id, new_name):
|
||||
containers = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
||||
if containers:
|
||||
new_name = self._uniqueMachineName(new_name, containers[0].getBottom().getName())
|
||||
containers[0].setName(new_name)
|
||||
|
||||
@pyqtSlot(str)
|
||||
|
119
resources/definitions/fdmextruder.def.json
Normal file
119
resources/definitions/fdmextruder.def.json
Normal file
@ -0,0 +1,119 @@
|
||||
{
|
||||
"id": "fdmextruder",
|
||||
"name": "Extruder",
|
||||
"version": 2,
|
||||
"metadata":
|
||||
{
|
||||
"type": "extruder",
|
||||
"author": "Ultimaker B.V.",
|
||||
"manufacturer": "Ultimaker",
|
||||
"visible": false
|
||||
},
|
||||
"settings":
|
||||
{
|
||||
"machine_settings":
|
||||
{
|
||||
"label": "Machine",
|
||||
"type": "category",
|
||||
"description": "Machine specific settings",
|
||||
"children":
|
||||
{
|
||||
"extruder_nr":
|
||||
{
|
||||
"label": "Extruder",
|
||||
"description": "The extruder train used for printing. This is used in multi-extrusion.",
|
||||
"type": "int",
|
||||
"default_value": 0,
|
||||
"minimum_value": "0",
|
||||
"maximum_value": "machine_extruder_count - 1"
|
||||
},
|
||||
"machine_nozzle_offset_x":
|
||||
{
|
||||
"label": "Nozzle X Offset",
|
||||
"description": "The x-coordinate of the offset of the nozzle.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_nozzle_offset_y":
|
||||
{
|
||||
"label": "Nozzle Y Offset",
|
||||
"description": "The y-coordinate of the offset of the nozzle.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_start_code":
|
||||
{
|
||||
"label": "Extruder Start G-Code",
|
||||
"description": "Start g-code to execute whenever turning the extruder on.",
|
||||
"type": "str",
|
||||
"default_value": "",
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_start_pos_abs":
|
||||
{
|
||||
"label": "Extruder Start Position Absolute",
|
||||
"description": "Make the extruder starting position absolute rather than relative to the last-known location of the head.",
|
||||
"type": "bool",
|
||||
"default_value": false,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_start_pos_x":
|
||||
{
|
||||
"label": "Extruder Start Position X",
|
||||
"description": "The x-coordinate of the starting position when turning the extruder on.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_start_pos_y":
|
||||
{
|
||||
"label": "Extruder Start Position Y",
|
||||
"description": "The y-coordinate of the starting position when turning the extruder on.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_end_code":
|
||||
{
|
||||
"label": "Extruder End G-Code",
|
||||
"description": "End g-code to execute whenever turning the extruder off.",
|
||||
"type": "str",
|
||||
"default_value": "",
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_end_pos_abs":
|
||||
{
|
||||
"label": "Extruder End Position Absolute",
|
||||
"description": "Make the extruder ending position absolute rather than relative to the last-known location of the head.",
|
||||
"type": "bool",
|
||||
"default_value": false,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_end_pos_x":
|
||||
{
|
||||
"label": "Extruder End Position X",
|
||||
"description": "The x-coordinate of the ending position when turning the extruder off.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_end_pos_y":
|
||||
{
|
||||
"label": "Extruder End Position Y",
|
||||
"description": "The y-coordinate of the ending position when turning the extruder off.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
"version": 2,
|
||||
"metadata":
|
||||
{
|
||||
"type": "machine",
|
||||
"author": "Ultimaker B.V.",
|
||||
"category": "Ultimaker",
|
||||
"manufacturer": "Ultimaker",
|
||||
@ -12,6 +13,10 @@
|
||||
"preferred_material": "pla",
|
||||
"preferred_quality": "normal"
|
||||
},
|
||||
"machine_extruder_trains":
|
||||
{
|
||||
"0": "fdmextruder"
|
||||
},
|
||||
"settings":
|
||||
{
|
||||
"machine_settings":
|
||||
@ -242,92 +247,6 @@
|
||||
"minimum_value": "0.001",
|
||||
"maximum_value_warning": "10"
|
||||
},
|
||||
"machine_nozzle_offset_x":
|
||||
{
|
||||
"label": "Nozzle X Offset",
|
||||
"description": "The x-coordinate of the offset of the nozzle.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_nozzle_offset_y":
|
||||
{
|
||||
"label": "Nozzle Y Offset",
|
||||
"description": "The y-coordinate of the offset of the nozzle.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_start_code":
|
||||
{
|
||||
"label": "Extruder Start G-Code",
|
||||
"description": "Start g-code to execute whenever turning the extruder on.",
|
||||
"type": "str",
|
||||
"default_value": "",
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_start_pos_abs":
|
||||
{
|
||||
"label": "Extruder Start Position Absolute",
|
||||
"description": "Make the extruder starting position absolute rather than relative to the last-known location of the head.",
|
||||
"type": "bool",
|
||||
"default_value": false,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_start_pos_x":
|
||||
{
|
||||
"label": "Extruder Start Position X",
|
||||
"description": "The x-coordinate of the starting position when turning the extruder on.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_start_pos_y":
|
||||
{
|
||||
"label": "Extruder Start Position Y",
|
||||
"description": "The y-coordinate of the starting position when turning the extruder on.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_end_code":
|
||||
{
|
||||
"label": "Extruder End G-Code",
|
||||
"description": "End g-code to execute whenever turning the extruder off.",
|
||||
"type": "str",
|
||||
"default_value": "",
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_end_pos_abs":
|
||||
{
|
||||
"label": "Extruder End Position Absolute",
|
||||
"description": "Make the extruder ending position absolute rather than relative to the last-known location of the head.",
|
||||
"type": "bool",
|
||||
"default_value": false,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_end_pos_x":
|
||||
{
|
||||
"label": "Extruder End Position X",
|
||||
"description": "The x-coordinate of the ending position when turning the extruder off.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_extruder_end_pos_y":
|
||||
{
|
||||
"label": "Extruder End Position Y",
|
||||
"description": "The y-coordinate of the ending position when turning the extruder off.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0,
|
||||
"global_only": "True"
|
||||
},
|
||||
"machine_use_extruder_offset_to_offset_coords":
|
||||
{
|
||||
"label": "Offset With Extruder",
|
||||
@ -2201,15 +2120,6 @@
|
||||
"description": "Settings used for printing with multiple extruders.",
|
||||
"children":
|
||||
{
|
||||
"extruder_nr":
|
||||
{
|
||||
"label": "Extruder",
|
||||
"description": "The extruder train used for printing. This is used in multi-extrusion.",
|
||||
"type": "int",
|
||||
"default_value": 0,
|
||||
"minimum_value": "0",
|
||||
"maximum_value": "machine_extruder_count - 1"
|
||||
},
|
||||
"adhesion_extruder_nr":
|
||||
{
|
||||
"label": "Platform Adhesion Extruder",
|
||||
|
Loading…
x
Reference in New Issue
Block a user