mirror of
https://github.com/Proteus-Typer/model-a.git
synced 2024-09-07 21:43:36 +00:00
Experimenting with assembling pieces
This commit is contained in:
parent
c9c10d1c4a
commit
25c184723d
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,
|
||||||
|
@ -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.
Binary file not shown.
BIN
tandy_lid.stl
BIN
tandy_lid.stl
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user