import sand3d as s3d
def cabinet_parts_sheet_layout():
sheet_layout = sheet_layout_body()
return s3d.assembly(class="tok-string">"cabinet_parts_sheet_layout", sheet_layout)
def sheet_layout_body():
plywood_sheet = s3d.transform(block(class="tok-string">"plywood_sheet", sx=2432.05, sy=1212.85, sz=15.88), z=7.94)
cabinet_side_panel_1 = s3d.transform(cabinet_side_panel(class="tok-string">"cabinet_side_panel_1"), x=695.32, y=320.68, z=23.81, ry=90)
cabinet_base_panel_1 = s3d.transform(
block(class="tok-string">"cabinet_base_panel_1", sx=571.5, sy=571.5, sz=15.88), x=-38.1, y=320.67, z=23.81
)
cabinet_base_panel_2 = s3d.transform(
block(class="tok-string">"cabinet_base_panel_2", sx=571.5, sy=571.5, sz=15.88), x=-38.1, y=-254, z=23.81
)
cabinet_side_panel_2 = s3d.transform(cabinet_side_panel(class="tok-string">"cabinet_side_panel_2"), x=-771.52, y=-254, z=23.81, ry=-90)
cabinet_side_panel_3 = s3d.transform(
cabinet_side_panel(class="tok-string">"cabinet_side_panel_3"), x=-771.52, y=320.68, z=23.81, ry=-90
)
cabinet_side_panel_4 = s3d.transform(cabinet_side_panel(class="tok-string">"cabinet_side_panel_4"), x=695.33, y=-254, z=23.81, ry=90)
return s3d.group(
class="tok-string">"sheet_layout",
plywood_sheet,
cabinet_side_panel_1,
cabinet_base_panel_1,
cabinet_base_panel_2,
cabinet_side_panel_2,
cabinet_side_panel_3,
cabinet_side_panel_4,
)
def block(name, sx, sy, sz):
return s3d.extrude(name, s3d.rect(sx, sy), sz, both=True)
def cabinet_side_panel(name, thickness=15.88, depth=571.5, height=889):
step_y = depth / 12
step_z = height / 10
outline = [
(-depth / 2, -height / 2),
(-depth / 2 + step_y, -height / 2),
(-depth / 2 + step_y, -height / 2 + step_z),
(-depth / 2, -height / 2 + step_z),
(-depth / 2, height / 2),
(depth / 2, height / 2),
(depth / 2, -height / 2),
]
panel = s3d.extrude(name, s3d.poly(outline), thickness, both=True)
panel = s3d.at(panel, rx=90, rz=90)
drill_holes(panel, depth, height)
return panel
def drill_holes(panel, depth, height):
positions = s3d.grid(
1,
5,
py=height / 7,
on=s3d.bbox(panel, class="tok-string">"+X").move(y=-depth / 2 + 25, z=-height / 2 + height / 4),
)
s3d.hole(panel, 2, on=positions)