Console and Console2: Add outside parameter
Also rename hi param to front_height in Console
This commit is contained in:
parent
dc0976a416
commit
262d7804a4
|
@ -27,25 +27,33 @@ class Console(Boxes):
|
||||||
self.addSettingsArgs(edges.FingerJointSettings, surroundingspaces=.5)
|
self.addSettingsArgs(edges.FingerJointSettings, surroundingspaces=.5)
|
||||||
self.addSettingsArgs(edges.StackableSettings)
|
self.addSettingsArgs(edges.StackableSettings)
|
||||||
|
|
||||||
self.buildArgParser(x=100, y=100, h=100, hi=30)
|
self.buildArgParser(x=100, y=100, h=100, outside=False)
|
||||||
|
self.argparser.add_argument(
|
||||||
|
"--front_height", action="store", type=float, default=30,
|
||||||
|
help="height of the front below the panel (in mm)")
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
"--angle", action="store", type=float, default=50,
|
"--angle", action="store", type=float, default=50,
|
||||||
help="angle of the front panel (90°=upright)")
|
help="angle of the front panel (90°=upright)")
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
x, y, h, hi = self.x, self.y, self.h, self.hi
|
x, y, h, hf = self.x, self.y, self.h, self.front_height
|
||||||
t = self.thickness
|
t = self.thickness
|
||||||
|
|
||||||
panel = min((h-hi)/math.cos(math.radians(90-self.angle)),
|
if self.outside:
|
||||||
|
self.x = x = self.adjustSize(x)
|
||||||
|
self.y = y = self.adjustSize(y)
|
||||||
|
self.h = h = self.adjustSize(h)
|
||||||
|
|
||||||
|
panel = min((h-hf)/math.cos(math.radians(90-self.angle)),
|
||||||
y/math.cos(math.radians(self.angle)))
|
y/math.cos(math.radians(self.angle)))
|
||||||
top = y - panel * math.cos(math.radians(self.angle))
|
top = y - panel * math.cos(math.radians(self.angle))
|
||||||
h = hi + panel * math.sin(math.radians(self.angle))
|
h = hf + panel * math.sin(math.radians(self.angle))
|
||||||
|
|
||||||
if top>0.1*t:
|
if top>0.1*t:
|
||||||
borders = [y, 90, hi, 90-self.angle, panel, self.angle, top,
|
borders = [y, 90, hf, 90-self.angle, panel, self.angle, top,
|
||||||
90, h, 90]
|
90, h, 90]
|
||||||
else:
|
else:
|
||||||
borders = [y, 90, hi, 90-self.angle, panel, self.angle+90, h, 90]
|
borders = [y, 90, hf, 90-self.angle, panel, self.angle+90, h, 90]
|
||||||
|
|
||||||
self.polygonWall(borders, move="right")
|
self.polygonWall(borders, move="right")
|
||||||
self.polygonWall(borders, move="right")
|
self.polygonWall(borders, move="right")
|
||||||
|
|
|
@ -57,7 +57,8 @@ To remove the panel you have to press in the four tabs at the side. It is easies
|
||||||
self.addSettingsArgs(edges.FingerJointSettings, surroundingspaces=.5)
|
self.addSettingsArgs(edges.FingerJointSettings, surroundingspaces=.5)
|
||||||
self.addSettingsArgs(edges.StackableSettings)
|
self.addSettingsArgs(edges.StackableSettings)
|
||||||
|
|
||||||
self.buildArgParser(x=100, y=100, h=100, bottom_edge="s")
|
self.buildArgParser(x=100, y=100, h=100, bottom_edge="s",
|
||||||
|
outside=False)
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
"--front_height", action="store", type=float, default=30,
|
"--front_height", action="store", type=float, default=30,
|
||||||
help="height of the front below the panel (in mm)")
|
help="height of the front below the panel (in mm)")
|
||||||
|
@ -232,9 +233,15 @@ To remove the panel you have to press in the four tabs at the side. It is easies
|
||||||
self.move(tw, th, move)
|
self.move(tw, th, move)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
x = self.x
|
x, y, h = self.x, self.y, self.h
|
||||||
t = self.thickness
|
t = self.thickness
|
||||||
bottom = self.edges.get(self.bottom_edge)
|
bottom = self.edges.get(self.bottom_edge)
|
||||||
|
|
||||||
|
if self.outside:
|
||||||
|
self.x = x = self.adjustSize(x)
|
||||||
|
self.y = y = self.adjustSize(y)
|
||||||
|
self.h = h = self.adjustSize(h, bottom)
|
||||||
|
|
||||||
d1 = t * math.cos(math.radians(self.angle))
|
d1 = t * math.cos(math.radians(self.angle))
|
||||||
d2 = t * math.sin(math.radians(self.angle))
|
d2 = t * math.sin(math.radians(self.angle))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue