lower case as model
This commit is contained in:
parent
1e06eba86c
commit
a68cc9ef53
2 changed files with 33 additions and 25 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
from solid import OpenSCADObject, hull, translate, sphere, cube, scale, offset, square
|
from solid import OpenSCADObject, hull, translate, sphere, cube, scale, offset, square
|
||||||
|
|
||||||
from util import PCB_WIDTH, PCB_HEIGHT, PCB_RADIUS
|
from util import PCB_WIDTH, PCB_HEIGHT, PCB_RADIUS, forward, backward, up, right
|
||||||
|
|
||||||
|
|
||||||
def lower_case(phone_width: float, phone_height: float, phone_radius: float) -> OpenSCADObject:
|
def lower_case(phone_width: float, phone_height: float, phone_radius: float) -> OpenSCADObject:
|
||||||
|
|
@ -15,33 +15,35 @@ def lower_case(phone_width: float, phone_height: float, phone_radius: float) ->
|
||||||
thickness = 2
|
thickness = 2
|
||||||
window_thickness = 0.5
|
window_thickness = 0.5
|
||||||
|
|
||||||
return (scale(v=(1, 1, thickness / phone_radius))(
|
return forward(v=thickness)(
|
||||||
hull()(
|
(scale(v=(1, 1, thickness / phone_radius))(
|
||||||
translate(v=(phone_radius, phone_radius, 0))(
|
hull()(
|
||||||
sphere(r=phone_radius),
|
translate(v=(phone_radius, phone_radius, 0))(
|
||||||
translate(v=(0, phone_height - 2 * phone_radius, 0))(
|
sphere(r=phone_radius),
|
||||||
sphere(r=phone_radius)
|
up(v=phone_height - 2 * phone_radius)(
|
||||||
),
|
sphere(r=phone_radius)
|
||||||
translate(v=(phone_width - 2 * phone_radius, 0, 0))(
|
),
|
||||||
sphere(r=phone_radius)
|
right(v=phone_width - 2 * phone_radius)(
|
||||||
),
|
sphere(r=phone_radius)
|
||||||
translate(v=(phone_width - 2 * phone_radius, phone_height - 2 * phone_radius, 0))(
|
),
|
||||||
sphere(r=phone_radius)
|
translate(v=(phone_width - 2 * phone_radius, phone_height - 2 * phone_radius, 0))(
|
||||||
|
sphere(r=phone_radius)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
) * backward(v=thickness)(
|
||||||
) * translate(v=(0, 0, -1 * thickness))(
|
cube([phone_width, phone_height, thickness])
|
||||||
cube([phone_width, phone_height, thickness])
|
)) - translate(v=(2 * phone_radius, 2 * phone_radius, -1 * thickness / 2))(
|
||||||
)) - translate(v=(2 * phone_radius, 2 * phone_radius, -1 * thickness / 2))(
|
scale(v=(1, 1, thickness))(
|
||||||
scale(v=(1, 1, thickness))(
|
offset(r=phone_radius)(
|
||||||
offset(r=phone_radius)(
|
square([phone_width - 4 * phone_radius, phone_height - 4 * phone_radius])
|
||||||
square([phone_width - 4 * phone_radius, phone_height - 4 * phone_radius])
|
)
|
||||||
)
|
)
|
||||||
)
|
) - translate(v=(phone_width - PCB_WIDTH, phone_radius, -1 * thickness / 2 + window_thickness))(
|
||||||
) - translate(v=(phone_width - PCB_WIDTH, phone_radius, -1 * thickness / 2 + window_thickness))(
|
scale(v=(1, 1, thickness))(
|
||||||
scale(v=(1, 1, thickness))(
|
offset(r=PCB_RADIUS)(
|
||||||
offset(r=PCB_RADIUS)(
|
square([PCB_WIDTH - 2 * PCB_RADIUS, PCB_HEIGHT - 2 * PCB_RADIUS])
|
||||||
square([PCB_WIDTH - 2 * PCB_RADIUS, PCB_HEIGHT - 2 * PCB_RADIUS])
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ from solid import scad_render_to_file
|
||||||
from key_mat import key_mat, key
|
from key_mat import key_mat, key
|
||||||
from pcb import pcb
|
from pcb import pcb
|
||||||
from phone import phone
|
from phone import phone
|
||||||
|
from lower_case import lower_case
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
|
|
@ -61,6 +62,11 @@ def cli(layout, variant, stl, emf, amf, detail, config_file):
|
||||||
key_height=config.getfloat("key_mat", "key_height", fallback=6),
|
key_height=config.getfloat("key_mat", "key_height", fallback=6),
|
||||||
key_padding=config.getfloat("key_mat", "padding", fallback=1)
|
key_padding=config.getfloat("key_mat", "padding", fallback=1)
|
||||||
)],
|
)],
|
||||||
|
["lower_case", lower_case(
|
||||||
|
phone_width=config.getfloat("phone", "width"),
|
||||||
|
phone_height=config.getfloat("phone", "height"),
|
||||||
|
phone_radius=config.getfloat("phone", "corner_radius")
|
||||||
|
)],
|
||||||
["test_key_mat", key_mat(
|
["test_key_mat", key_mat(
|
||||||
margin=config.getfloat("key_mat", "margin", fallback=1),
|
margin=config.getfloat("key_mat", "margin", fallback=1),
|
||||||
padding=config.getfloat("key_mat", "padding", fallback=1),
|
padding=config.getfloat("key_mat", "padding", fallback=1),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue