2022-07-22 21:23:27 +00:00
|
|
|
import cadquery2 as cq
|
|
|
|
from cadquery2 import exporters
|
|
|
|
|
|
|
|
from parameters import *
|
|
|
|
|
|
|
|
# M3x20 screw
|
|
|
|
screw_l = 22
|
|
|
|
screw_shaft = 20
|
|
|
|
screw_head_h = 2.5
|
|
|
|
screw_head_radius = 3.5
|
|
|
|
screw_radius = 1.5
|
|
|
|
|
|
|
|
hinge_s = 7.5
|
2022-07-23 13:07:56 +00:00
|
|
|
hinge_t = ti_depth - 1
|
2022-07-22 21:23:27 +00:00
|
|
|
hinge_gap = screw_shaft - 2 * hinge_t
|
2022-07-23 13:07:56 +00:00
|
|
|
# The side of the screw head
|
2022-07-22 21:23:27 +00:00
|
|
|
hinge_profile_1 = (
|
|
|
|
cq.Sketch()
|
|
|
|
.segment((0, 0), (0, hinge_s))
|
|
|
|
.arc((0, hinge_s), (hinge_s / 2, 1.5 * hinge_s), (hinge_s, hinge_s))
|
|
|
|
.segment((hinge_s, 0))
|
|
|
|
.close()
|
|
|
|
.arc((hinge_s / 2, hinge_s), screw_radius, 0, 360)
|
|
|
|
.assemble()
|
|
|
|
)
|
|
|
|
|
|
|
|
hinge_profile_2 = (
|
|
|
|
cq.Sketch()
|
|
|
|
.segment((0, 0), (0, hinge_s))
|
|
|
|
.arc((0, hinge_s), (hinge_s / 2, 1.5 * hinge_s), (hinge_s, hinge_s))
|
|
|
|
.segment((hinge_s, 0))
|
|
|
|
.close()
|
|
|
|
.arc((hinge_s / 2, hinge_s), ti_radius, 0, 360)
|
|
|
|
.assemble()
|
|
|
|
)
|
|
|
|
|
|
|
|
hinge = (
|
|
|
|
cq.Workplane("bottom")
|
|
|
|
.placeSketch(hinge_profile_1)
|
|
|
|
.extrude(hinge_t)
|
|
|
|
.workplane(offset=hinge_gap)
|
|
|
|
.placeSketch(hinge_profile_2)
|
|
|
|
.extrude(hinge_t)
|
|
|
|
)
|
|
|
|
|
|
|
|
exporters.export(hinge, "hinge.stl")
|