Fixed bug where telerance parameter of BoundingBox had of effect

The tolerance parameter of the BoundingBox method of shape had no effect. Fixed this by passing the tolerance to the _fromTopoDS call. Changed the tolerance default value from 0.1 to None so that the global TOL is used by default.  This allows the user to set the global TOL value as outlined in #74.  The CenterofBoundbox method incorrectly passed a shape to the BoundingBox method, which is the position for the tolerance paramter. This has been fixed.  The _fromTopoDS method hard coded the global variable TOL in it's call to BRepMesh_IncrementalMesh. This has been updated to use the user supplied tolerance if one has been provided. Added test coverage for the tolerance parameter of the BoundingBox method.
This commit is contained in:
Michael Greminger
2019-07-29 10:20:55 -05:00
parent a17c217803
commit bcf7141197
3 changed files with 13 additions and 4 deletions

View File

@ -836,6 +836,15 @@ class TestCadQuery(BaseTest):
self.assertAlmostEqual(7.5, bb_center.y, 3)
self.assertAlmostEqual(50.0, bb_center.z, 3)
# The following will raise with the default tolerance of TOL 1e-2
bb = result.val().BoundingBox(tolerance=1e-3)
self.assertAlmostEqual(0.0, bb.xmin, 2)
self.assertAlmostEqual(28, bb.xmax, 2)
self.assertAlmostEqual(0.0, bb.ymin, 2)
self.assertAlmostEqual(15.0, bb.ymax, 2)
self.assertAlmostEqual(0.0, bb.zmin, 2)
self.assertAlmostEqual(100.0, bb.zmax, 2)
def testCutThroughAll(self):
"""
Tests a model that uses more than one workplane