CONNOR MORENO
unread,Jun 28, 2022, 3:07:59 PM6/28/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CadQuery
Hi all,
I'm having some difficulty understanding how to use the multi-section sweep (using the multisection flag on workplane.sweep). As an exercise, I'm trying to create a sweep whose cross-sectional shape alternates between circles and squares along a path of a half revolution of a circle. I thought perhaps the following script would work
import cadquery as cq
import numpy as np
n = 5
phi = np.linspace(0, np.pi, num = n)
rad = 5
pts = []
j = 0
for i in phi:
pt = (rad*np.cos(i), rad*np.sin(i))
pts += [pt]
rotation = (0.0, np.rad2deg(i), 0.0)
if i == phi[0]:
sweep = cq.Workplane("XZ").transformed(rotate = rotation, offset = pt)
else:
sweep = sweep.copyWorkplane(cq.Workplane("XZ")
).transformed(rotate = rotation, offset = pt)
if (j % 2) == 0:
sweep = sweep.circle(1)
else:
sweep = sweep.rect(1, 1)
j += 1
path = cq.Workplane("XY").spline(pts)
sweep = sweep.sweep(path, multisection = True)
cq.exporters.export(sweep, 'sweep.step')
but running gives the following error
Traceback (most recent call last):
File "/home/camoreno/Documents/ParametricStellarator/sweep_test.py", line 35, in <module>
sweep = sweep.sweep(path, multisection = True)
File "/home/camoreno/miniforge/lib/python3.9/site-packages/cadquery/cq.py", line 3161, in sweep
r = self._sweep(
File "/home/camoreno/miniforge/lib/python3.9/site-packages/cadquery/cq.py", line 3732, in _sweep
thisObj = Solid.sweep_multi(sections, p, makeSolid, isFrenet, mode)
File "/home/camoreno/miniforge/lib/python3.9/site-packages/cadquery/occ_impl/shapes.py", line 3234, in sweep_multi
builder.Build()
OCP.Standard.Standard_ConstructionError: BRepFill :: profiles are inconsistent
I'm having trouble finding documentation for the multi-section sweep and I'm certain I'm using it incorrectly. Any help would be greatly appreciated and please let me know if I can provide additional information/explanation.
Thanks!
Connor