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 9, 2024
1 parent 0906c85 commit 81da6a6
Show file tree
Hide file tree
Showing 2 changed files with 701 additions and 699 deletions.
18 changes: 10 additions & 8 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 @@ -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,15 @@ 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
posx = self.thickness + sum(self.unit_w[:col]) + col * 2 * self.thickness
posy = 2 * self.thickness
self.doubleFingerHolesAt(posx, posy, 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 = 2 * self.thickness + sum(self.unit_w[:col]) + col * 2 * self.thickness
posy = 2 * self.thickness + row * self.unit_h + row * self.thickness
self.fingerHolesAt(posx, posy, self.unit_w[col], angle=0)

def baseplate_callback(self):
Expand All @@ -166,6 +164,10 @@ def base_plate(self, move="up"):
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 81da6a6

Please sign in to comment.