yacwc
This commit is contained in:
73
workbench_drawers.py
Normal file
73
workbench_drawers.py
Normal file
@@ -0,0 +1,73 @@
|
||||
import os
|
||||
import importlib as ir
|
||||
from cadquery import exporters as et
|
||||
root_dir = r'C:\\Users\\TheBears\\Seafile\\Designs\\Projects\\kickdrawers\\cadfree\\code'
|
||||
os.chdir(root_dir)
|
||||
|
||||
import items as it
|
||||
import math
|
||||
import util as u
|
||||
import cadquery as cq
|
||||
ir.reload(it)
|
||||
ir.reload(u)
|
||||
|
||||
objs = list()
|
||||
|
||||
# Base parameters
|
||||
add_the_fingers = True
|
||||
r_hole = 4.6/2
|
||||
add_holes = True
|
||||
t_large = 3.175
|
||||
box_height = 1 * 25.4
|
||||
box_depth = 22*25.4
|
||||
box_width = 10 * 25.4
|
||||
slider_thickness = 13.28
|
||||
cabinet_height = 20 * 25.4
|
||||
cabinet_hole_spacing = 25.4
|
||||
|
||||
back_depth = 25
|
||||
|
||||
|
||||
settings = {'w':box_width, 'd':box_depth, 'h':box_height,
|
||||
't_large':t_large, 'add_holes':add_holes, 'r_hole':r_hole,
|
||||
'add_fingers':add_the_fingers, 'slide_flavor':'24inch','vert_tabs':3,
|
||||
'slide_on_bottom': False, 'front_pts':'24inch'}
|
||||
|
||||
yz_wp = lambda: cq.Workplane('YZ')
|
||||
xz_wp = lambda: cq.Workplane('XZ')
|
||||
|
||||
|
||||
|
||||
# Make drawers
|
||||
drawer_1 = it.create_drawer(**settings ).add_tag('drawer_1');
|
||||
for idx, ed in enumerate(drawer_1):
|
||||
drawer_1[idx] = ed.translate((t_large+slider_thickness,0,0))
|
||||
objs.append(drawer_1)
|
||||
|
||||
|
||||
|
||||
|
||||
panel_depth = box_depth + back_depth
|
||||
ar1 = u.add_rect(yz_wp(), panel_depth, cabinet_height).extrude(t_large).translate((0,0,0))
|
||||
ar2 = u.add_rect(yz_wp(), panel_depth, cabinet_height).extrude(t_large).translate((box_width+ 2* slider_thickness + t_large ,0,0))
|
||||
ar3 = u.add_rect(xz_wp(), box_width+2*slider_thickness + 2*t_large, cabinet_height).extrude(t_large).translate((0,box_depth+back_depth,0))
|
||||
|
||||
ar1, ar3, _ = u.do_fingers(ar1, ar3)
|
||||
ar2, ar3, _ = u.do_fingers(ar2, ar3)
|
||||
|
||||
|
||||
for i in range(math.floor(cabinet_height/cabinet_hole_spacing)):
|
||||
|
||||
pts_f = u.slide_pts(panel_depth, cabinet_hole_spacing/2, offset_from_back=47+2, spacing=(64, 351, 64))
|
||||
extr = yz_wp().pushPoints(pts_f).slot2D(10, r_hole*2).extrude(box_depth + 2*slider_thickness + 2*t_large).translate((0,0,i*cabinet_hole_spacing))
|
||||
ar1 = ar1.cut(extr)
|
||||
ar2 = ar2.cut(extr)
|
||||
|
||||
objs.append([ar1,ar2, ar3])
|
||||
|
||||
|
||||
for x in objs:
|
||||
for o in x:
|
||||
show_object(o)
|
||||
|
||||
u.save_stls(objs, os.path.join(root_dir,'workbench'),'wkbench')
|
||||
Reference in New Issue
Block a user