mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Temporary? solution for UX w.r.t. material shrinkage.
Material shrinkage now alters both the disallowed areas+, and the blue wireframe, toghether repressenting the usable build-volume. This doesn't shrink the build-plate/printer model, still keeping in line with the 'show the size of the result object in Prepare, not the resized one we do print becasue it will shrink later' principle we had originally agreed on enough. Note that the disallowed areas also take the object themzelves into account, so the user could still tell when objects are going to be printed overlapped (as the dissalowed areas of those respective models then overlap -- but not, of course, the models themselves). part of CURA-8083
This commit is contained in:
parent
b6c0a49657
commit
f51cc84a7c
1 changed files with 29 additions and 22 deletions
|
@ -66,6 +66,7 @@ class BuildVolume(SceneNode):
|
||||||
self._height = 0 # type: float
|
self._height = 0 # type: float
|
||||||
self._depth = 0 # type: float
|
self._depth = 0 # type: float
|
||||||
self._shape = "" # type: str
|
self._shape = "" # type: str
|
||||||
|
self._scale_vector = Vector(1.0, 1.0, 1.0)
|
||||||
|
|
||||||
self._shader = None
|
self._shader = None
|
||||||
|
|
||||||
|
@ -513,6 +514,13 @@ class BuildVolume(SceneNode):
|
||||||
self._disallowed_area_size = max(size, self._disallowed_area_size)
|
self._disallowed_area_size = max(size, self._disallowed_area_size)
|
||||||
return mb.build()
|
return mb.build()
|
||||||
|
|
||||||
|
def _updateScaleFactor(self) -> None:
|
||||||
|
if not self._global_container_stack:
|
||||||
|
return
|
||||||
|
scale_xy = 100.0 / max(100.0, self._global_container_stack.getProperty("material_shrinkage_percentage_xy", "value"))
|
||||||
|
scale_z = 100.0 / max(100.0, self._global_container_stack.getProperty("material_shrinkage_percentage_z" , "value"))
|
||||||
|
self._scale_vector = Vector(scale_xy, scale_xy, scale_z)
|
||||||
|
|
||||||
def rebuild(self) -> None:
|
def rebuild(self) -> None:
|
||||||
"""Recalculates the build volume & disallowed areas."""
|
"""Recalculates the build volume & disallowed areas."""
|
||||||
|
|
||||||
|
@ -554,9 +562,12 @@ class BuildVolume(SceneNode):
|
||||||
|
|
||||||
self._error_mesh = self._buildErrorMesh(min_w, max_w, min_h, max_h, min_d, max_d, disallowed_area_height)
|
self._error_mesh = self._buildErrorMesh(min_w, max_w, min_h, max_h, min_d, max_d, disallowed_area_height)
|
||||||
|
|
||||||
|
self._updateScaleFactor()
|
||||||
|
|
||||||
self._volume_aabb = AxisAlignedBox(
|
self._volume_aabb = AxisAlignedBox(
|
||||||
minimum = Vector(min_w, min_h - 1.0, min_d),
|
minimum = Vector(min_w, min_h - 1.0, min_d).scale(self._scale_vector),
|
||||||
maximum = Vector(max_w, max_h - self._raft_thickness - self._extra_z_clearance, max_d))
|
maximum = Vector(max_w, max_h - self._raft_thickness - self._extra_z_clearance, max_d).scale(self._scale_vector)
|
||||||
|
)
|
||||||
|
|
||||||
bed_adhesion_size = self.getEdgeDisallowedSize()
|
bed_adhesion_size = self.getEdgeDisallowedSize()
|
||||||
|
|
||||||
|
@ -564,8 +575,8 @@ class BuildVolume(SceneNode):
|
||||||
# This is probably wrong in all other cases. TODO!
|
# This is probably wrong in all other cases. TODO!
|
||||||
# The +1 and -1 is added as there is always a bit of extra room required to work properly.
|
# The +1 and -1 is added as there is always a bit of extra room required to work properly.
|
||||||
scale_to_max_bounds = AxisAlignedBox(
|
scale_to_max_bounds = AxisAlignedBox(
|
||||||
minimum = Vector(min_w + bed_adhesion_size + 1, min_h, min_d + self._disallowed_area_size - bed_adhesion_size + 1),
|
minimum = Vector(min_w + bed_adhesion_size + 1, min_h, min_d + self._disallowed_area_size - bed_adhesion_size + 1).scale(self._scale_vector),
|
||||||
maximum = Vector(max_w - bed_adhesion_size - 1, max_h - self._raft_thickness - self._extra_z_clearance, max_d - self._disallowed_area_size + bed_adhesion_size - 1)
|
maximum = Vector(max_w - bed_adhesion_size - 1, max_h - self._raft_thickness - self._extra_z_clearance, max_d - self._disallowed_area_size + bed_adhesion_size - 1).scale(self._scale_vector)
|
||||||
)
|
)
|
||||||
|
|
||||||
self._application.getController().getScene()._maximum_bounds = scale_to_max_bounds # type: ignore
|
self._application.getController().getScene()._maximum_bounds = scale_to_max_bounds # type: ignore
|
||||||
|
@ -573,12 +584,7 @@ class BuildVolume(SceneNode):
|
||||||
self.updateNodeBoundaryCheck()
|
self.updateNodeBoundaryCheck()
|
||||||
|
|
||||||
def getBoundingBox(self) -> Optional[AxisAlignedBox]:
|
def getBoundingBox(self) -> Optional[AxisAlignedBox]:
|
||||||
if self._volume_aabb is None:
|
return self._volume_aabb
|
||||||
return None
|
|
||||||
scale_xy = 100.0 / self._global_container_stack.getProperty("material_shrinkage_percentage_xy", "value")
|
|
||||||
scale_z = 100.0 / self._global_container_stack.getProperty("material_shrinkage_percentage_z" , "value")
|
|
||||||
scale_vector = Vector(scale_xy, scale_xy, scale_z)
|
|
||||||
return AxisAlignedBox(self._volume_aabb.minimum.scale(scale_vector), self._volume_aabb.minimum.scale(scale_vector))
|
|
||||||
|
|
||||||
def getRaftThickness(self) -> float:
|
def getRaftThickness(self) -> float:
|
||||||
return self._raft_thickness
|
return self._raft_thickness
|
||||||
|
@ -638,18 +644,18 @@ class BuildVolume(SceneNode):
|
||||||
for extruder in extruders:
|
for extruder in extruders:
|
||||||
extruder.propertyChanged.connect(self._onSettingPropertyChanged)
|
extruder.propertyChanged.connect(self._onSettingPropertyChanged)
|
||||||
|
|
||||||
self._width = self._global_container_stack.getProperty("machine_width", "value")
|
self._width = self._global_container_stack.getProperty("machine_width", "value") * self._scale_vector.x
|
||||||
machine_height = self._global_container_stack.getProperty("machine_height", "value")
|
machine_height = self._global_container_stack.getProperty("machine_height", "value")
|
||||||
if self._global_container_stack.getProperty("print_sequence", "value") == "one_at_a_time" and len(self._scene_objects) > 1:
|
if self._global_container_stack.getProperty("print_sequence", "value") == "one_at_a_time" and len(self._scene_objects) > 1:
|
||||||
self._height = min(self._global_container_stack.getProperty("gantry_height", "value"), machine_height)
|
self._height = min(self._global_container_stack.getProperty("gantry_height", "value") * self._scale_vector.z, machine_height)
|
||||||
if self._height < machine_height:
|
if self._height < (machine_height * self._scale_vector.z):
|
||||||
self._build_volume_message.show()
|
self._build_volume_message.show()
|
||||||
else:
|
else:
|
||||||
self._build_volume_message.hide()
|
self._build_volume_message.hide()
|
||||||
else:
|
else:
|
||||||
self._height = self._global_container_stack.getProperty("machine_height", "value")
|
self._height = self._global_container_stack.getProperty("machine_height", "value")
|
||||||
self._build_volume_message.hide()
|
self._build_volume_message.hide()
|
||||||
self._depth = self._global_container_stack.getProperty("machine_depth", "value")
|
self._depth = self._global_container_stack.getProperty("machine_depth", "value") * self._scale_vector.y
|
||||||
self._shape = self._global_container_stack.getProperty("machine_shape", "value")
|
self._shape = self._global_container_stack.getProperty("machine_shape", "value")
|
||||||
|
|
||||||
self._updateDisallowedAreas()
|
self._updateDisallowedAreas()
|
||||||
|
@ -683,18 +689,18 @@ class BuildVolume(SceneNode):
|
||||||
if setting_key == "print_sequence":
|
if setting_key == "print_sequence":
|
||||||
machine_height = self._global_container_stack.getProperty("machine_height", "value")
|
machine_height = self._global_container_stack.getProperty("machine_height", "value")
|
||||||
if self._application.getGlobalContainerStack().getProperty("print_sequence", "value") == "one_at_a_time" and len(self._scene_objects) > 1:
|
if self._application.getGlobalContainerStack().getProperty("print_sequence", "value") == "one_at_a_time" and len(self._scene_objects) > 1:
|
||||||
self._height = min(self._global_container_stack.getProperty("gantry_height", "value"), machine_height)
|
self._height = min(self._global_container_stack.getProperty("gantry_height", "value") * self._scale_vector.z, machine_height)
|
||||||
if self._height < machine_height:
|
if self._height < (machine_height * self._scale_vector.z):
|
||||||
self._build_volume_message.show()
|
self._build_volume_message.show()
|
||||||
else:
|
else:
|
||||||
self._build_volume_message.hide()
|
self._build_volume_message.hide()
|
||||||
else:
|
else:
|
||||||
self._height = self._global_container_stack.getProperty("machine_height", "value")
|
self._height = self._global_container_stack.getProperty("machine_height", "value") * self._scale_vector.z
|
||||||
self._build_volume_message.hide()
|
self._build_volume_message.hide()
|
||||||
update_disallowed_areas = True
|
update_disallowed_areas = True
|
||||||
|
|
||||||
# sometimes the machine size or shape settings are adjusted on the active machine, we should reflect this
|
# sometimes the machine size or shape settings are adjusted on the active machine, we should reflect this
|
||||||
if setting_key in self._machine_settings:
|
if setting_key in self._machine_settings or setting_key in self._material_size_settings:
|
||||||
self._updateMachineSizeProperties()
|
self._updateMachineSizeProperties()
|
||||||
update_extra_z_clearance = True
|
update_extra_z_clearance = True
|
||||||
update_disallowed_areas = True
|
update_disallowed_areas = True
|
||||||
|
@ -743,9 +749,10 @@ class BuildVolume(SceneNode):
|
||||||
def _updateMachineSizeProperties(self) -> None:
|
def _updateMachineSizeProperties(self) -> None:
|
||||||
if not self._global_container_stack:
|
if not self._global_container_stack:
|
||||||
return
|
return
|
||||||
self._height = self._global_container_stack.getProperty("machine_height", "value")
|
self._updateScaleFactor()
|
||||||
self._width = self._global_container_stack.getProperty("machine_width", "value")
|
self._height = self._global_container_stack.getProperty("machine_height", "value") * self._scale_vector.z
|
||||||
self._depth = self._global_container_stack.getProperty("machine_depth", "value")
|
self._width = self._global_container_stack.getProperty("machine_width", "value") * self._scale_vector.x
|
||||||
|
self._depth = self._global_container_stack.getProperty("machine_depth", "value") * self._scale_vector.y
|
||||||
self._shape = self._global_container_stack.getProperty("machine_shape", "value")
|
self._shape = self._global_container_stack.getProperty("machine_shape", "value")
|
||||||
|
|
||||||
def _updateDisallowedAreasAndRebuild(self):
|
def _updateDisallowedAreasAndRebuild(self):
|
||||||
|
@ -765,7 +772,7 @@ class BuildVolume(SceneNode):
|
||||||
def _scaleAreas(self, result_areas: List["Polygons"]) -> None:
|
def _scaleAreas(self, result_areas: List["Polygons"]) -> None:
|
||||||
for i, polygon in enumerate(result_areas):
|
for i, polygon in enumerate(result_areas):
|
||||||
result_areas[i] = polygon.scale(
|
result_areas[i] = polygon.scale(
|
||||||
100.0 / self._global_container_stack.getProperty("material_shrinkage_percentage_xy", "value")
|
100.0 / max(100.0, self._global_container_stack.getProperty("material_shrinkage_percentage_xy", "value"))
|
||||||
)
|
)
|
||||||
|
|
||||||
def _updateDisallowedAreas(self) -> None:
|
def _updateDisallowedAreas(self) -> None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue