Skip to content

Commit

Permalink
Baseplate holes proper positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
JGrzybowski committed Nov 12, 2024
1 parent 0906c85 commit fd7578f
Show file tree
Hide file tree
Showing 2 changed files with 703 additions and 704 deletions.
23 changes: 12 additions & 11 deletions boxes/generators/hobbycase.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class HobbyCase(Boxes):

def __init__(self) -> None:
super().__init__()
self.debug = None
self.add_rails = True
self.add_cover = True
self.addSettingsArgs(boxes.edges.FingerJointSettings)
Expand All @@ -48,9 +49,6 @@ def __init__(self) -> None:


def prepare(self):
self.margin_x = 0.75
self.margin_y = 0.75

self.cols = len(self.unit_w)

self.sum_w = sum(self.unit_w)
Expand Down Expand Up @@ -84,7 +82,7 @@ def top_and_bottom(self, move="up"):

def slotsHolesCallback(self):
for row in range(1, self.rows):
posy = row * self.unit_h + (row + 0.5) * self.thickness
posy = 0.5 * self.thickness + row * (self.unit_h + self.thickness)
self.fingerHolesAt(0, posy, self.internal_depth, angle=0)

def verticalWall(self, x, y, edges=None, move=None, label=None):
Expand Down Expand Up @@ -134,7 +132,7 @@ def shelves(self, move="up"):
def railSet(self, sideLength, backLength, move=None):
self.ctx.save()
self.rectangularWall( sideLength,0, "feSe", move="right")
self.rectangularWall( backLength,0, "feSe", move="right")
self.rectangularWall( backLength-8*self.thickness,0, "feSe", move="right")
self.rectangularWall( sideLength,0, "feSe", move="right")
self.move(2*sideLength+backLength, 3*self.thickness, move)

Expand All @@ -145,15 +143,14 @@ def rails(self, move="up"):

def vertical_holes_callback(self):
for col in range(1, self.cols):
posx = sum(self.unit_w[:col]) + col * 2 * self.thickness
posy = 1.5 * self.thickness
self.doubleFingerHolesAt(posx, posy, self.total_h, angle=90)
posx = self.thickness + sum(self.unit_w[:col]) + (col-1) * 2 * self.thickness
self.doubleFingerHolesAt(posx, 0, self.total_h, angle=90)

def horizontal_holes_callback(self):
for col in range(self.cols):
for row in range(1, self.rows):
posx = self.thickness + sum(self.unit_w[:col]) + col * 2 * self.thickness
posy = self.thickness + row * self.unit_h + row * self.thickness + 0.75 * self.thickness
posx = sum(self.unit_w[:col]) + col * 2 * self.thickness
posy = 0.5 * self.thickness + row * (self.unit_h + self.thickness)
self.fingerHolesAt(posx, posy, self.unit_w[col], angle=0)

def baseplate_callback(self):
Expand All @@ -162,10 +159,14 @@ def baseplate_callback(self):

def base_plate(self, move="up"):
self.rectangularWall(self.total_w, self.total_h, "FFFF",
callback=[self.baseplate_callback()],
callback=[self.baseplate_callback],
label="base plate\n(%ix%i)" % (self.total_w, self.total_h), move=move)

def render(self) -> None:
if self.debug:
self.spacing = 0
else:
self.spacing = 10
self.prepare()
self.base_plate()
self.shelves()
Expand Down
Loading

0 comments on commit fd7578f

Please sign in to comment.