Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helix example is no longer working #572

Closed
RubenRubens opened this issue Jan 12, 2021 · 2 comments · Fixed by #573
Closed

Helix example is no longer working #572

RubenRubens opened this issue Jan 12, 2021 · 2 comments · Fixed by #573
Labels
docs question Further information is requested

Comments

@RubenRubens
Copy link
Contributor

This code worked one year ago, it can be found on issue #271. Running the same code today causes ValueError: Wire or Edge instance required from the _sweep method.

import cadquery as cq

r = 3 # Radius of the helix
p = 1.5 # Pitch of the helix
h = 4 # Height of the helix

# Helix
wire = cq.Wire.makeHelix(pitch=p, height=h, radius=r)
shape = cq.Wire.combine([wire])
helix = cq.Workplane("XY").newObject([shape])

# Final result. A circle sweeped along a helix.
result = (
    cq.Workplane('XZ')
    .center(r, 0)
    .circle(0.1)
    .sweep(helix, isFrenet=True)
)

Tested with the latest CQ version (build with conda from master)

@adam-urbanczyk
Copy link
Member

Wire.combine was fixed during the annotation process. So you need to change the code to:

import cadquery as cq

r = 3 # Radius of the helix
p = 1.5 # Pitch of the helix
h = 4 # Height of the helix

# Helix
wire = cq.Wire.makeHelix(pitch=p, height=h, radius=r)
shape = cq.Wire.combine([wire])
helix = cq.Workplane("XY").newObject(shape)

# Final result. A circle sweeped along a helix.
result = (
    cq.Workplane('XZ')
    .center(r, 0)
    .circle(0.1)
    .sweep(helix, isFrenet=True)
)

BTW: the combine call is not needed at all. You can also use:

import cadquery as cq

r = 3 # Radius of the helix
p = 1.5 # Pitch of the helix
h = 4 # Height of the helix

# Helix
wire = cq.Wire.makeHelix(pitch=p, height=h, radius=r)
helix = cq.Workplane(obj=wire)
# Final result. A circle sweeped along a helix.
result = (
    cq.Workplane('XZ')
    .center(r, 0)
    .circle(0.1)
    .sweep(helix, isFrenet=True)
)

@adam-urbanczyk adam-urbanczyk added question Further information is requested docs labels Jan 12, 2021
@RubenRubens
Copy link
Contributor Author

Thanks! This is really helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants