Hi,
Regarding the first two Workplane examples, here the CQ Face method makeFromWires constructs the face with OCCT BRepBuilderAPI_MakeFace. This creates holes from inner wires. In the second example the behavior changes because the rect wire crosses the bounds of the circle.
I'd suggest try working with Sketch when creating planar faces. Also you might try the Free function API. As docs state it "has no hidden state, but may result in more verbose code." Here is a free function example constructing a similar face.:
from cadquery.func import *
circ1 = face(circle(3.0))
rect1 = face(rect(0.5, 0.5)).moved(x=2)
result1 = extrude(circ1 - rect1, (0, 0, 0.25))
rect2 = face(rect(0.5, 0.5)).moved(x=3)
# you choose to add or subtract the rect2
result2 = extrude(circ1 - rect2, (0, 0, 0.25))
result3 = extrude(clean(circ1 + rect2), (0, 0, 0.25))
> but then I cannot extrude it.
Sorry I didn't follow. I guess this is not what you wanted.
sk1 = cq.Sketch().circle(3.0)
sk1 = sk1.rect(0.5, 0.5, mode="s").vertices().fillet(0.1)
result = cq.Workplane("XZ").placeSketch(sk1).extrude(2)
> what if I don't want that box for base?
example:
result = (
cq.Workplane().circle(1.5).workplane(offset=3.0).rect(0.75, 0.5).loft(combine=True)
)
or with Sketch (similar to docs example):
sk1 = cq.Sketch().circle(1.5)
sk2 = cq.Sketch().rect(0.75, 0.5)
result2 = cq.Workplane().placeSketch(sk1, sk2.moved(z=3)).loft()
or with free function (also see similar docs example):
from cadquery.func import *
result3 = loft(circle(1.5), rect(0.75, 0.5).moved(z=3), cap=True)