mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Create disallowed areas for polar printers
This commit is contained in:
parent
70bc8d8889
commit
31ca80d407
1 changed files with 73 additions and 28 deletions
|
@ -22,6 +22,7 @@ catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
import copy
|
import copy
|
||||||
|
import math
|
||||||
|
|
||||||
import UM.Settings.ContainerRegistry
|
import UM.Settings.ContainerRegistry
|
||||||
|
|
||||||
|
@ -607,34 +608,78 @@ class BuildVolume(SceneNode):
|
||||||
bottom_unreachable_border = max(bottom_unreachable_border, other_offset_y - offset_y)
|
bottom_unreachable_border = max(bottom_unreachable_border, other_offset_y - offset_y)
|
||||||
half_machine_width = self._global_container_stack.getProperty("machine_width", "value") / 2
|
half_machine_width = self._global_container_stack.getProperty("machine_width", "value") / 2
|
||||||
half_machine_depth = self._global_container_stack.getProperty("machine_depth", "value") / 2
|
half_machine_depth = self._global_container_stack.getProperty("machine_depth", "value") / 2
|
||||||
if border_size - left_unreachable_border > 0:
|
if self._shape.lower() != "elliptic":
|
||||||
result[extruder_id].append(Polygon(numpy.array([
|
if border_size - left_unreachable_border > 0:
|
||||||
[-half_machine_width, -half_machine_depth],
|
result[extruder_id].append(Polygon(numpy.array([
|
||||||
[-half_machine_width, half_machine_depth],
|
[-half_machine_width, -half_machine_depth],
|
||||||
[-half_machine_width + border_size - left_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border],
|
[-half_machine_width, half_machine_depth],
|
||||||
[-half_machine_width + border_size - left_unreachable_border, -half_machine_depth + border_size - top_unreachable_border]
|
[-half_machine_width + border_size - left_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border],
|
||||||
], numpy.float32)))
|
[-half_machine_width + border_size - left_unreachable_border, -half_machine_depth + border_size - top_unreachable_border]
|
||||||
if border_size + right_unreachable_border > 0:
|
], numpy.float32)))
|
||||||
result[extruder_id].append(Polygon(numpy.array([
|
if border_size + right_unreachable_border > 0:
|
||||||
[half_machine_width, half_machine_depth],
|
result[extruder_id].append(Polygon(numpy.array([
|
||||||
[half_machine_width, -half_machine_depth],
|
[half_machine_width, half_machine_depth],
|
||||||
[half_machine_width - border_size - right_unreachable_border, -half_machine_depth + border_size - top_unreachable_border],
|
[half_machine_width, -half_machine_depth],
|
||||||
[half_machine_width - border_size - right_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border]
|
[half_machine_width - border_size - right_unreachable_border, -half_machine_depth + border_size - top_unreachable_border],
|
||||||
], numpy.float32)))
|
[half_machine_width - border_size - right_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border]
|
||||||
if border_size + bottom_unreachable_border > 0:
|
], numpy.float32)))
|
||||||
result[extruder_id].append(Polygon(numpy.array([
|
if border_size + bottom_unreachable_border > 0:
|
||||||
[-half_machine_width, half_machine_depth],
|
result[extruder_id].append(Polygon(numpy.array([
|
||||||
[half_machine_width, half_machine_depth],
|
[-half_machine_width, half_machine_depth],
|
||||||
[half_machine_width - border_size - right_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border],
|
[half_machine_width, half_machine_depth],
|
||||||
[-half_machine_width + border_size - left_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border]
|
[half_machine_width - border_size - right_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border],
|
||||||
], numpy.float32)))
|
[-half_machine_width + border_size - left_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border]
|
||||||
if border_size - top_unreachable_border > 0:
|
], numpy.float32)))
|
||||||
result[extruder_id].append(Polygon(numpy.array([
|
if border_size - top_unreachable_border > 0:
|
||||||
[half_machine_width, -half_machine_depth],
|
result[extruder_id].append(Polygon(numpy.array([
|
||||||
[-half_machine_width, -half_machine_depth],
|
[half_machine_width, -half_machine_depth],
|
||||||
[-half_machine_width + border_size - left_unreachable_border, -half_machine_depth + border_size - top_unreachable_border],
|
[-half_machine_width, -half_machine_depth],
|
||||||
[half_machine_width - border_size - right_unreachable_border, -half_machine_depth + border_size - top_unreachable_border]
|
[-half_machine_width + border_size - left_unreachable_border, -half_machine_depth + border_size - top_unreachable_border],
|
||||||
], numpy.float32)))
|
[half_machine_width - border_size - right_unreachable_border, -half_machine_depth + border_size - top_unreachable_border]
|
||||||
|
], numpy.float32)))
|
||||||
|
else:
|
||||||
|
sections = 32
|
||||||
|
arc_vertex = [0, half_machine_depth - border_size]
|
||||||
|
for i in range(0, sections):
|
||||||
|
quadrant = math.floor(4 * i / sections)
|
||||||
|
vertices = []
|
||||||
|
if quadrant == 0:
|
||||||
|
vertices.append([-half_machine_width, half_machine_depth])
|
||||||
|
elif quadrant == 1:
|
||||||
|
vertices.append([-half_machine_width, -half_machine_depth])
|
||||||
|
elif quadrant == 2:
|
||||||
|
vertices.append([half_machine_width, -half_machine_depth])
|
||||||
|
elif quadrant == 3:
|
||||||
|
vertices.append([half_machine_width, half_machine_depth])
|
||||||
|
vertices.append(arc_vertex)
|
||||||
|
|
||||||
|
angle = 2 * math.pi * (i + 1) / sections
|
||||||
|
arc_vertex = [-(half_machine_width - border_size) * math.sin(angle), (half_machine_depth - border_size) * math.cos(angle)]
|
||||||
|
vertices.append(arc_vertex)
|
||||||
|
|
||||||
|
result[extruder_id].append(Polygon(numpy.array(vertices, numpy.float32)))
|
||||||
|
|
||||||
|
if border_size > 0:
|
||||||
|
result[extruder_id].append(Polygon(numpy.array([
|
||||||
|
[-half_machine_width, -half_machine_depth],
|
||||||
|
[-half_machine_width, half_machine_depth],
|
||||||
|
[-half_machine_width + border_size, 0]
|
||||||
|
], numpy.float32)))
|
||||||
|
result[extruder_id].append(Polygon(numpy.array([
|
||||||
|
[-half_machine_width, half_machine_depth],
|
||||||
|
[ half_machine_width, half_machine_depth],
|
||||||
|
[ 0, half_machine_depth - border_size]
|
||||||
|
], numpy.float32)))
|
||||||
|
result[extruder_id].append(Polygon(numpy.array([
|
||||||
|
[ half_machine_width, half_machine_depth],
|
||||||
|
[ half_machine_width, -half_machine_depth],
|
||||||
|
[ half_machine_width - border_size, 0]
|
||||||
|
], numpy.float32)))
|
||||||
|
result[extruder_id].append(Polygon(numpy.array([
|
||||||
|
[ half_machine_width,-half_machine_depth],
|
||||||
|
[-half_machine_width,-half_machine_depth],
|
||||||
|
[ 0, -half_machine_depth + border_size]
|
||||||
|
], numpy.float32)))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue