mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-10-10 07:17:52 -06:00
Merge branch '15.06'
* 15.06: Store the disallowed areas as polygons and use those to test for intersection Account for skirt size and disallowed areas to set the scale to max size Fix the JSON file after moving the initial layer height setting Move initial layer thickness from layer height children into category Disable the low/high quality slicing and slider settings if we are not in simple mode Remove sidebar right margin Exclude ConsoleLogger and MLP* and OBJWriter plugins from the windows installer Switch to using a proper windows application Properly run the vcredist installer in quiet mode Use the application as source for the shortcut icon Bump version to 15.05.96 Properly add and set the window icon Update UMO start/end gcode to reflect what is used in Cura 15.04 Do not hide enable retraction check box even if all children are visible Update setting ranges to reflect those that are used in the current Cura lowers the printbed so the mesh and grid no longer z-fight If we skip an object because it does not have a bounding box, retrigger the change timer Restyling of the save to toolpath button
This commit is contained in:
commit
58702d0bb7
15 changed files with 359 additions and 214 deletions
|
@ -42,6 +42,9 @@ class BuildVolume(SceneNode):
|
|||
def setDepth(self, depth):
|
||||
self._depth = depth
|
||||
|
||||
def getDisallowedAreas(self):
|
||||
return self._disallowed_areas
|
||||
|
||||
def setDisallowedAreas(self, areas):
|
||||
self._disallowed_areas = areas
|
||||
|
||||
|
@ -109,19 +112,43 @@ class BuildVolume(SceneNode):
|
|||
v = self._grid_mesh.getVertex(n)
|
||||
self._grid_mesh.setVertexUVCoordinates(n, v[0], v[2])
|
||||
|
||||
disallowed_area_size = 0
|
||||
if self._disallowed_areas:
|
||||
mb = MeshBuilder()
|
||||
for area in self._disallowed_areas:
|
||||
for polygon in self._disallowed_areas:
|
||||
points = polygon.getPoints()
|
||||
mb.addQuad(
|
||||
area[0],
|
||||
area[1],
|
||||
area[2],
|
||||
area[3],
|
||||
Vector(points[0, 0], 0.1, points[0, 1]),
|
||||
Vector(points[1, 0], 0.1, points[1, 1]),
|
||||
Vector(points[2, 0], 0.1, points[2, 1]),
|
||||
Vector(points[3, 0], 0.1, points[3, 1]),
|
||||
color = Color(174, 174, 174, 255)
|
||||
)
|
||||
# Find the largest disallowed area to exclude it from the maximum scale bounds
|
||||
size = abs(numpy.max(points[:, 1]) - numpy.min(points[:, 1]))
|
||||
disallowed_area_size = max(size, disallowed_area_size)
|
||||
|
||||
self._disallowed_area_mesh = mb.getData()
|
||||
else:
|
||||
self._disallowed_area_mesh = None
|
||||
|
||||
self._aabb = AxisAlignedBox(minimum = Vector(minW, minH - 1.0, minD), maximum = Vector(maxW, maxH, maxD))
|
||||
|
||||
settings = Application.getInstance().getActiveMachine()
|
||||
|
||||
skirt_size = 0.0
|
||||
if settings.getSettingValueByKey("adhesion_type") == "None":
|
||||
skirt_size = settings.getSettingValueByKey("skirt_line_count") * settings.getSettingValueByKey("skirt_line_width") + settings.getSettingValueByKey("skirt_gap")
|
||||
elif settings.getSettingValueByKey("adhesion_type") == "Brim":
|
||||
skirt_size = settings.getSettingValueByKey("brim_line_count") * settings.getSettingValueByKey("skirt_line_width")
|
||||
else:
|
||||
skirt_size = settings.getSettingValueByKey("skirt_line_width")
|
||||
|
||||
skirt_size += settings.getSettingValueByKey("skirt_line_width")
|
||||
|
||||
scale_to_max_bounds = AxisAlignedBox(
|
||||
minimum = Vector(minW + skirt_size, minH, minD + skirt_size + disallowed_area_size),
|
||||
maximum = Vector(maxW - skirt_size, maxH, maxD - skirt_size - disallowed_area_size)
|
||||
)
|
||||
|
||||
Application.getInstance().getController().getScene()._maximum_bounds = scale_to_max_bounds
|
||||
|
|
|
@ -18,6 +18,7 @@ from UM.Preferences import Preferences
|
|||
from UM.Message import Message
|
||||
from UM.PluginRegistry import PluginRegistry
|
||||
from UM.JobQueue import JobQueue
|
||||
from UM.Math.Polygon import Polygon
|
||||
|
||||
from UM.Scene.BoxRenderer import BoxRenderer
|
||||
from UM.Scene.Selection import Selection
|
||||
|
@ -36,7 +37,7 @@ from . import PrintInformation
|
|||
from . import CuraActions
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty
|
||||
from PyQt5.QtGui import QColor
|
||||
from PyQt5.QtGui import QColor, QIcon
|
||||
|
||||
import platform
|
||||
import sys
|
||||
|
@ -52,6 +53,8 @@ class CuraApplication(QtApplication):
|
|||
|
||||
super().__init__(name = "cura", version = "master")
|
||||
|
||||
self.setWindowIcon(QIcon(Resources.getPath(Resources.ImagesLocation, "cura-icon.png")))
|
||||
|
||||
self.setRequiredPlugins([
|
||||
"CuraEngineBackend",
|
||||
"MeshView",
|
||||
|
@ -464,23 +467,13 @@ class CuraApplication(QtApplication):
|
|||
disallowed_areas = machine.getSettingValueByKey("machine_disallowed_areas")
|
||||
areas = []
|
||||
if disallowed_areas:
|
||||
|
||||
for area in disallowed_areas:
|
||||
polygon = []
|
||||
polygon.append(Vector(area[0][0], 0.2, area[0][1]))
|
||||
polygon.append(Vector(area[1][0], 0.2, area[1][1]))
|
||||
polygon.append(Vector(area[2][0], 0.2, area[2][1]))
|
||||
polygon.append(Vector(area[3][0], 0.2, area[3][1]))
|
||||
areas.append(polygon)
|
||||
areas.append(Polygon(numpy.array(area, numpy.float32)))
|
||||
|
||||
self._volume.setDisallowedAreas(areas)
|
||||
|
||||
self._volume.rebuild()
|
||||
|
||||
if self.getController().getTool("ScaleTool"):
|
||||
bbox = self._volume.getBoundingBox()
|
||||
bbox.setBottom(0.0)
|
||||
self.getController().getTool("ScaleTool").setMaximumBounds(bbox)
|
||||
|
||||
offset = machine.getSettingValueByKey("machine_platform_offset")
|
||||
if offset:
|
||||
self._platform.setPosition(Vector(offset[0], offset[1], offset[2]))
|
||||
|
|
|
@ -49,6 +49,7 @@ class PlatformPhysics:
|
|||
|
||||
bbox = node.getBoundingBox()
|
||||
if not bbox or not bbox.isValid():
|
||||
self._change_timer.start()
|
||||
continue
|
||||
|
||||
# Mark the node as outside the build volume if the bounding box test fails.
|
||||
|
@ -93,14 +94,19 @@ class PlatformPhysics:
|
|||
move_vector.setX(overlap[0] * 1.1)
|
||||
move_vector.setZ(overlap[1] * 1.1)
|
||||
|
||||
if hasattr(node, "_convex_hull"):
|
||||
# Check for collisions between disallowed areas and the object
|
||||
for area in self._build_volume.getDisallowedAreas():
|
||||
overlap = node._convex_hull.intersectsPolygon(area)
|
||||
if overlap is None:
|
||||
continue
|
||||
|
||||
node._outside_buildarea = True
|
||||
|
||||
if move_vector != Vector():
|
||||
op = PlatformPhysicsOperation.PlatformPhysicsOperation(node, move_vector)
|
||||
op.push()
|
||||
|
||||
if node.getBoundingBox().intersectsBox(self._build_volume.getBoundingBox()) == AxisAlignedBox.IntersectionResult.FullIntersection:
|
||||
op = ScaleToBoundsOperation(node, self._build_volume.getBoundingBox())
|
||||
op.push()
|
||||
|
||||
def _onToolOperationStarted(self, tool):
|
||||
self._enabled = False
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ class PrintInformation(QObject):
|
|||
def __init__(self, parent = None):
|
||||
super().__init__(parent)
|
||||
|
||||
self._enabled = False
|
||||
|
||||
self._minimum_print_time = Duration(None, self)
|
||||
self._current_print_time = Duration(None, self)
|
||||
self._maximum_print_time = Duration(None, self)
|
||||
|
@ -103,6 +105,21 @@ class PrintInformation(QObject):
|
|||
def timeQualityValue(self):
|
||||
return self._time_quality_value
|
||||
|
||||
def setEnabled(self, enabled):
|
||||
if enabled != self._enabled:
|
||||
self._enabled = enabled
|
||||
|
||||
if self._enabled:
|
||||
self._updateTimeQualitySettings()
|
||||
self._onSlicingStarted()
|
||||
|
||||
self.enabledChanged.emit()
|
||||
|
||||
enabledChanged = pyqtSignal()
|
||||
@pyqtProperty(bool, fset = setEnabled, notify = enabledChanged)
|
||||
def enabled(self):
|
||||
return self._enabled
|
||||
|
||||
@pyqtSlot(int)
|
||||
def setTimeQualityValue(self, value):
|
||||
if value != self._time_quality_value:
|
||||
|
@ -132,7 +149,10 @@ class PrintInformation(QObject):
|
|||
self._material_amount = round(amount / 10) / 100
|
||||
self.materialAmountChanged.emit()
|
||||
|
||||
if self._slice_reason != self.SliceReason.SettingChanged:
|
||||
if not self._enabled:
|
||||
return
|
||||
|
||||
if self._slice_reason != self.SliceReason.SettingChanged or not self._minimum_print_time.valid or not self._maximum_print_time.valid:
|
||||
self._slice_pass = self.SlicePass.LowQualitySettings
|
||||
self._backend.slice(settings = self._low_quality_settings, save_gcode = False, save_polygons = False, force_restart = False, report_progress = False)
|
||||
else:
|
||||
|
@ -166,7 +186,7 @@ class PrintInformation(QObject):
|
|||
self._slice_reason = self.SliceReason.ActiveMachineChanged
|
||||
|
||||
def _updateTimeQualitySettings(self):
|
||||
if not self._current_settings:
|
||||
if not self._current_settings or not self._enabled:
|
||||
return
|
||||
|
||||
if not self._low_quality_settings:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue