Thanks Adam.
How exactly is the auxSpine wire turned into the binormal direction? My guess was that the path and the auxSpine are parameterized by t between 0 and 1 and the binormal is the vector between auxSpine(t)-path(t). But the following example shows that this is not the case. In the example my path is a circle, and my auxSpine is a larger circle in the same plane. I assumed this would mean that the binormal would be in the radial direction over the circle, and the sweep would be unaffected and essentially a torus with a rectangular cross section. However this is what I got:
#!/usr/bin/env python
import cadquery as cq
from cadquery import exporters
def sweep_wire(wire,
profile,
binormal=None,
up = cq.Vector(0,0,1),
isFrenet=True):
'''Sweep the (plane) profile along the open or closed wire'''
first_edge = next(iter(wire))
plane_normal = first_edge.tangentAt(0)
plane_point = first_edge.positionAt(0)
x_dir = plane_normal.cross(up)
plane = cq.Plane(origin=plane_point,
xDir = x_dir,
normal = plane_normal)
auxSpine = cq.Workplane(plane).eachpoint(binormal) if binormal is not None else None
return (cq.Workplane(plane)
.eachpoint(profile)
.sweep(wire, isFrenet=isFrenet, auxSpine=auxSpine)
)
aux = cq.Wire.makeCircle(11,(0,0,0),(0,0,1))
path = cq.Wire.makeCircle(10,(0,0,0),(0,0,1))
w,h = (1,2)
profile = cq.Wire.makePolygon([(0,0),
(w,0),
(w,h),
(0,h)]).close()
res = sweep_wire(path,profile,binormal=aux)
exporters.export(res, 'sweep-aux-spine.stl')
Once I understand how this works, I'll create a PR with an example.