cadquery/notebook_nueva/battery_holder.py

74 lines
1.6 KiB
Python
Raw Normal View History

2023-02-17 17:32:01 +00:00
import cadquery as cq
2023-02-16 17:57:32 +00:00
stand_positions = [(0, 0), (58, 0), (58, 49), (0, 49)]
2023-02-24 13:46:19 +00:00
stands = (
cq.Sketch().push(stand_positions).circle(3, mode="a").circle(2.65 / 2, mode="s")
)
2023-02-22 18:02:10 +00:00
pillar_height = 7
2023-02-17 20:55:20 +00:00
2023-02-22 21:17:02 +00:00
2023-02-17 20:55:20 +00:00
# This is a holder for DuPont cables so they connect to this
# things' pogo pins which are used to power the CPU
pin_positions = [(3.5, 0), (4 * 2.54 + 3.5, 0)]
pin_holder_width = 25
pin_holder_height = 15
pin_holder = (
cq.Sketch()
.polygon(
[
(0.5, 0),
(pin_holder_width, 0),
(pin_holder_width, pin_holder_height),
(0, pin_holder_height),
(0.5, 0),
],
mode="a",
)
.push(pin_positions)
.polygon(
[(0, 0), (2.6, 0), (2.6, pin_holder_height), (0, pin_holder_height), (0, 0)],
mode="s",
2023-02-17 20:55:20 +00:00
)
)
elements = [
# Battery holder stands
{
"x": 0,
"y": 0,
"shape": stands,
"height": pillar_height,
},
# Pogo pin connector channels
{
"x": 0,
"y": 40,
"shape": pin_holder,
"height": 3,
},
]
# Hole distances are relative to the rightmost pillar
# seen from the back of the case, that's why they are negative
# Heights are relative to base of pillars
# All distances are measured to the CENTER of the hole
holes = [
# Power inlet
{
"x": -15,
"y": -1 + pillar_height,
"height": 6.5,
"width": 12,
"fillet": 1,
},
# Power button
{
"x": -67,
"y": 5.5 + pillar_height,
"height": 7,
"width": 7,
"fillet": 1,
},
]