boxespy/boxes/generators/castle.py

58 lines
2.0 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
2014-03-16 18:26:12 +01:00
# Copyright (C) 2013-2014 Florian Festi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2013-07-20 13:10:51 +02:00
from boxes import *
class Castle(Boxes):
webinterface = False
2013-07-20 13:10:51 +02:00
def __init__(self):
Boxes.__init__(self)
def render(self, t_x=70, t_h=250, w1_x=300, w1_h=120, w2_x=100, w2_h=120):
self.open()
s = edges.FingerJointSettings(self.thickness, relative=False,
space = 10, finger=10, height=10,
width=self.thickness)
p = edges.FingerJointEdge(self, s)
2013-07-20 13:10:51 +02:00
p.char = "p"
self.addPart(p)
P = edges.FingerJointEdgeCounterPart(self, s)
2013-07-20 13:10:51 +02:00
P.char = "P"
self.addPart(P)
self.moveTo(0,0)
2013-07-20 19:24:16 +02:00
self.rectangularWall(t_x, t_h, edges="efPf", move="right", callback=
2013-07-20 13:10:51 +02:00
[lambda: self.fingerHolesAt(t_x*0.5, 0, w1_h, 90),])
self.rectangularWall(t_x, t_h, edges="efPf", move="right")
2013-07-20 19:24:16 +02:00
self.rectangularWall(t_x, t_h, edges="eFPF", move="right", callback=
2013-07-20 13:10:51 +02:00
[lambda: self.fingerHolesAt(t_x*0.5, 0, w2_h, 90),])
self.rectangularWall(t_x, t_h, edges="eFPF", move="right")
self.rectangularWall(w1_x, w1_h, "efpe", move="right")
self.rectangularWall(w2_x, w2_h, "efpe", move="right")
2014-03-21 21:08:54 +01:00
self.close()
2013-07-20 13:10:51 +02:00
2016-03-23 22:05:06 +01:00
def main():
c = Castle()
c.parseArgs()
c.render()
2016-03-23 22:05:06 +01:00
if __name__ == '__main__':
main()