BoundingBox Very Inaccurate after STL export
- Dominant language
- Python
- Stars
- 5.8k
- Forks
- 541
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 5
Description
I've came across this problem today, when I saw that the bounding box measurements of the models in which I imported (in `.STP` format) to CADQuery were off by a few millimeters -- depending on the model this could be higher. After some research and reading throughout the repo, I saw issues #7, #74, #79, and #167, in which **weren't successful at fixing this problem**.
**I tried to tweak the tolerance using all the examples provided in these discussions (to no avail), such as:**
- Changing the global tolerance:
`cadquery.occ_impl.geom.TOL = 0.00001`
- Passing the tolerance to the internal TopoDS method:
`cadquery.BoundBox._fromTopoDS(cube.val().wrapped, tol=0.00001)`
- Changing the tolerance on the default bounding box method:
`cube.val().BoundingBox(tolerance=0.00001)`
A good example file to use is this [cube_grid.step](https://raw.githubusercontent.com/cqparts/cqparts/master/tests/test-files/cube_grid.step). Also, for comparison, here are some values from CADQuery, PythonOCC, and FreeCAD:
1. CADQuery:
- BoundingBox:
- X: 149.00000028 mm
- Y: 149.00000028000002 mm
- Z: 14.000000280000002 mm
- Volume: 100000.00000000065 mm3
2. PythonOCC:
- BoundingBox:
- X: 145.02000020000003 mm
- Y: 145.02000020000003 mm
- Z: 10.020000199999998 mm
- Volume: 100000.00000000065 mm3
3. FreeCAD:
- BoundingBox:
- X: 145.0 mm
- Y: 145.00000000000003 mm
- Z: 10.0 mm
- Volume: 100000.00000000065 mm3
As you can see, the CADQuery implementation of the bounding box function is clearly flawed in precision. What is strange to me is how well the volume implementation is (super precise as the other libraries), but our bounding box implementation is not.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.