boxespy/boxes/generators/castle.py

49 lines
2.0 KiB
Python
Raw Permalink 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):
2023-01-02 00:32:42 +01:00
"""Castle tower with two walls"""
2020-12-29 15:18:37 +01:00
description = """This was done as a table decoration. May be at some point in the future someone will create a proper castle
with towers and gates and walls that can be attached in multiple configurations."""
ui_group = "Unstable"
2023-01-08 19:41:02 +01:00
def __init__(self) -> None:
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):
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")
2016-08-17 15:07:41 +02:00