CURA-4400 add checking for enabled extruder in setting _outside_buildarea, cleaned up a bit and factored some functions out BuildVolume

This commit is contained in:
Jack Ha 2018-03-01 11:54:31 +01:00
parent 11bad271d3
commit 657a52a5e7
5 changed files with 58 additions and 42 deletions

View file

@ -4,6 +4,7 @@ from copy import deepcopy
from typing import List
from UM.Application import Application
from UM.Math.AxisAlignedBox import AxisAlignedBox
from UM.Scene.SceneNode import SceneNode
from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
@ -77,6 +78,29 @@ class CuraSceneNode(SceneNode):
1.0
]
def collidesWithBbox(self, check_bbox):
bbox = self.getBoundingBox()
# Mark the node as outside the build volume if the bounding box test fails.
if check_bbox.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection:
return True
return False
def collidesWithArea(self, areas):
convex_hull = self.callDecoration("getConvexHull")
if convex_hull:
if not convex_hull.isValid():
return False
# Check for collisions between disallowed areas and the object
for area in areas:
overlap = convex_hull.intersectsPolygon(area)
if overlap is None:
continue
return True
return False
## Taken from SceneNode, but replaced SceneNode with CuraSceneNode
def __deepcopy__(self, memo):
copy = CuraSceneNode()