Moved specific keyboard sizes and positions to dimensions.py
This commit is contained in:
parent
158d7bfd87
commit
7217c7bc3b
@ -1,11 +1,13 @@
|
||||
STL_FILES = base.stl hinged_lid.stl simple_lid.stl tandy_lid.stl
|
||||
|
||||
all: $(STL_FILES) .lint
|
||||
all: $(STL_FILES) lint
|
||||
|
||||
%.stl: %.py dimensions.py utils.py
|
||||
%.stl: %.py dimensions.py utils.py components/*py
|
||||
python $<
|
||||
|
||||
.lint: *.py
|
||||
lint: .lint
|
||||
|
||||
.lint: **.py
|
||||
flake8
|
||||
touch .lint
|
||||
|
||||
|
@ -118,7 +118,7 @@ def model():
|
||||
bottom_face="<Z",
|
||||
back_face=None,
|
||||
offset_x=dim.shell_t,
|
||||
offset_y=dim.kbd_height + dim.shell_t,
|
||||
offset_y=keyboard.kbd_height + dim.shell_t,
|
||||
shell_t=dim.shell_t,
|
||||
)
|
||||
|
||||
|
@ -1,27 +1,20 @@
|
||||
import cadquery as cq
|
||||
import math
|
||||
|
||||
# TODO: move dimensions to dimensions.py
|
||||
# Size of the kbd board
|
||||
kbd_height = 95.5
|
||||
kbd_width = 305
|
||||
back_thickness = 19
|
||||
front_thickness = 12
|
||||
# These should be set from dimensions.py
|
||||
elements = None
|
||||
kbd_pillar_positions = []
|
||||
kbd_height = 0
|
||||
kbd_width = 0
|
||||
kbd_back_thickness = 0
|
||||
kbd_front_thickness = 0
|
||||
kbd_actual_height = 0
|
||||
kbd_angle = 0
|
||||
|
||||
# Pythagoras
|
||||
actual_height = (kbd_height**2 - (back_thickness - front_thickness) ** 2) ** 0.5
|
||||
kbd_angle = math.acos(actual_height / kbd_height) * 180 / math.pi
|
||||
|
||||
kbd_pillar_positions = [
|
||||
(19, 16),
|
||||
(142.5, 25.5),
|
||||
(kbd_width - 20, 16),
|
||||
(23.5, 79.5),
|
||||
(145.5, 82.5),
|
||||
(kbd_width - 19, 79.5),
|
||||
]
|
||||
def init():
|
||||
global elements
|
||||
|
||||
elements = [
|
||||
elements = [
|
||||
# Shorter pillars
|
||||
{
|
||||
"x": 0,
|
||||
@ -41,7 +34,7 @@ elements = [
|
||||
.circle(1.1, mode="s")
|
||||
),
|
||||
},
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
def add(
|
||||
@ -62,7 +55,7 @@ def add(
|
||||
if bottom_face:
|
||||
model = (
|
||||
model.faces(bottom_face)
|
||||
.workplane(centerOption="CenterOfBoundBox", offset=-front_thickness)
|
||||
.workplane(centerOption="CenterOfBoundBox", offset=-kbd_front_thickness)
|
||||
.center(
|
||||
-width / 2,
|
||||
height / 2,
|
||||
@ -89,16 +82,15 @@ def add(
|
||||
.placeSketch(
|
||||
cq.Sketch().polygon(
|
||||
[
|
||||
[0, front_thickness],
|
||||
[shell_t, front_thickness],
|
||||
[actual_height + shell_t, back_thickness],
|
||||
[actual_height + shell_t, 1000],
|
||||
[0, kbd_front_thickness],
|
||||
[shell_t, kbd_front_thickness],
|
||||
[kbd_actual_height + shell_t, kbd_back_thickness],
|
||||
[kbd_actual_height + shell_t, 1000],
|
||||
[0, 1000],
|
||||
[0, front_thickness],
|
||||
[0, kbd_front_thickness],
|
||||
]
|
||||
)
|
||||
)
|
||||
.cutBlind(-1000)
|
||||
)
|
||||
|
||||
return model
|
||||
|
@ -1,5 +1,8 @@
|
||||
import math
|
||||
|
||||
import components.audio_plug as audio_plug
|
||||
import components.usb_hub as usb_hub
|
||||
import components.keyboard as keyboard
|
||||
|
||||
## Standard things (TODO move to separate file)
|
||||
|
||||
@ -18,9 +21,27 @@ m4_bottom = 4
|
||||
|
||||
|
||||
## Keyboard dimensions
|
||||
kbd_height = 95.5
|
||||
kbd_width = 305
|
||||
|
||||
keyboard.kbd_height = 95.5
|
||||
keyboard.kbd_width = 305
|
||||
keyboard.kbd_back_thickness = 19
|
||||
keyboard.kbd_front_thickness = 12
|
||||
# Pythagoras
|
||||
keyboard.kbd_actual_height = (
|
||||
keyboard.kbd_height**2
|
||||
- (keyboard.kbd_back_thickness - keyboard.kbd_front_thickness) ** 2
|
||||
) ** 0.5
|
||||
keyboard.kbd_angle = (
|
||||
math.acos(keyboard.kbd_actual_height / keyboard.kbd_height) * 180 / math.pi
|
||||
)
|
||||
keyboard.kbd_pillar_positions = [
|
||||
(19, 16),
|
||||
(142.5, 25.5),
|
||||
(keyboard.kbd_width - 20, 16),
|
||||
(23.5, 79.5),
|
||||
(145.5, 82.5),
|
||||
(keyboard.kbd_width - 19, 79.5),
|
||||
]
|
||||
keyboard.init()
|
||||
|
||||
## Screen dimensions
|
||||
# Whole screen size
|
||||
@ -38,7 +59,7 @@ vis_h = 55
|
||||
shell_t = 3
|
||||
|
||||
# Size of the base
|
||||
width = kbd_width + 2 * shell_t
|
||||
width = keyboard.kbd_width + 2 * shell_t
|
||||
height = 159
|
||||
base_thickness = 30 + shell_t # 30 inside
|
||||
|
||||
|
@ -294,10 +294,10 @@ def model():
|
||||
cq.Sketch().polygon(
|
||||
[
|
||||
(0, 0),
|
||||
(0, keyboard.front_thickness),
|
||||
(dim.shell_t, keyboard.front_thickness),
|
||||
(keyboard.actual_height + dim.shell_t, keyboard.back_thickness),
|
||||
(keyboard.actual_height + dim.shell_t, dim.base_thickness),
|
||||
(0, keyboard.kbd_front_thickness),
|
||||
(dim.shell_t, keyboard.kbd_front_thickness),
|
||||
(keyboard.kbd_actual_height + dim.shell_t, keyboard.kbd_back_thickness),
|
||||
(keyboard.kbd_actual_height + dim.shell_t, dim.base_thickness),
|
||||
(dim.height, dim.base_thickness),
|
||||
(dim.height, 0),
|
||||
(0, 0),
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user