Missing file
This commit is contained in:
parent
d1e7b589c8
commit
61a723c713
73
notebook_nueva/screen_pillars.py
Normal file
73
notebook_nueva/screen_pillars.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
from utils import extrude_shape, punch_hole2
|
||||||
|
import cadquery as cq
|
||||||
|
|
||||||
|
elements = None
|
||||||
|
bottom_holes = None # Not really vents FIXME
|
||||||
|
|
||||||
|
|
||||||
|
def init(positions, thickness):
|
||||||
|
"""Because these need to match in multiple models, we create the
|
||||||
|
elemments dynamically"""
|
||||||
|
global elements, bottom_holes
|
||||||
|
elements = [
|
||||||
|
{
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"shape": cq.Sketch()
|
||||||
|
.push(positions)
|
||||||
|
.trapezoid(12, 12, 90, mode="a")
|
||||||
|
.circle(1.8, mode="s"),
|
||||||
|
"height": thickness,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
bottom_holes = [
|
||||||
|
{
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"shape": cq.Sketch().push(positions).circle(3, mode="a"),
|
||||||
|
"depth": thickness - 13, # (screw thread length - threaded insert depth)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def add(
|
||||||
|
*,
|
||||||
|
model,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
thickness,
|
||||||
|
offset_x,
|
||||||
|
offset_y,
|
||||||
|
bottom_face,
|
||||||
|
back_face,
|
||||||
|
shell_t
|
||||||
|
):
|
||||||
|
if bottom_face:
|
||||||
|
|
||||||
|
# Mounting pillars
|
||||||
|
for element in elements:
|
||||||
|
model = extrude_shape(
|
||||||
|
model=model,
|
||||||
|
face=bottom_face,
|
||||||
|
w=width,
|
||||||
|
h=height,
|
||||||
|
x_offset=offset_x + element["x"],
|
||||||
|
y_offset=shell_t + offset_y + element["y"],
|
||||||
|
shape=element["shape"],
|
||||||
|
height=-(element["height"] + shell_t),
|
||||||
|
)
|
||||||
|
# Screw holes
|
||||||
|
for hole in bottom_holes:
|
||||||
|
model = punch_hole2(
|
||||||
|
model=model,
|
||||||
|
face=bottom_face,
|
||||||
|
w=width,
|
||||||
|
h=height,
|
||||||
|
x_offset=offset_x + hole["x"],
|
||||||
|
y_offset=shell_t + offset_y + hole["y"],
|
||||||
|
hole=hole,
|
||||||
|
depth=hole["depth"],
|
||||||
|
)
|
||||||
|
|
||||||
|
return model
|
Loading…
Reference in New Issue
Block a user