2016-02-12 21:22:32 +01:00
|
|
|
#!/usr/bin/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-01 20:23:56 +02:00
|
|
|
from boxes import *
|
|
|
|
|
|
|
|
class FlexTest(Boxes):
|
2016-03-15 21:03:05 +01:00
|
|
|
"Piece for testing different flex settings"
|
2016-03-03 13:27:22 +01:00
|
|
|
def __init__(self):
|
|
|
|
Boxes.__init__(self)
|
|
|
|
self.buildArgParser("x", "y")
|
2016-03-15 21:03:05 +01:00
|
|
|
self.argparser.add_argument(
|
|
|
|
"--fd", action="store", type=float, default=0.5,
|
|
|
|
help="distance of flex cuts in multiples of thickness")
|
|
|
|
self.argparser.add_argument(
|
|
|
|
"--fc", action="store", type=float, default=1.0,
|
|
|
|
help="connections of flex cuts in multiples of thickness")
|
|
|
|
self.argparser.add_argument(
|
|
|
|
"--fw", action="store", type=float, default=5.0,
|
|
|
|
help="width of flex cuts in multiples of thickness")
|
2013-07-01 20:23:56 +02:00
|
|
|
|
2016-03-03 13:27:22 +01:00
|
|
|
def render(self):
|
|
|
|
x, y = self.x, self.y
|
2016-06-07 20:20:35 +02:00
|
|
|
self.open()
|
2016-03-03 13:27:22 +01:00
|
|
|
|
2016-03-15 21:03:05 +01:00
|
|
|
self.edges["X"].settings.setValues(
|
|
|
|
self.thickness, relative=True,
|
|
|
|
distance=self.fd, connection=self.fc, width=self.fw)
|
2013-07-01 20:23:56 +02:00
|
|
|
|
|
|
|
self.moveTo(5, 5)
|
|
|
|
self.edge(10)
|
2016-05-20 21:33:22 +02:00
|
|
|
self.edges["X"](x, y)
|
2013-07-01 20:23:56 +02:00
|
|
|
self.edge(10)
|
|
|
|
self.corner(90)
|
|
|
|
self.edge(y)
|
|
|
|
self.corner(90)
|
|
|
|
self.edge(x+20)
|
|
|
|
self.corner(90)
|
|
|
|
self.edge(y)
|
|
|
|
self.corner(90)
|
|
|
|
|
2014-03-21 21:08:54 +01:00
|
|
|
self.close()
|
2013-07-01 20:23:56 +02:00
|
|
|
|
2016-03-23 22:05:06 +01:00
|
|
|
def main():
|
2016-03-03 13:27:22 +01:00
|
|
|
f = FlexTest()
|
|
|
|
f.parseArgs()
|
|
|
|
f.render()
|
2013-07-01 20:23:56 +02:00
|
|
|
|
2016-03-23 22:05:06 +01:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|