Boolean cut between shapes does not produce expected result
- Dominant language
- Python
- Stars
- 5.8k
- Forks
- 541
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 5
Description
Hi! I am trying to cut a cylindrical hole into a toroidal shell. The function I'm using works "most of the time", but for same orientations & parameter values does not execute the cut correctly. Here is a minimal reproducible example.
```python
import cadquery as cq
import cadquery.occ_impl.shapes as cq_shapes
import numpy as np
R = 3.3
r = 2.2
t = 0.05
# torus-like shape
inner_tor = cq_shapes.torus(d1=R * 2, d2=r * 2)
outer_tor = cq_shapes.torus(d1=R * 2, d2=(r + t) * 2)
torus_shape = cq_shapes.solid(outer_tor.Faces(), inner=inner_tor.Faces())
#cylinder
xyz1 = np.array([-0.5, -2.4 , 2.1])
xyz2 = np.array([-2.6, -1.0, -0.1])
length = 5.0
radius = 0.1
plane = cq.Plane(origin=tuple(xyz2), normal=tuple(xyz1 - xyz2))
workplane = cq.Workplane(plane).circle(radius).extrude(length)
cylinder_shape = workplane.solids().val()
cut_shape = torus_shape.cut(cylinder_shape)
```
The result is as expected, getting a nice hole in the torus shell:

The intersection looks like this:

Now, if we change `xyz2` from `np.array([-2.6, -1.0, -0.1])` to `np.array([-2.7, -1.0, -0.1])`, it suddenly doesn't work anymore: this is the result of the cut operation

And this is the intersection:

I suspect this is an OCC issue, but I am running this in an automated script and don't have the liberty of manipulating coordinates by trial and error. Any idea of a workaround would be greatly appreciated, thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.