Skip to content
Snippets Groups Projects
Unverified Commit 7a3c4114 authored by Jennifer Mankoff's avatar Jennifer Mankoff
Browse files

prints the top but NOT the inserts

parent 114a0c69
No related branches found
No related tags found
No related merge requests found
[submodule "boxes"]
path = boxes
url = https://github.com/florianfesti/boxes.git
Subproject commit 6174b32dd000c15763d5371930d98858d9b2e099
insert.py 0 → 100644
import os
import sys
sys.path.insert(0, os.getcwd()+"/boxes")
from boxes import *;
import svgwrite;
# Some useful information about boxes
# Edge types:
# 'C': 'Click on (top)',
# 'D': 'Dove Tail Joint (opposing side)',
# 'E': 'Straight Edge (outset by thickness)',
# 'F': 'Finger Joint (opposing side)',
# 'G': 'Edge with pear shaped mounting holes',
# 'I': 'Edge with hinge pin',
# 'J': 'Edge with hinge pin (other end)',
# 'K': 'Edge with hinge pin (both ends)',
# 'L': 'Edge for slide on lid (box back)',
# 'M': 'Edge for slide on lid (box left)',
# 'N': 'Edge for slide on lid (box right)',
# 'O': 'Edge with chest hinge (other end)',
# 'P': 'Edge with chest hinge (other end)',
# 'Q': 'Edge opposing a chest hinge',
# 'R': 'Rack (and pinion) Edge',
# 'S': 'Stackable (top)',
# 'T': 'Triangle for handle',
# 'U': 'Edge with cabinet hinges top side',
# 'V': 'Edge with cabinet hinges 90° lid',
# 'X': 'Flex cut',
# 'Y': 'Handle with holes for parallel finger joint',
# 'Z': 'Edge with grooves (opposing side)',
# 'c': 'Click on (bottom side)',
# 'd': 'Dove Tail Joint',
# 'e': 'Straight Edge',
# 'f': 'Finger Joint',
# 'g': 'Corrugated edge useful as an gipping area',
# 'h': 'Edge (parallel Finger Joint Holes)',
# 'i': 'Straight edge with hinge eye',
# 'j': 'Straight edge with hinge eye (other end)',
# 'k': 'Straight edge with hinge eye (both ends)',
# 'l': 'Edge for slide on lid (back)',
# 'm': 'Edge for slide on lid (left)',
# 'n': 'Edge for slide on lid (right)',
# 'o': 'Edge with chest hinge',
# 'p': 'Edge with chest hinge',
# 'q': 'Edge with pins for an chest hinge',
# 's': 'Stackable (bottom, finger joint holes)',
# 't': 'Triangle for handle',
# 'u': 'Edge with cabinet hinges',
# 'v': 'Edge with cabinet hinges for 90° lid',
# 'y': 'Handle for e.g. a drawer',
# 'z': 'Edge with grooves',
# '|': 'Edge (orthogonal Finger Joint Holes)',
# 'Š': 'Stackable edge with finger holes (top)',
# 'š': 'Stackable feet (bottom)'
class ShelfInsert(Boxes):
"""Example: Single Shelve to screw to the wall"""
ui_group = "Shelves" # change for generators belonging in another group
def __init__(self):
Boxes.__init__(self)
# arguments
self.addSettingsArgs(edges.FingerJointSettings, finger=3.0) # arguments for finger joints
self.buildArgParser("sx", "sy", "h", "outside")
@property
def fingerholedepth(self):
if self.fingerhole == 'custom':
return self.fingerhole_depth
elif self.fingerhole == 'regular':
a = self.h/4
if a < 35:
return a
else:
return 35
elif self.fingerhole == 'deep':
return self.h-self.thickness-10
elif self.fingerhole == 'none':
return 0
def xSlots(self):
posx = -0.5 * self.thickness
for x in self.sx[:-1]:
posx += x + self.thickness
posy = 0
for y in self.sy:
self.fingerHolesAt(posx, posy, y)
posy += y + self.thickness
def ySlots(self):
posy = -0.5 * self.thickness
for y in self.sy[:-1]:
posy += y + self.thickness
posx = 0
for x in reversed(self.sx):
self.fingerHolesAt(posy, posx, x)
posx += x + self.thickness
def xHoles(self):
posx = -0.5 * self.thickness
for x in self.sx[:-1]:
posx += x + self.thickness
self.fingerHolesAt(posx, 0, self.hi)
def yHoles(self):
posy = -0.5 * self.thickness
for y in self.sy[:-1]:
posy += y + self.thickness
self.fingerHolesAt(posy, 0, self.hi)
def render(self):
if self.outside:
self.sx = self.adjustSize(self.sx)
self.sy = self.adjustSize(self.sy)
self.h = self.adjustSize(self.h, e2=False)
x = sum(self.sx) + self.thickness * (len(self.sx) - 1)
y = sum(self.sy) + self.thickness * (len(self.sy) - 1)
h = self.h
t = self.thickness
# floor
self.rectangularWall(x, y, "eeee", callback=[self.xSlots, self.ySlots], move="up", label="top")
# Inner walls
be = "f" if b != "e" else "e"
######
for i in range(len(self.sy) - 1):
#edge1 = edges.SlottedEdge(self, self.sx, be)
#print(edge1)
print(self.sx[::-1])
e = edges.SlottedEdge(boxes=self, sections=self.sx[::-1], slots=0.5 * h)
#print(edge2 + "f")
# self.rectangularWall(x, h, [edge1, "f", edge2, "f"], move="up", label=f"inner x {i+1}")
#self.rectangularWall(x, h, [e, "e", "e", "e"], move="up", label=f"inner x {i+1}")
# inner walls
for i in range(len(self.sx) - 1):
e = [edges.SlottedEdge(self, self.sy, be, slots=0.5 * h),
"f", "e", "f"]
#self.rectangularWall(y, h, #e [e,"e","e","e"], move="up", label=f"inner y {i+1}")
# inner walls
# for i in range(len(self.sx) - 1):
# e = [edges.SlottedEdge(self, self.sy, be, slots=0.5 * hi),
# "f", "e", "f"]
# if self.closedtop and sameh:
# e = [edges.SlottedEdge(self, self.sy, be, slots=0.5 * hi),"f",
# edges.SlottedEdge(self, self.sy[::-1], "f"), "f"]
# self.rectangularWall(y, hi, e, move="up", label=f"inner y {i+1}")
b = ShelfInsert()
b.parseArgs(['--sx=50*4', '--sy=50*2', '--h=26', '--reference=0', '--debug=0'])
b.open()
b.render()
data = b.close()
with open("shelfInsert.svg","wb") as file:
file.write(bytes(data.getvalue()))
file.close()
affine==2.4.0
alabaster==0.7.13
Babel==2.14.0
certifi==2024.6.2
charset-normalizer==3.3.2
click==8.1.7
docutils==0.19
Flask==2.2.5
geos==0.2.3
idna==3.7
imagesize==1.4.1
importlib-metadata==6.7.0
itsdangerous==2.1.2
Jinja2==3.1.4
lxml==5.2.2
Markdown==3.4.4
MarkupSafe==2.1.5
numpy==1.21.6
packaging==24.0
Pillow==9.5.0
Pygments==2.17.2
pypng==0.20220715.0
pytz==2024.1
qrcode==7.4.2
requests==2.31.0
shapely==2.0.4
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
svgwrite==1.4.3
typing_extensions==4.7.1
urllib3==2.0.7
Werkzeug==2.2.3
zipp==3.15.0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment