mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 11:47:50 -06:00
Add missing typing
This commit is contained in:
parent
67f10d8bc3
commit
efc6ef2905
1 changed files with 13 additions and 9 deletions
|
@ -908,9 +908,12 @@ class BuildVolume(SceneNode):
|
||||||
# for.
|
# for.
|
||||||
# \return A dictionary with for each used extruder ID the disallowed areas
|
# \return A dictionary with for each used extruder ID the disallowed areas
|
||||||
# where that extruder may not print.
|
# where that extruder may not print.
|
||||||
def _computeDisallowedAreasStatic(self, border_size, used_extruders):
|
def _computeDisallowedAreasStatic(self, border_size:float, used_extruders: List["ExtruderStack"]) -> Dict[str, List[Polygon]]:
|
||||||
#Convert disallowed areas to polygons and dilate them.
|
# Convert disallowed areas to polygons and dilate them.
|
||||||
machine_disallowed_polygons = []
|
machine_disallowed_polygons = []
|
||||||
|
if self._global_container_stack is None:
|
||||||
|
return {}
|
||||||
|
|
||||||
for area in self._global_container_stack.getProperty("machine_disallowed_areas", "value"):
|
for area in self._global_container_stack.getProperty("machine_disallowed_areas", "value"):
|
||||||
polygon = Polygon(numpy.array(area, numpy.float32))
|
polygon = Polygon(numpy.array(area, numpy.float32))
|
||||||
polygon = polygon.getMinkowskiHull(Polygon.approximatedCircle(border_size))
|
polygon = polygon.getMinkowskiHull(Polygon.approximatedCircle(border_size))
|
||||||
|
@ -921,7 +924,7 @@ class BuildVolume(SceneNode):
|
||||||
nozzle_offsetting_for_disallowed_areas = self._global_container_stack.getMetaDataEntry(
|
nozzle_offsetting_for_disallowed_areas = self._global_container_stack.getMetaDataEntry(
|
||||||
"nozzle_offsetting_for_disallowed_areas", True)
|
"nozzle_offsetting_for_disallowed_areas", True)
|
||||||
|
|
||||||
result = {}
|
result = {} # type: Dict[str, List[Polygon]]
|
||||||
for extruder in used_extruders:
|
for extruder in used_extruders:
|
||||||
extruder_id = extruder.getId()
|
extruder_id = extruder.getId()
|
||||||
offset_x = extruder.getProperty("machine_nozzle_offset_x", "value")
|
offset_x = extruder.getProperty("machine_nozzle_offset_x", "value")
|
||||||
|
@ -930,13 +933,13 @@ class BuildVolume(SceneNode):
|
||||||
offset_y = extruder.getProperty("machine_nozzle_offset_y", "value")
|
offset_y = extruder.getProperty("machine_nozzle_offset_y", "value")
|
||||||
if offset_y is None:
|
if offset_y is None:
|
||||||
offset_y = 0
|
offset_y = 0
|
||||||
offset_y = -offset_y #Y direction of g-code is the inverse of Y direction of Cura's scene space.
|
offset_y = -offset_y # Y direction of g-code is the inverse of Y direction of Cura's scene space.
|
||||||
result[extruder_id] = []
|
result[extruder_id] = []
|
||||||
|
|
||||||
for polygon in machine_disallowed_polygons:
|
for polygon in machine_disallowed_polygons:
|
||||||
result[extruder_id].append(polygon.translate(offset_x, offset_y)) #Compensate for the nozzle offset of this extruder.
|
result[extruder_id].append(polygon.translate(offset_x, offset_y)) # Compensate for the nozzle offset of this extruder.
|
||||||
|
|
||||||
#Add the border around the edge of the build volume.
|
# Add the border around the edge of the build volume.
|
||||||
left_unreachable_border = 0
|
left_unreachable_border = 0
|
||||||
right_unreachable_border = 0
|
right_unreachable_border = 0
|
||||||
top_unreachable_border = 0
|
top_unreachable_border = 0
|
||||||
|
@ -944,7 +947,8 @@ class BuildVolume(SceneNode):
|
||||||
|
|
||||||
# Only do nozzle offsetting if needed
|
# Only do nozzle offsetting if needed
|
||||||
if nozzle_offsetting_for_disallowed_areas:
|
if nozzle_offsetting_for_disallowed_areas:
|
||||||
#The build volume is defined as the union of the area that all extruders can reach, so we need to know the relative offset to all extruders.
|
# The build volume is defined as the union of the area that all extruders can reach, so we need to know
|
||||||
|
# the relative offset to all extruders.
|
||||||
for other_extruder in ExtruderManager.getInstance().getActiveExtruderStacks():
|
for other_extruder in ExtruderManager.getInstance().getActiveExtruderStacks():
|
||||||
other_offset_x = other_extruder.getProperty("machine_nozzle_offset_x", "value")
|
other_offset_x = other_extruder.getProperty("machine_nozzle_offset_x", "value")
|
||||||
if other_offset_x is None:
|
if other_offset_x is None:
|
||||||
|
@ -1028,8 +1032,8 @@ class BuildVolume(SceneNode):
|
||||||
[ half_machine_width - border_size, 0]
|
[ half_machine_width - border_size, 0]
|
||||||
], numpy.float32)))
|
], numpy.float32)))
|
||||||
result[extruder_id].append(Polygon(numpy.array([
|
result[extruder_id].append(Polygon(numpy.array([
|
||||||
[ half_machine_width,-half_machine_depth],
|
[ half_machine_width, -half_machine_depth],
|
||||||
[-half_machine_width,-half_machine_depth],
|
[-half_machine_width, -half_machine_depth],
|
||||||
[ 0, -half_machine_depth + border_size]
|
[ 0, -half_machine_depth + border_size]
|
||||||
], numpy.float32)))
|
], numpy.float32)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue