57 lines
1.3 KiB
Python
57 lines
1.3 KiB
Python
import cadquery2 as cq
|
|
from cadquery2 import exporters
|
|
|
|
from parameters import *
|
|
|
|
# Small M3x8 screw
|
|
screw_l = 10
|
|
screw_shaft = 8
|
|
screw_head_h = 2.5
|
|
screw_head_radius = 3.5
|
|
screw_radius = 1.5
|
|
|
|
|
|
reinforcement_height = 1 + 1 + ti_depth - shell_t
|
|
|
|
back_reinforcement_cutout = (
|
|
cq.Sketch()
|
|
.trapezoid(width / 2 + 1, 15 + 1, 90, mode="a")
|
|
.reset()
|
|
.vertices()
|
|
.fillet(2)
|
|
)
|
|
|
|
back_reinforcement_outer = (
|
|
cq.Sketch()
|
|
.trapezoid(width / 2 + 2 * shell_t, 15 + 2 * shell_t, 90, mode="a")
|
|
.reset()
|
|
.vertices()
|
|
.fillet(2)
|
|
)
|
|
|
|
screw_holes = cq.Sketch().rarray(width / 8, 0, 4, 1).circle(screw_radius, mode="a")
|
|
screw_countersinks = (
|
|
cq.Sketch().rarray(width / 8, 0, 4, 1).circle(screw_head_radius, mode="a")
|
|
)
|
|
|
|
rear_mount = (
|
|
# Basic filleted box shape
|
|
cq.Workplane("bottom")
|
|
.placeSketch(back_reinforcement_outer)
|
|
.extrude(reinforcement_height + screw_head_h + shell_t)
|
|
.faces(">Y")
|
|
.workplane(centerOption="CenterOfBoundBox")
|
|
.placeSketch(back_reinforcement_cutout)
|
|
.cutBlind(-reinforcement_height)
|
|
.faces("<Y")
|
|
.workplane(centerOption="CenterOfBoundBox")
|
|
.placeSketch(screw_holes)
|
|
.cutBlind(-1000)
|
|
.faces("<Y")
|
|
.workplane(centerOption="CenterOfBoundBox")
|
|
.placeSketch(screw_countersinks)
|
|
.cutBlind(-screw_head_h)
|
|
)
|
|
|
|
exporters.export(rear_mount, "rear_mount.stl")
|