boxespy/boxes/generators/castle.py

57 lines
1.9 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 *
2016-08-17 15:07:41 +02:00
class Castle(Boxes):
"Castle tower with two walls"
ui_group = "Unstable"
2013-07-20 13:10:51 +02:00
def __init__(self):
Boxes.__init__(self)
self.addSettingsArgs(edges.FingerJointSettings)
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(10.0, relative=True,
space=1, finger=1,
width=self.thickness)
2016-08-17 15:07:41 +02:00
s.edgeObjects(self, "pPQ")
2013-07-20 13:10:51 +02:00
2016-08-17 15:07:41 +02:00
self.moveTo(0, 0)
self.rectangularWall(t_x, t_h, edges="efPf", move="right", callback=[lambda: self.fingerHolesAt(t_x * 0.5, 0, w1_h, 90), ])
2013-07-20 13:10:51 +02:00
self.rectangularWall(t_x, t_h, edges="efPf", move="right")
2016-08-17 15:07:41 +02:00
self.rectangularWall(t_x, t_h, edges="eFPF", move="right", callback=[lambda: self.fingerHolesAt(t_x * 0.5, 0, w2_h, 90), ])
2013-07-20 13:10:51 +02:00
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-08-17 15:07:41 +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
2016-08-17 15:07:41 +02:00
2016-03-23 22:05:06 +01:00
if __name__ == '__main__':
main()