diff --git a/environment.yml b/environment.yml index 53d492c..07413b6 100644 --- a/environment.yml +++ b/environment.yml @@ -6,7 +6,7 @@ dependencies: - python=3.9 - pip=22.0 - numpy=1.22 - - pythonocc-core=7.5.1 - - occt=7.5.1 + - pythonocc-core=7.6.2 + - occt=7.6.2 - pip: - cad-viewer-widget==1.4.1 diff --git a/notebooks/Classic-OCC-Bottle.ipynb b/notebooks/Classic-OCC-Bottle.ipynb index d2a2daf..36f23fb 100644 --- a/notebooks/Classic-OCC-Bottle.ipynb +++ b/notebooks/Classic-OCC-Bottle.ipynb @@ -268,6 +268,25 @@ "metadata": {}, "outputs": [], "source": [ + "from OCC.Core.Bnd import Bnd_Box\n", + "from OCC.Core.BRepBndLib import brepbndlib_Add\n", + "from OCC.Core.BRepMesh import BRepMesh_IncrementalMesh\n", + "\n", + "def get_boundingbox(shape, tol=1e-6, use_mesh=True):\n", + " bbox = Bnd_Box()\n", + " bbox.SetGap(tol)\n", + " if use_mesh:\n", + " mesh = BRepMesh_IncrementalMesh()\n", + " mesh.SetParallelDefault(True)\n", + " mesh.SetShape(shape)\n", + " mesh.Perform()\n", + " if not mesh.IsDone():\n", + " raise AssertionError(\"Mesh not done.\")\n", + " brepbndlib_Add(shape, bbox, use_mesh)\n", + "\n", + " xmin, ymin, zmin, xmax, ymax, zmax = bbox.Get()\n", + " return {\"xmin\": xmin, \"ymin\": ymin, \"zmin\":zmin, \"xmax\": xmax, \"ymax\": ymax, \"zmax\":zmax}\n", + " \n", "bb = get_boundingbox(bottle)" ] },