Good afternoon all;
This is my first time posting to this forum so if I am not doing something correctly please let me know and I will update!
I am trying to put together a consistent method for generating a tank, composed of a central cylindrical section and elliptical domes on each end. My most straight-forward approach has been to simply define the 1D perimeter of the shape, and then revolve that. However, this comes up with an error every time.
python Version: 3.12.2
CadQuery Version: 2.4.0
Code:
---------------------------------------------------------------
import cadquery as cq
# dimensions of the tank
thickness = 0.1
dt = 10 - 2*thickness # diameter of tank
rt = dt/2 # radius of tank
ht = 20 # total height of tank cylindrical section
hht = ht / 2 # half the tank height
hd = 3 - thickness # height of dome
# define workplane
wp = cq.Workplane("XZ")
# trying to give the entire perimeter then rotate
# start at bottom right corner above dome
tank = wp.move(xDist=rt, yDist=-hht)
# right-side vertical line of cylindrical section
tank = tank.line(xDist=0, yDist=ht)
# top dome
tank = tank.ellipseArc(
x_radius=rt,
y_radius=hd,
angle1=0.,
angle2=180.,
sense=1, # clockwise (-1) or counter clockwise (1)
)
# left-side vertical line of cylindrical section
tank = tank.line(xDist=0, yDist=-ht)
# bottom dome
tank = tank.ellipseArc(
x_radius=rt,
y_radius=hd,
angle1=180,
angle2=0.,
sense=1, # clockwise (-1) or counter clockwise (1)
)
# close the Wire
tank = tank.close()
# revolve to make a solid
tank = tank.revolve(180)
# finally, apply a thin shell
tank = tank.shell(thickness=-thickness)
---------------------------------------------------------------
The stack trace I get is:
StdFail_NotDone Traceback (most recent call last)
Cell In[86], line 20
12 tank = tank.ellipseArc(
13 x_radius=rt,
14 y_radius=hd,
(...)
17 sense=1, # clockwise (-1) or counter clockwise (1)
18 )
19 tank = tank.close()
---> 20 tank = tank.revolve(180)
21 # finally, apply a thin shell
22 tank = tank.shell(thickness=-thickness)
File ...\envs\parametric-cad-update\Lib\site-packages\cadquery\cq.py:3152, in Workplane.revolve(self, angleDegrees, axisStart, axisEnd, combine, clean)
3149 axisEnd = self.plane.toWorldCoords(axisEnd).toTuple()
3151 # returns a Solid (or a compound if there were multiple)
-> 3152 r = self._revolve(angleDegrees, axisStart, axisEnd)
3154 return self._combineWithBase(r, combine, clean)
File ...\envs\parametric-cad-update\Lib\site-packages\cadquery\cq.py:3757, in Workplane._revolve(self, angleDegrees, axisStart, axisEnd)
3755 toFuse = []
3756 for f in self._getFaces():
-> 3757 thisObj = Solid.revolve(f, angleDegrees, Vector(axisStart), Vector(axisEnd))
3758 toFuse.append(thisObj)
3760 return Compound.makeCompound(toFuse)
File ...\envs\parametric-cad-update\Lib\site-packages\cadquery\utils.py:50, in cqmultimethod.__call__(self, *args, **kwargs)
47 def __call__(self, *args, **kwargs):
49 try:
---> 50 return super().__call__(*args, **kwargs)
51 except DispatchError:
52 return next(iter(self.values()))(*args, **kwargs)
File ...\envs\parametric-cad-update\Lib\site-packages\multimethod\__init__.py:315, in multimethod.__call__(self, *args, **kwargs)
313 func = self[tuple(func(arg) for func, arg in zip(self.type_checkers, args))]
314 try:
--> 315 return func(*args, **kwargs)
316 except TypeError as ex:
317 raise DispatchError(f"Function {func.__code__}") from ex
File ...\envs\parametric-cad-update\Lib\site-packages\cadquery\occ_impl\shapes.py:3432, in Solid.revolve(cls, face, angleDegrees, axisStart, axisEnd)
3427 v2 = v2 - v1
3428 revol_builder = BRepPrimAPI_MakeRevol(
3429 face.wrapped, gp_Ax1(v1.toPnt(), v2.toDir()), radians(angleDegrees), True
3430 )
-> 3432 return cls(revol_builder.Shape())
StdFail_NotDone: BRep_API: command not done
---------------------------------------------------------------
Can anyone see what I'm doing wrong? This seems like a very straight-forward implementation to me.
Thank you!
Pat