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 seems to fail #271

Closed
RubenRubens opened this issue Jan 24, 2020 · 2 comments · Fixed by #311
Closed

Helix seems to fail #271

RubenRubens opened this issue Jan 24, 2020 · 2 comments · Fixed by #311
Labels
bug Something isn't working
Projects

Comments

@RubenRubens
Copy link
Contributor

RubenRubens commented Jan 24, 2020

Helix is shorter than expected

I'm running Windows with the CQ-editor 0.1 RC1. I am working on a spring. I have tested it with two aproaches. The first one, using the native helix; the second one, using a parametric curve. The problem is that the height of the helix is less than it should be. height is set to 4, however it seems to be something around 2.5.

Maybe I just did a mistake along the way, but I'm feeling like it's a bug.

Here's the code. (The helix curve is a copy-paste from this gist of @fragmuffin.)

import cadquery as cq
from math import sin, cos, pi

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

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

# Helix [second aproach]. It works as expected.
# helix = cq.Workplane('XY').parametricCurve(
# 	lambda t : (
# 		r * cos(t * 2 * pi),
# 		r * sin(t * 2 * pi),
# 		p * t
# 	),
# 	start=0,
# 	stop=h/p
# )

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

first_vs_second

@adam-urbanczyk adam-urbanczyk added the bug Something isn't working label Jan 30, 2020
@adam-urbanczyk
Copy link
Member

Looks like a bug. Thanks for reporting.

@adam-urbanczyk adam-urbanczyk added this to To do in CQ2.0 via automation Apr 4, 2020
@adam-urbanczyk adam-urbanczyk moved this from To do to In progress in CQ2.0 Apr 4, 2020
CQ2.0 automation moved this from In progress to Done Apr 4, 2020
@jmwright
Copy link
Member

jmwright commented Apr 4, 2020

@RubenRubens This was fixed by @adam-urbanczyk in #311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
CQ2.0
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants