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:
@ -827,7 +827,7 @@ class BoundBox(object):
|
||||
raise NotImplementedError
|
||||
# brepbndlib_AddOptimal(shape, bbox) #this is 'exact' but expensive - not yet wrapped by PythonOCC
|
||||
else:
|
||||
mesh = BRepMesh_IncrementalMesh(shape, TOL, True)
|
||||
mesh = BRepMesh_IncrementalMesh(shape, tol, True)
|
||||
mesh.Perform()
|
||||
# this is adds +margin but is faster
|
||||
brepbndlib_Add(shape, bbox, True)
|
||||
|
||||
@ -315,8 +315,8 @@ class Shape(object):
|
||||
def isValid(self):
|
||||
return BRepCheck_Analyzer(self.wrapped).IsValid()
|
||||
|
||||
def BoundingBox(self, tolerance=0.1): # need to implement that in GEOM
|
||||
return BoundBox._fromTopoDS(self.wrapped)
|
||||
def BoundingBox(self, tolerance=None): # need to implement that in GEOM
|
||||
return BoundBox._fromTopoDS(self.wrapped, tol=tolerance)
|
||||
|
||||
def mirror(self, mirrorPlane="XY", basePointVector=(0, 0, 0)):
|
||||
|
||||
@ -353,7 +353,7 @@ class Shape(object):
|
||||
return Shape.centerOfMass(self)
|
||||
|
||||
def CenterOfBoundBox(self, tolerance=0.1):
|
||||
return self.BoundingBox(self.wrapped).center
|
||||
return self.BoundingBox().center
|
||||
|
||||
@staticmethod
|
||||
def CombinedCenter(objects):
|
||||
|
||||
Reference in New Issue
Block a user