-
Couldn't load subscription status.
- Fork 381
Open
Description
Tested with the latest CQ version provided on conda
I'm working on a nut and the last cut operation fails, this is, there is no thread. The thing is that when using union instead of cut the operation is successfully performed. I cannot tell if it's my fault or a bug.
The code
import cadquery as cq
from math import sin, cos, tan, pi
# Parameters
d = 10
p = 1.50
da = 10.40
dw = 14.60
e = 17.77
m = 8.10
s = 16
angle = 30 * pi / 180
# Constant
H = 0.866 * p
# Gemetry
def cutting_hexagon():
points = [
(s/2, 0),
(e, 0),
(e, e * sin(angle))
]
a = (
cq.Workplane('YZ')
.polyline(points).close()
.revolve()
)
b = a.mirror('XY', (0, 0, m/2))
return a.union(b)
def internal_iso_thread():
# Helix
helix = cq.Workplane('XY').parametricCurve(
lambda t : (
d/2 * cos(t * 2 * pi),
d/2 * sin(t * 2 * pi),
p * t
),
start = 0,
stop = m/p
)
# Face
A = H/8 / tan(pi/3)
B = A * tan(pi/6)
C = A / cos(pi/6)
face = (
cq.Workplane('XZ')
.center(d/2, 0)
.moveTo(0, A)
.threePointArc((C-B, 0), (0, -A))
.lineTo(-7/8 * H, -H/2)
.lineTo(-7/8 * H, H/2)
.lineTo(0, A)
.close()
)
return face.sweep(helix, isFrenet=True)
def core():
def circumscribed(nSides, inscribedDiameter):
angle = 1/(nSides * 2) * 2 * pi
return inscribedDiameter / cos(angle)
return (
cq.Workplane('XY')
.polygon(6, circumscribed(6, s))
.circle(d / 2 - 3/8 * H)
.extrude(m)
)
result = (
core()
.cut(cutting_hexagon())
.cut(internal_iso_thread())
)
result.val().exportStep('bug.step')