mirror of
https://github.com/Proteus-Typer/model-a.git
synced 2025-09-17 10:48:10 +00:00
Compare commits
1 Commits
f37a4d8d00
...
assemblies
Author | SHA1 | Date | |
---|---|---|---|
25c184723d |
0
.gitattributes
vendored
0
.gitattributes
vendored
2
.gitignore
vendored
2
.gitignore
vendored
@@ -174,5 +174,3 @@ poetry.toml
|
|||||||
pyrightconfig.json
|
pyrightconfig.json
|
||||||
|
|
||||||
.lint
|
.lint
|
||||||
*right*stl
|
|
||||||
*left*stl
|
|
||||||
|
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@@ -7,8 +7,7 @@
|
|||||||
"emeraldwalk.RunOnSave",
|
"emeraldwalk.RunOnSave",
|
||||||
"ms-vscode.makefile-tools",
|
"ms-vscode.makefile-tools",
|
||||||
"ms-python.python",
|
"ms-python.python",
|
||||||
"mtsmfm.vscode-stl-viewer",
|
"mtsmfm.vscode-stl-viewer"
|
||||||
"sndst00m.vscode-native-svg-preview",
|
|
||||||
],
|
],
|
||||||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
||||||
"unwantedRecommendations": [
|
"unwantedRecommendations": [
|
||||||
|
2
Makefile
2
Makefile
@@ -8,7 +8,7 @@ all: $(STL_FILES) lint
|
|||||||
lint: .lint
|
lint: .lint
|
||||||
|
|
||||||
.lint: *.py components/*.py
|
.lint: *.py components/*.py
|
||||||
black *.py */*.py
|
|
||||||
flake8
|
flake8
|
||||||
|
black *.py */*.py
|
||||||
touch .lint
|
touch .lint
|
||||||
|
|
||||||
|
40
assembly.py
Normal file
40
assembly.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import cadquery as cq
|
||||||
|
|
||||||
|
import base
|
||||||
|
import simple_lid
|
||||||
|
|
||||||
|
base = base.model()
|
||||||
|
lid = simple_lid.model()
|
||||||
|
# kbd =
|
||||||
|
|
||||||
|
compu = (
|
||||||
|
cq.Assembly()
|
||||||
|
.add(base, name="base", color=cq.Color("red"))
|
||||||
|
.add(lid, name="lid", color=cq.Color("green"))
|
||||||
|
)
|
||||||
|
|
||||||
|
compu.constrain("base@faces@<X", "lid@faces@<X", "Plane", param=0)
|
||||||
|
# compu.constrain("base@faces@>Y", "lid@faces@>Y", "Plane", param=0)
|
||||||
|
# compu.constrain("base@faces@>X", "lid@faces@>X", "Plane", param=0)
|
||||||
|
compu.constrain("base@faces@>Z", "lid?bottom", "Plane")
|
||||||
|
|
||||||
|
|
||||||
|
# def pk(p):
|
||||||
|
# c = p.Center()
|
||||||
|
# return (c.x, c.y, c.z)
|
||||||
|
|
||||||
|
|
||||||
|
# lid_holes = sorted(
|
||||||
|
# [x for x in lid.faces("|Z").edges("%CIRCLE").vals() if x.radius() == 2 and x.Closed()], key=pk
|
||||||
|
# )
|
||||||
|
# base_holes = sorted(
|
||||||
|
# [x for x in base.faces(">Z").edges("%CIRCLE").vals() if x.radius() == 1.8], key=pk
|
||||||
|
# )
|
||||||
|
# print(len(lid_holes), len(base_holes))
|
||||||
|
# # Holes of diam 2 on the top lid and 1.8 in the base
|
||||||
|
# for a, b in list(zip(lid_holes, base_holes)):
|
||||||
|
# compu.constrain("lid", a, "base", b, "Point")
|
||||||
|
|
||||||
|
|
||||||
|
compu.solve(5)
|
||||||
|
compu.save("compu.step")
|
1
base.py
1
base.py
@@ -110,6 +110,7 @@ def model():
|
|||||||
back_face=None,
|
back_face=None,
|
||||||
shell_t=dim.shell_t,
|
shell_t=dim.shell_t,
|
||||||
)
|
)
|
||||||
|
model.mounting_holes = [x for x in model.faces(">Z").edges("%CIRCLE").vals() if x.radius()==1.8]
|
||||||
|
|
||||||
model = keyboard.add(
|
model = keyboard.add(
|
||||||
model=model,
|
model=model,
|
||||||
|
BIN
base_left.stl
Normal file
BIN
base_left.stl
Normal file
Binary file not shown.
BIN
base_right.stl
Normal file
BIN
base_right.stl
Normal file
Binary file not shown.
@@ -1,107 +0,0 @@
|
|||||||
import cadquery as cq
|
|
||||||
|
|
||||||
import dimensions as dim
|
|
||||||
from utils import extrude_shape2, hex_vents, punch_hole, export
|
|
||||||
|
|
||||||
|
|
||||||
def model():
|
|
||||||
# Create the basic shape of the case lid
|
|
||||||
model = (
|
|
||||||
cq.Workplane("XY")
|
|
||||||
# Hollow box
|
|
||||||
.box(dim.width, dim.sl_height, dim.sl_thickness)
|
|
||||||
.edges("|Z and >Y")
|
|
||||||
.fillet(2)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Make many holes
|
|
||||||
vent = hex_vents(size=6, width=dim.width * 0.9, height=dim.sl_height * 0.9)[0]
|
|
||||||
model = punch_hole(
|
|
||||||
model=model,
|
|
||||||
face=">Z",
|
|
||||||
w=dim.width,
|
|
||||||
h=dim.sl_height,
|
|
||||||
x_offset=0.05 * dim.width,
|
|
||||||
y_offset=0.05 * dim.sl_height,
|
|
||||||
hole=vent,
|
|
||||||
depth=dim.sl_thickness,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add screw holes
|
|
||||||
for position in dim.mounting_pillar_positions:
|
|
||||||
model = (
|
|
||||||
model.faces(">Z")
|
|
||||||
.workplane(centerOption="CenterOfBoundBox")
|
|
||||||
.center(
|
|
||||||
-dim.width / 2 + position[0],
|
|
||||||
dim.sl_height / 2 - position[1] - dim.shell_t,
|
|
||||||
)
|
|
||||||
.placeSketch(cq.Sketch().circle(dim.m4_top / 2 + 1.5))
|
|
||||||
.extrude(-dim.sl_thickness)
|
|
||||||
.faces(">Z")
|
|
||||||
.workplane(centerOption="CenterOfBoundBox")
|
|
||||||
.center(
|
|
||||||
-dim.width / 2 + position[0],
|
|
||||||
dim.sl_height / 2 - position[1] - dim.shell_t,
|
|
||||||
)
|
|
||||||
.cskHole(dim.m4_bottom, dim.m4_top, 82, depth=None)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add front lip
|
|
||||||
|
|
||||||
model = (
|
|
||||||
model.faces(">Z")
|
|
||||||
.workplane(centerOption="CenterOfBoundBox")
|
|
||||||
.center(0, -dim.sl_height / 2 + dim.sl_lip_thickness / 2)
|
|
||||||
.placeSketch(
|
|
||||||
cq.Sketch().trapezoid(dim.width - 2 * dim.shell_t, dim.sl_lip_thickness, 90)
|
|
||||||
)
|
|
||||||
.extrude(-dim.sl_front_lip - dim.sl_thickness)
|
|
||||||
)
|
|
||||||
|
|
||||||
return model
|
|
||||||
|
|
||||||
|
|
||||||
def decorative_cover():
|
|
||||||
# A decorative thingie to cover the ugly seam in the middle
|
|
||||||
model = cq.Workplane("XY").box(10, dim.sl_height, 1).edges("|Z").fillet(1)
|
|
||||||
vent = hex_vents(
|
|
||||||
size=6, width=dim.width * 0.9, height=dim.sl_height * 0.9, density=0.775
|
|
||||||
)[0]
|
|
||||||
|
|
||||||
model = extrude_shape2(
|
|
||||||
model=model,
|
|
||||||
face=">Z",
|
|
||||||
w=dim.width,
|
|
||||||
h=dim.sl_height,
|
|
||||||
x_offset=0.05 * dim.width,
|
|
||||||
y_offset=0.05 * dim.sl_height,
|
|
||||||
hole=vent,
|
|
||||||
depth=3,
|
|
||||||
)
|
|
||||||
return model
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
model = model()
|
|
||||||
export(model, "simple_lid.stl")
|
|
||||||
|
|
||||||
cover = decorative_cover()
|
|
||||||
export(cover, "simple_lid_cover.stl")
|
|
||||||
|
|
||||||
export(
|
|
||||||
model,
|
|
||||||
"simple_lid.svg",
|
|
||||||
opt={
|
|
||||||
"projectionDir": (0, 0, 1),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
export(
|
|
||||||
model.faces(">X").workplane(offset=-dim.width / 2).split(keepTop=True),
|
|
||||||
"simple_lid_right.stl",
|
|
||||||
)
|
|
||||||
export(
|
|
||||||
model.faces(">X").workplane(offset=-dim.width / 2).split(keepBottom=True),
|
|
||||||
"simple_lid_left.stl",
|
|
||||||
)
|
|
@@ -12,7 +12,7 @@ ti_radius = 2.35
|
|||||||
ti_depth = 6.25
|
ti_depth = 6.25
|
||||||
|
|
||||||
# M3 hex nut dimensions
|
# M3 hex nut dimensions
|
||||||
m3_hn_diam = 6.2
|
m3_hn_diam = 5.5
|
||||||
m3_hn_hole = 3
|
m3_hn_hole = 3
|
||||||
m3_hn_thickness = 2.5
|
m3_hn_thickness = 2.5
|
||||||
|
|
||||||
|
BIN
hinged_lid.stl
BIN
hinged_lid.stl
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 192 KiB |
Binary file not shown.
BIN
hinged_lid_left.stl
Normal file
BIN
hinged_lid_left.stl
Normal file
Binary file not shown.
BIN
hinged_lid_right.stl
Normal file
BIN
hinged_lid_right.stl
Normal file
Binary file not shown.
@@ -12,6 +12,8 @@ def model():
|
|||||||
.box(dim.width, dim.sl_height, dim.sl_thickness)
|
.box(dim.width, dim.sl_height, dim.sl_thickness)
|
||||||
.edges("|Z and >Y")
|
.edges("|Z and >Y")
|
||||||
.fillet(2)
|
.fillet(2)
|
||||||
|
.faces("<Z")
|
||||||
|
.tag("bottom")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Make many holes
|
# Make many holes
|
||||||
@@ -46,6 +48,9 @@ def model():
|
|||||||
)
|
)
|
||||||
.cskHole(dim.m4_bottom, dim.m4_top, 82, depth=None)
|
.cskHole(dim.m4_bottom, dim.m4_top, 82, depth=None)
|
||||||
)
|
)
|
||||||
|
model.mounting_holes = [
|
||||||
|
x for x in model.faces("<Z").edges("%CIRCLE").vals() if x.radius() == 2
|
||||||
|
]
|
||||||
|
|
||||||
# Add front lip
|
# Add front lip
|
||||||
|
|
||||||
|
BIN
simple_lid.stl
BIN
simple_lid.stl
Binary file not shown.
2410
simple_lid.svg
2410
simple_lid.svg
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 227 KiB After Width: | Height: | Size: 227 KiB |
Binary file not shown.
BIN
simple_lid_left.stl
Normal file
BIN
simple_lid_left.stl
Normal file
Binary file not shown.
BIN
simple_lid_right.stl
Normal file
BIN
simple_lid_right.stl
Normal file
Binary file not shown.
BIN
tandy_lid.stl
BIN
tandy_lid.stl
Binary file not shown.
BIN
tandy_lid_left.stl
Normal file
BIN
tandy_lid_left.stl
Normal file
Binary file not shown.
BIN
tandy_lid_right.stl
Normal file
BIN
tandy_lid_right.stl
Normal file
Binary file not shown.
Reference in New Issue
Block a user