blah
This commit is contained in:
commit
2982f34049
@ -2,17 +2,41 @@
|
|||||||
|
|
||||||
import cadquery as cq
|
import cadquery as cq
|
||||||
|
|
||||||
from utils import punch_hole
|
from utils import extrude_shape, punch_hole
|
||||||
|
|
||||||
# The hole is for a random USB sound card.
|
# The hole is for a random USB sound card.
|
||||||
# Consumers should set proper offsets for the hole
|
# Consumers should set proper offsets for the hole
|
||||||
|
|
||||||
|
# FIXME: use actual sizes
|
||||||
|
item_w = 40
|
||||||
|
item_h = 20
|
||||||
|
|
||||||
|
hole_w = 17
|
||||||
|
hole_h = 5
|
||||||
|
|
||||||
holes = [
|
holes = [
|
||||||
# 2-jack plug
|
# 2-jack plug
|
||||||
{
|
{
|
||||||
"x": 0,
|
"x": -item_h / 2,
|
||||||
"y": 4,
|
"y": 4,
|
||||||
"shape": cq.Sketch().trapezoid(17, 5, 90, mode="a").vertices().fillet(2),
|
"shape": cq.Sketch()
|
||||||
|
.trapezoid(hole_w, hole_h, 90, mode="a")
|
||||||
|
.vertices()
|
||||||
|
.fillet(2),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
elements = [
|
||||||
|
# Outline
|
||||||
|
{
|
||||||
|
"x": item_w / 2,
|
||||||
|
"y": item_h / 2,
|
||||||
|
"shape": (
|
||||||
|
cq.Sketch()
|
||||||
|
.trapezoid(item_w, item_h, 90, mode="a")
|
||||||
|
.trapezoid(item_w - 2, item_h - 2, 90, mode="s")
|
||||||
|
),
|
||||||
|
"height": 0.2,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -29,6 +53,19 @@ def add(
|
|||||||
back_face,
|
back_face,
|
||||||
shell_t
|
shell_t
|
||||||
):
|
):
|
||||||
|
# Extrusions
|
||||||
|
if bottom_face:
|
||||||
|
for element in elements:
|
||||||
|
model = extrude_shape(
|
||||||
|
model=model,
|
||||||
|
face=bottom_face,
|
||||||
|
w=width,
|
||||||
|
h=height,
|
||||||
|
x_offset=offset_x,
|
||||||
|
y_offset=offset_y,
|
||||||
|
element=element,
|
||||||
|
height=-(element["height"] + shell_t),
|
||||||
|
)
|
||||||
|
|
||||||
# Holes
|
# Holes
|
||||||
if back_face:
|
if back_face:
|
||||||
@ -37,11 +74,11 @@ def add(
|
|||||||
model=model,
|
model=model,
|
||||||
face=back_face,
|
face=back_face,
|
||||||
# FIXME: This is weird because it's the RIGHT side,
|
# FIXME: This is weird because it's the RIGHT side,
|
||||||
# So it's height instead of w
|
# So it's height instead of w, offset_y instead of x
|
||||||
# need to work on making these coherent
|
# need to work on making these coherent
|
||||||
w=height,
|
w=height,
|
||||||
h=thickness,
|
h=thickness,
|
||||||
x_offset=offset_x - 17 / 2,
|
x_offset=height - offset_y,
|
||||||
y_offset=shell_t,
|
y_offset=shell_t,
|
||||||
hole=hole,
|
hole=hole,
|
||||||
depth=shell_t,
|
depth=shell_t,
|
||||||
|
@ -106,7 +106,6 @@ def add(
|
|||||||
back_face,
|
back_face,
|
||||||
shell_t
|
shell_t
|
||||||
):
|
):
|
||||||
|
|
||||||
if bottom_face:
|
if bottom_face:
|
||||||
# Vents
|
# Vents
|
||||||
for vent in vents:
|
for vent in vents:
|
||||||
|
@ -29,7 +29,6 @@ def add(
|
|||||||
back_face,
|
back_face,
|
||||||
shell_t
|
shell_t
|
||||||
):
|
):
|
||||||
|
|
||||||
# Holes
|
# Holes
|
||||||
if back_face:
|
if back_face:
|
||||||
for hole in holes:
|
for hole in holes:
|
||||||
|
@ -55,7 +55,6 @@ def add(
|
|||||||
back_face,
|
back_face,
|
||||||
shell_t
|
shell_t
|
||||||
):
|
):
|
||||||
|
|
||||||
# This one is special, it creates angled things and cuts off the
|
# This one is special, it creates angled things and cuts off the
|
||||||
# case, so ... it's going to do weird stuff
|
# case, so ... it's going to do weird stuff
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -67,7 +67,6 @@ def model():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
model = model()
|
model = model()
|
||||||
exporters.export(model, "lid.stl")
|
exporters.export(model, "lid.stl")
|
||||||
|
|
||||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 223 KiB |
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 754 KiB |
@ -1,5 +1,6 @@
|
|||||||
import cadquery as cq
|
import cadquery as cq
|
||||||
from cadquery import exporters
|
from cadquery import exporters
|
||||||
|
from cq_warehouse.drafting import Draft
|
||||||
|
|
||||||
import audio_plug
|
import audio_plug
|
||||||
import battery_holder
|
import battery_holder
|
||||||
@ -96,9 +97,9 @@ def model():
|
|||||||
width=width,
|
width=width,
|
||||||
height=height,
|
height=height,
|
||||||
thickness=thickness,
|
thickness=thickness,
|
||||||
offset_x=111, # Offset from the front-left corner
|
offset_x=width - audio_plug.item_w,
|
||||||
offset_y=0, # Offset from the bottom
|
offset_y=40,
|
||||||
bottom_face=None,
|
bottom_face="<Z",
|
||||||
back_face=">X",
|
back_face=">X",
|
||||||
shell_t=shell_t,
|
shell_t=shell_t,
|
||||||
)
|
)
|
||||||
@ -169,7 +170,6 @@ def model():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
model = model()
|
model = model()
|
||||||
|
|
||||||
left_cutout = cq.Sketch().polygon(
|
left_cutout = cq.Sketch().polygon(
|
||||||
@ -209,5 +209,38 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
exporters.export(left_side, "left_side.stl")
|
exporters.export(left_side, "left_side.stl")
|
||||||
|
|
||||||
|
draft = Draft(decimal_precision=1)
|
||||||
|
dimensions = []
|
||||||
|
dimensions.append(
|
||||||
|
draft.extension_line(
|
||||||
|
object_edge=[
|
||||||
|
cq.Vertex.makeVertex(-width / 2, -height / 2, 0),
|
||||||
|
cq.Vertex.makeVertex(width / 2, -height / 2, 0),
|
||||||
|
],
|
||||||
|
offset=10.0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
dimensions.append(
|
||||||
|
draft.extension_line(
|
||||||
|
object_edge=[
|
||||||
|
cq.Vertex.makeVertex(width / 2, -height / 2, 0),
|
||||||
|
cq.Vertex.makeVertex(width / 2, height / 2, 0),
|
||||||
|
],
|
||||||
|
offset=10.0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
exporters.export(model, "model.stl")
|
exporters.export(model, "model.stl")
|
||||||
exporters.export(model, "model.svg", opt={"projectionDir": (0, 0, 1)})
|
|
||||||
|
for d in dimensions[1:]:
|
||||||
|
dimensions[0].add(d.toCompound())
|
||||||
|
dimensions[0].add(model)
|
||||||
|
|
||||||
|
exporters.export(
|
||||||
|
dimensions[0].toCompound(),
|
||||||
|
"model.svg",
|
||||||
|
opt={
|
||||||
|
"projectionDir": (0, 0, 1),
|
||||||
|
"strokeWidth": 0.3,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -132,7 +132,6 @@ def model():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
print("Exporting")
|
print("Exporting")
|
||||||
exporters.export(model(), "screen_mount.stl")
|
exporters.export(model(), "screen_mount.stl")
|
||||||
|
|
||||||
|
Binary file not shown.
@ -47,7 +47,6 @@ def add(
|
|||||||
shell_t
|
shell_t
|
||||||
):
|
):
|
||||||
if bottom_face:
|
if bottom_face:
|
||||||
|
|
||||||
# Mounting pillars
|
# Mounting pillars
|
||||||
for element in elements:
|
for element in elements:
|
||||||
model = extrude_shape(
|
model = extrude_shape(
|
||||||
|
@ -26,7 +26,21 @@ elements = [
|
|||||||
cq.Sketch().trapezoid(22, 10, 90, mode="a").trapezoid(17, 10, 90, mode="s")
|
cq.Sketch().trapezoid(22, 10, 90, mode="a").trapezoid(17, 10, 90, mode="s")
|
||||||
),
|
),
|
||||||
"height": 8,
|
"height": 8,
|
||||||
}
|
},
|
||||||
|
# Outline
|
||||||
|
{
|
||||||
|
"x": 0,
|
||||||
|
"y": 35,
|
||||||
|
"shape": (
|
||||||
|
cq.Sketch()
|
||||||
|
# FIXME: use actual size
|
||||||
|
.trapezoid(17, 70, 90, mode="a")
|
||||||
|
.trapezoid(15, 68, 90, mode="s")
|
||||||
|
.vertices()
|
||||||
|
.fillet(3)
|
||||||
|
),
|
||||||
|
"height": 0.2,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +56,6 @@ def add(
|
|||||||
back_face,
|
back_face,
|
||||||
shell_t
|
shell_t
|
||||||
):
|
):
|
||||||
|
|
||||||
# USB Hub extrusions
|
# USB Hub extrusions
|
||||||
if bottom_face:
|
if bottom_face:
|
||||||
for element in elements:
|
for element in elements:
|
||||||
@ -51,8 +64,8 @@ def add(
|
|||||||
face=bottom_face,
|
face=bottom_face,
|
||||||
w=width,
|
w=width,
|
||||||
h=height,
|
h=height,
|
||||||
x_offset=263, # offset_x,
|
x_offset=offset_x,
|
||||||
y_offset=0, # shell_t + offset_y,
|
y_offset=shell_t + offset_y,
|
||||||
element=element,
|
element=element,
|
||||||
height=-(element["height"] + shell_t),
|
height=-(element["height"] + shell_t),
|
||||||
)
|
)
|
||||||
|
@ -66,7 +66,6 @@ def add(
|
|||||||
back_face,
|
back_face,
|
||||||
shell_t
|
shell_t
|
||||||
):
|
):
|
||||||
|
|
||||||
if bottom_face:
|
if bottom_face:
|
||||||
# Vents
|
# Vents
|
||||||
for vent in vents:
|
for vent in vents:
|
||||||
|
Loading…
Reference in New Issue
Block a user