mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-15 15:20:37 -08:00
Fixed bbox when mesh is present - Issue #249
This commit is contained in:
parent
a2cec45379
commit
e2d0da9c4b
2 changed files with 9 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ from OCP.BRepBndLib import BRepBndLib
|
|||
from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeFace
|
||||
from OCP.BRepGProp import BRepGProp, BRepGProp_Face # used for mass calculation
|
||||
from OCP.BRepMesh import BRepMesh_IncrementalMesh
|
||||
from OCP.BRepTools import BRepTools
|
||||
from OCP.Geom import Geom_Line, Geom_Surface, Geom_Plane
|
||||
from OCP.GeomAPI import GeomAPI_ProjectPointOnSurf, GeomAPI_IntCS
|
||||
from OCP.gp import (
|
||||
|
|
@ -759,6 +760,8 @@ class BoundBox:
|
|||
Returns:
|
||||
|
||||
"""
|
||||
BRepTools.Clean_s(shape) # Remove mesh which may impact bbox
|
||||
|
||||
tolerance = TOL if tolerance is None else tolerance # tol = TOL (by default)
|
||||
bbox = Bnd_Box()
|
||||
bbox_obb = Bnd_OBB()
|
||||
|
|
|
|||
|
|
@ -354,6 +354,12 @@ class TestBoundBox(DirectApiTestCase):
|
|||
def test_combined_center_of_boundbox(self):
|
||||
pass
|
||||
|
||||
def test_clean_boundbox(self):
|
||||
s = Solid.make_sphere(3)
|
||||
self.assertVectorAlmostEquals(s.bounding_box().size, (6, 6, 6), 5)
|
||||
s.mesh(1e-3)
|
||||
self.assertVectorAlmostEquals(s.bounding_box().size, (6, 6, 6), 5)
|
||||
|
||||
# def test_to_solid(self):
|
||||
# bbox = Solid.make_sphere(1).bounding_box()
|
||||
# self.assertVectorAlmostEquals(bbox.min, (-1, -1, -1), 5)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue