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
|
|
|
|
|
2022-07-23 14:26:55 +00:00
|
|
|
hinge_w = 7.5
|
|
|
|
hinge_h = 15
|
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()
|
2022-07-23 14:26:55 +00:00
|
|
|
.segment((0, 0), (0, hinge_h))
|
|
|
|
.arc((0, hinge_h), (hinge_w / 2, hinge_h + hinge_w/2), (hinge_w, hinge_h))
|
|
|
|
.segment((hinge_w, 0))
|
2022-07-22 21:23:27 +00:00
|
|
|
.close()
|
2022-07-23 14:26:55 +00:00
|
|
|
.arc((hinge_w / 2, hinge_h), screw_radius, 0, 360)
|
2022-07-22 21:23:27 +00:00
|
|
|
.assemble()
|
|
|
|
)
|
|
|
|
|
|
|
|
hinge_profile_2 = (
|
|
|
|
cq.Sketch()
|
2022-07-23 14:26:55 +00:00
|
|
|
.segment((0, 0), (0, hinge_h))
|
|
|
|
.arc((0, hinge_h), (hinge_w / 2, hinge_h + hinge_w/2), (hinge_w, hinge_h))
|
|
|
|
.segment((hinge_w, 0))
|
2022-07-22 21:23:27 +00:00
|
|
|
.close()
|
2022-07-23 14:26:55 +00:00
|
|
|
.arc((hinge_w / 2, hinge_h), ti_radius, 0, 360)
|
2022-07-22 21:23:27 +00:00
|
|
|
.assemble()
|
|
|
|
)
|
|
|
|
|
|
|
|
hinge = (
|
|
|
|
cq.Workplane("bottom")
|
|
|
|
.placeSketch(hinge_profile_1)
|
|
|
|
.extrude(hinge_t)
|
|
|
|
.workplane(offset=hinge_gap)
|
|
|
|
.placeSketch(hinge_profile_2)
|
|
|
|
.extrude(hinge_t)
|
|
|
|
)
|
|
|
|
|
2022-07-23 17:11:30 +00:00
|
|
|
#exporters.export(hinge, "hinge.stl")
|