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

Sweep along 3D curve??? #587

Closed
daemacles opened this issue Jan 17, 2021 · 4 comments
Closed

Sweep along 3D curve??? #587

daemacles opened this issue Jan 17, 2021 · 4 comments
Labels
question Further information is requested

Comments

@daemacles
Copy link

daemacles commented Jan 17, 2021

Been reading through the examples and manual etc.

I can't figure out how to sweep a 2D profile along a 3D curve. Here's the goal: a parametric version of a screw, and the sweep is to generate the threads. So assuming there is a cylinder with a cone at its end, I'd like to have a spiral path go up the length of the cylinder and sweep a triangular profile along it to generate the threads. I'm stuck because, for example, polylines only have 2D coordinates.

Any advice is much appreciated!

@RubenRubens
Copy link
Contributor

This is a copy paste from another issue.

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 the question Further information is requested label Jan 17, 2021
@daemacles
Copy link
Author

Thank you - worked perfectly.

There aren't any examples using cq.Wire.makeHelix() in the documents. What's the process to add one?

@jmwright
Copy link
Member

@daemacles If you are going to add a basic example on how to use makeHelix() you could create a PR and add the example as Ex025_* here: https://github.com/CadQuery/cadquery/tree/master/examples

If your example is more complex (i.e. a bolt/screw generator), it's probably best to add it to the contrib repo: https://github.com/CadQuery/cadquery-contrib

@daemacles
Copy link
Author

PR added #594 added.

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

No branches or pull requests

4 participants