Hacked some stuff to build volume.

Fixes CURA-435
This commit is contained in:
Jaime van Kessel 2016-01-04 15:33:11 +01:00
parent 82b5bbc283
commit aeef5b0b1b

View file

@ -130,8 +130,11 @@ class BuildVolume(SceneNode):
mb.addFace(first, previous_point, new_point, color = color)
previous_point = new_point
# Find the largest disallowed area to exclude it from the maximum scale bounds
size = abs(numpy.max(points[:, 1]) - numpy.min(points[:, 1]))
# Find the largest disallowed area to exclude it from the maximum scale bounds.
# This is a very nasty hack. This pretty much only works for UM machines. This disallowed area_size needs
# A -lot- of rework at some point in the future: TODO
if numpy.min(points[:, 1]) >= 0: # This filters out all areas that have points to the left of the centre. This is done to filter the skirt area.
size = abs(numpy.max(points[:, 1]) - numpy.min(points[:, 1]))
disallowed_area_size = max(size, disallowed_area_size)
self._disallowed_area_mesh = mb.getData()
@ -146,9 +149,12 @@ class BuildVolume(SceneNode):
if profile:
skirt_size = self._getSkirtSize(profile)
# As this works better for UM machines, we only add the dissallowed_area_size for the z direction.
# This is probably wrong in all other cases. TODO!
# The +2 and -2 is added as there is always a bit of extra room required to work properly.
scale_to_max_bounds = AxisAlignedBox(
minimum = Vector(min_w + skirt_size, min_h, min_d + skirt_size + disallowed_area_size),
maximum = Vector(max_w - skirt_size, max_h, max_d - skirt_size - disallowed_area_size)
minimum = Vector(min_w + skirt_size + 2, min_h, min_d + disallowed_area_size),
maximum = Vector(max_w - skirt_size - 2, max_h, max_d - disallowed_area_size)
)
Application.getInstance().getController().getScene()._maximum_bounds = scale_to_max_bounds
@ -192,6 +198,7 @@ class BuildVolume(SceneNode):
skirt_size = self._getSkirtSize(self._active_profile)
if disallowed_areas:
# Extend every area already in the disallowed_areas with the skirt size.
for area in disallowed_areas:
poly = Polygon(numpy.array(area, numpy.float32))
poly = poly.getMinkowskiHull(Polygon(numpy.array([
@ -207,6 +214,7 @@ class BuildVolume(SceneNode):
areas.append(poly)
# Add the skirt areas arround the borders of the build plate.
if skirt_size > 0:
half_machine_width = self._active_instance.getMachineSettingValue("machine_width") / 2
half_machine_depth = self._active_instance.getMachineSettingValue("machine_depth") / 2