Skip to content

Commit

Permalink
Create slidingdrawer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
HaSHsss authored and florianfesti committed Jul 9, 2022
1 parent 13170f0 commit bf84ee1
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
50 changes: 50 additions & 0 deletions boxes/generators/slidingdrawer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from boxes import *

class SlidingDrawer(Boxes):
"""Sliding drawer box"""

ui_group = "Box"

def __init__(self):
Boxes.__init__(self)
self.buildArgParser(x=60, y=100, h=30, outside='true')
self.addSettingsArgs(edges.FingerJointSettings, finger=2.0, space=2.0)
self.addSettingsArgs(edges.GroovedSettings, width=0.4)

self.argparser.add_argument(
"--play", action="store", type=float, default=0.15,
help="play between the two parts as multipleof the wall thickness")

def render(self):

x, y, h = self.x, self.y, self.h
x = self.adjustSize(x)
y = self.adjustSize(y)
h = self.adjustSize(h)

t = self.thickness
p = self.play * t

y = y + t
if not self.outside:
x = x + 4*t+ 2*p
y = y + 3*t+ 2*p
h = h + 3*t+ 2*p

x2 = x - (2*t + 2*p)
y2 = y - (2*t + 2*p)
h2 = h - (t + 2*p)

self.rectangularWall(x2, h2, "FFzF", label="in box wall", move="right")
self.rectangularWall(y2, h2, "ffef", label="in box wall", move="up")
self.rectangularWall(y2, h2, "ffef", label="in box wall")
self.rectangularWall(x2, h2, "FFeF", label="in box wall", move="left up")
self.rectangularWall(y2, x2, "FfFf", label="in box bottom", move="up")

self.rectangularWall(y, x, "FFFe", label="out box bottom", move="right")
self.rectangularWall(y, x, "FFFe", label="out box top", move="up")
self.rectangularWall(y, h, "fffe", label="out box wall")
self.rectangularWall(y, h, "fffe", label="out box wall", move="up left")

self.rectangularWall(x, h, "fFfF", label="out box wall")

Binary file added static/samples/SlidingDrawer-thumb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/samples/SlidingDrawer.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/samples/samples.sha256
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ b843c04a6ec530afaf40c664479c6f1eeadc9d48f1ff7ca99bea3575da733144 ../static/samp
3735a8b49edf905d11384ee50b49a543245bf21c1640672887208cdee8dae393 ../static/samples/WallSlottedHolder.jpg
42aee460ccffbd7487f748e917f9083fb768a7e2b5f3012f57f8f55c20425ea6 ../static/samples/WallPliersHolder.jpg
1ed8dc40cbbbee9f7782f1b19013f4e60201f6bf0775728da43862d2c95418b5 ../static/samples/Platonic-Icosahedron.jpg
207089f5546205c6f812cf95036f9700d15bb9b830ded6a4667689f2af311b89 ../static/samples/SlidingDrawer.jpg

0 comments on commit bf84ee1

Please sign in to comment.