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

Sweeping a circle on a helix path not working as expected #758

Closed
KilowattSynthesis opened this issue Nov 5, 2024 · 3 comments
Closed
Labels
question Further information is requested

Comments

@KilowattSynthesis
Copy link

KilowattSynthesis commented Nov 5, 2024

Consider this example Helix, which works exactly as you'd expect.

def make_helix() -> bd.Helix:
    """Make basic helix."""
    return bd.Helix(
        radius=2,
        pitch=1,
        height=10,
    )

image

Now, consider this circle swept around the Helix:

def make_helix_sweep() -> bd.Part:
    """Make basic helix sweep."""
    p = bd.Part()
    p += bd.sweep(
        path=make_helix(),
        sections=bd.Circle(radius=0.3),
    )
    return p

image

I would have expected the output to come out as a "spring" appears (constant major diameter along the length). Why did it come out looking so different from a spring?

@gumyr
Copy link
Owner

gumyr commented Nov 5, 2024

The profile needs to be perpendicular to the path to get a "spring" - like this:

path = Helix(radius=2, pitch=1, height=10)
profile = (path ^ 0) * Circle(radius=0.3)
swept = sweep(path=path, sections=profile)

image
The (path ^ 0) operator returns a Location at the beginning of the path which then orients the profile to be perpendicular to the path.

@gumyr gumyr added the question Further information is requested label Nov 5, 2024
@gumyr gumyr added this to the Not Gating Release 1.0.0 milestone Nov 5, 2024
@KilowattSynthesis
Copy link
Author

Neat, thank you for the support! I've created #759 and #760, which depict documentation changes which would have made that discovery easier.

I'll close this issue in favor of those other two.

@KilowattSynthesis KilowattSynthesis closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 2024
@jdegenstein
Copy link
Collaborator

By the way, this is why I prefer to develop outside of functions until the part is "finished" -- it is important to be able to easily view all objects. Because the function internals are not added to the global scope, it requires more care to view them using e.g. OCP CAD Viewer or CQ-editor. CodeCAD can be quite complex because of the interplay between the code structure and sometimes-not-so-trivial 3D representation.

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

3 participants