Open KizzyCode opened 3 months ago
It looks like you are creating rounded walls. In general, it's recommended to create this kind of shape in 2D. I don't know the root cause of the issue with your code, however, I'd suggest to try moving the fillet to 2D with something like this:
import cadquery as cq
def make_wall(w1, w2, d1, d2) -> cq.Sketch:
return (
cq.Sketch()
.rect(w1, w1, tag="outer")
.rect(w2, w2, mode="s", tag="inner")
.vertices(tag="outer")
.fillet(d1 / 2)
.vertices(tag="inner")
.fillet(d2 / 2)
)
res = (
cq.Workplane()
.placeSketch(make_wall(50, 40, 10, 5))
.extrude(10)
.faces(">Z")
.workplane()
.placeSketch(make_wall(50, 45, 10, 5))
.extrude(5)
)
Thanks, will try it like this instead. Please feel free to close this if it is out-of-scope or probably a problem with the underlying CAD-kernel 😊
Yes AFAICT it's a kernel issue. Here is a minimal example. It fails with same error as original code.:
import cadquery as cq
b0 = cq.Workplane().box(100, 100, 5).edges(">XY").fillet(10)
b1 = (
b0.faces(">Z")
.box(100, 100, 5, centered=[True, True, False])
.edges(">XY")
.fillet(10)
)
A workaround could be to set combine to False in b1, then union after the b1 fillet
b1 = (
b0.faces(">Z")
.box(100, 100, 5, centered=[True, True, False], combine=False)
.edges(">XY")
.fillet(10)
)
b1 = b1.union(b0)
... or move the fillet to 2D as in the previous example.
To Reproduce
I'm trying to build some gridfinity stuff, therefore I'm trying to to build the baseplate in CadQuery. However I'm getting some weird
Fillets requires that edges be selected
-exception.(The following code are cells from a Jupyter-notebook, where each
#####
marks a different cell)The weird thing is: If I change the
rounding_diameter / 2
to eitherrounding_diameter / 2.00001
ORrounding_diameter / 1.99999
, it does not throw... for me this looks like some kind of floating point error; but then I'm a noob regarding CAD-kernels, and I'm pretty confused that it works with a deviation in both directions. Also I'm a newby with CadQuery, so please bear with me if I'm completely misunderstanding some concepts here 🙈Backtrace
Environment
OS: VSCode dev container running Debian on M1Pro-MacBook Pro:
Also see my attached workspace if it is any use: Gridfinity.zip