better phone shape, combined model improved
This commit is contained in:
parent
e732a591db
commit
7341b4e76e
4 changed files with 39 additions and 5 deletions
21
mkbd65.py
21
mkbd65.py
|
|
@ -84,12 +84,29 @@ def cli(layout, variant, stl, emf, amf, detail, config_file):
|
|||
)
|
||||
}
|
||||
|
||||
columns = 13
|
||||
alps_thickness = 0.78
|
||||
alps_height = 4
|
||||
alps_width = 6
|
||||
pcb_thickness = 1
|
||||
bottom_cover_thickness = 0.5
|
||||
pcb_margin_y = 3
|
||||
pcb_margin_x = (PCB_WIDTH - (columns * config.getfloat("key_mat", "key_width", fallback=9) + (columns - 1) * config.getfloat("key_mat", "padding", fallback=1))) / 2 + (config.getfloat("key_mat", "key_width", fallback=9) - 6) / 2
|
||||
key_mat_width = 13 * config.getfloat("key_mat", "key_width", fallback=9) + 12 * config.getfloat("key_mat", "padding", fallback=1) + 2 * config.getfloat("key_mat", "margin", fallback=1)
|
||||
full_model = components["lower_case"] + translate(v=((config.getfloat("phone", "width") - PCB_WIDTH) / 2, config.getfloat("phone", "corner_radius") / 2, 0.5))(
|
||||
|
||||
# TODO: fix x of pcb
|
||||
|
||||
full_model = components["lower_case"] + translate(v=((config.getfloat("phone", "width") - PCB_WIDTH) / 2, config.getfloat("phone", "corner_radius") / 2, bottom_cover_thickness))(
|
||||
components["pcb"]
|
||||
) + translate(v=((config.getfloat("phone", "width") - key_mat_width) / 2, 3 + config.getfloat("key_mat", "margin", fallback=1) + (config.getfloat("key_mat", "key_height", fallback=6) - 4) / 2 , 1.78))(
|
||||
) + translate(v=(
|
||||
pcb_margin_x + config.getfloat("phone", "corner_radius", fallback=10) / 2 - config.getfloat("key_mat", "margin", fallback=1) - (config.getfloat("key_mat", "key_width", fallback=9) - alps_width) / 2,
|
||||
pcb_margin_y + config.getfloat("phone", "corner_radius", fallback=10) / 2 - config.getfloat("key_mat", "margin", fallback=1) - (config.getfloat("key_mat", "key_height", fallback=6) - alps_height) / 2,
|
||||
alps_thickness + pcb_thickness + bottom_cover_thickness))(
|
||||
components["key_mat"]
|
||||
)
|
||||
# config.getfloat("phone", "width") - key_mat_width) / 2,
|
||||
# 3 + config.getfloat("key_mat", "margin", fallback=1) + (config.getfloat("key_mat", "key_height", fallback=6) - 4) / 2 ,
|
||||
# 1.78
|
||||
|
||||
scad_render_to_file(
|
||||
full_model,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ def lower_case(phone_width: float, phone_height: float, phone_radius: float) ->
|
|||
thickness = 2
|
||||
window_thickness = 0.5
|
||||
|
||||
# TODO: make a difference between phone_radius and thickness of side walls
|
||||
|
||||
return color("DarkSlateGray")(up(z=thickness)(
|
||||
(scale(v=(1, 1, thickness / phone_radius))(
|
||||
hull()(
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ def pcb(key_width: float, key_height: float, key_padding: float) -> OpenSCADObje
|
|||
|
||||
:return:
|
||||
"""
|
||||
pcb_thickness = 0.5
|
||||
pcb_thickness = 1
|
||||
rows = 5
|
||||
columns = 13
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from solid import OpenSCADObject, linear_extrude, translate, offset, square
|
||||
from solid import OpenSCADObject, linear_extrude, translate, offset, square, cylinder, rotate, hull, cube
|
||||
|
||||
|
||||
def phone(
|
||||
|
|
@ -9,12 +9,13 @@ def phone(
|
|||
side_radius: float
|
||||
) -> OpenSCADObject:
|
||||
"""
|
||||
Generates rough estimate of the phones shape
|
||||
Generates rough estimate of the phones shape (basically an oneplus 8t)
|
||||
|
||||
:param width: length from top to bottom (landscape)
|
||||
:param height: length from left to right (landscape)
|
||||
:param thickness: How thicc is it?
|
||||
:param corner_radius: Assuming all phones have round corners
|
||||
:param side_radius: Assuming all phones have rounded side rails
|
||||
:return:
|
||||
"""
|
||||
return linear_extrude(height=thickness)(
|
||||
|
|
@ -23,4 +24,18 @@ def phone(
|
|||
square(size=(width - 2 * corner_radius, height - 2 * corner_radius))
|
||||
)
|
||||
)
|
||||
) * hull()(
|
||||
translate(v=(0, side_radius, side_radius))(
|
||||
rotate(a=(0, 90, 0))(
|
||||
cylinder(r=side_radius, h=width)
|
||||
)
|
||||
),
|
||||
translate(v=(0, height - side_radius, side_radius))(
|
||||
rotate(a=(0, 90, 0))(
|
||||
cylinder(r=side_radius, h=width)
|
||||
)
|
||||
),
|
||||
translate(v=(0, 0, thickness / 2))(
|
||||
cube(size=[width, height, thickness / 2])
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue