Latch
Francesco Pasa 2 days ago
Francesco Pasa 2 days ago
cassetta_atrezzi_auto/cassetta_atrezzi_auto.py M +68 -6
10 EDGE_DEPTH = 5
11 REINFORCEMENT_WIDTH = 20
12 TOL = 0.001
13+LATCH_CANTILEVER = 12
14+LATCH_WIDTH = 6
15+SCREW_LENGTH = 40
16+SCREW_DIAMETER = 4
17+SCREW_NUT_DIAMETER = 7
18+SCREW_NUT_DEPTH = 3
19
20
21 def box_walls(
68 )
69
70
71-def latch_side(depth: float, height: float) -> Workplane:
72+def latch_side(
73+ depth: float,
74+ height: float,
75+ width: float,
76+ screw_length: float,
77+ screw_diameter: float,
78+ screw_nut_diameter: float,
79+ screw_nut_depth: float,
80+) -> Workplane:
81 return (
82 Workplane("YZ")
83 .lineTo(0, height)
84 .lineTo(depth, height)
85- .radiusArc((0, 0), height)
86+ .lineTo(depth, depth)
87 .close()
88- .extrude(5)
89+ .extrude(width)
90+ .edges("|X and >Y and >Z")
91+ .fillet(depth / 5)
92+ .edges("|X and >Y and (not >Z)")
93+ .fillet(depth / 2)
94+ .edges("|Z and (not <Y)")
95+ .chamfer(depth / 10)
96+ .faces("<X")
97+ .workplane()
98+ .center(-depth / 2, height - screw_nut_diameter / 2 - 1.5)
99+ .cboreHole(screw_diameter, screw_nut_diameter, screw_nut_depth)
100 )
101
102
103-def latch_holder(depth: float, height: float) -> Workplane:
104- return latch_side(depth, height) # + latch_side().translate((40, 0, 0))
105+def latch_holder(
106+ cantilever: float,
107+ height: float,
108+ width: float,
109+ screw_length: float,
110+ screw_diameter: float,
111+ screw_nut_diameter: float,
112+ screw_nut_depth: float,
113+) -> Workplane:
114+ separation = screw_length + screw_nut_depth - width
115+ return (
116+ latch_side(
117+ cantilever,
118+ height,
119+ width,
120+ screw_length,
121+ screw_diameter,
122+ screw_nut_diameter,
123+ screw_nut_depth,
124+ )
125+ + latch_side(
126+ cantilever,
127+ height,
128+ width,
129+ screw_length,
130+ screw_diameter,
131+ screw_nut_diameter,
132+ screw_nut_depth,
133+ )
134+ .mirror("YZ")
135+ .translate((separation, 0, 0))
136+ ).translate((-separation / 2, 0, 0))
137
138
139 def assembly() -> Assembly:
148 BORDER_RADIUS,
149 CHAMFER_SIZE,
150 )
151- _latch = latch_holder(10, BOX_DEPTH - CHAMFER_SIZE)
152+ _latch = latch_holder(
153+ LATCH_CANTILEVER,
154+ BOX_DEPTH - CHAMFER_SIZE,
155+ LATCH_WIDTH,
156+ SCREW_LENGTH,
157+ SCREW_DIAMETER,
158+ SCREW_NUT_DIAMETER,
159+ SCREW_NUT_DEPTH,
160+ )
161
162 front_center = _box_walls.faces(">Y").val().Center()
163 return (