2016-07-11 23:01:57 +02:00
|
|
|
#!/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-12-07 17:40:08 +01:00
|
|
|
|
|
|
|
from boxes import *
|
|
|
|
|
2016-07-31 14:15:06 +02:00
|
|
|
class DrillBox(Boxes):
|
2016-03-15 21:29:03 +01:00
|
|
|
"""Not yet parametrized box for drills from 1 to 12.5mm
|
|
|
|
in 0.5mm steps, 3 holes each size"""
|
2016-03-08 22:27:55 +01:00
|
|
|
def __init__(self):
|
2016-03-03 13:27:22 +01:00
|
|
|
Boxes.__init__(self)
|
2016-03-08 22:27:55 +01:00
|
|
|
self.x, self.y, self.h = 120, 240, 60
|
2013-12-07 17:40:08 +01:00
|
|
|
|
|
|
|
def holesx(self):
|
|
|
|
self.fingerHolesAt(0, 5, self.x, angle=0)
|
|
|
|
self.fingerHolesAt(0, 25, self.x, angle=0)
|
|
|
|
|
|
|
|
def holesy(self):
|
|
|
|
self.fingerHolesAt(0, 5, self.y, angle=0)
|
|
|
|
self.fingerHolesAt(0, 25, self.y, angle=0)
|
|
|
|
|
|
|
|
|
|
|
|
def drillholes(self):
|
|
|
|
for i in range(6):
|
|
|
|
for j in range(4):
|
|
|
|
for k in range(3):
|
|
|
|
r = (12.5-2*i-0.5*j) * 0.5
|
|
|
|
self.hole(i*20+10, j*60+k*20+10, r+0.05)
|
|
|
|
|
|
|
|
def description(self):
|
|
|
|
self.ctx.set_font_size(6)
|
|
|
|
for i in range(4):
|
|
|
|
for j in range(6):
|
|
|
|
self.rectangularHole(i*60+30, 20*j+10, 58, 14+1*j)
|
|
|
|
d = 2.5-0.5*i+2*j
|
2014-01-21 22:44:22 +01:00
|
|
|
self.text("%.1f" % d, i*60+20, 19*j+6,
|
|
|
|
align="center")
|
|
|
|
|
2013-12-07 17:40:08 +01:00
|
|
|
|
|
|
|
def render(self):
|
|
|
|
x, y, h = self.x, self.y, self.h
|
|
|
|
t = self.thickness
|
|
|
|
|
2016-06-07 20:20:35 +02:00
|
|
|
self.open()
|
2016-03-03 13:27:22 +01:00
|
|
|
self.edges["f"].settings.setValues(self.thickness, space=3, finger=3,
|
|
|
|
surroundingspaces=1)
|
|
|
|
|
2013-12-07 17:40:08 +01:00
|
|
|
self.rectangularWall(x, h, "FfeF", callback=[self.holesx],move="right")
|
|
|
|
self.rectangularWall(y, h, "FfeF", callback=[self.holesy], move="up")
|
|
|
|
self.rectangularWall(y, h, "FfeF", callback=[self.holesy])
|
|
|
|
self.rectangularWall(x, h, "FfeF", callback=[self.holesx],
|
|
|
|
move="left up")
|
|
|
|
|
|
|
|
self.rectangularWall(x, y, "ffff", move="up")
|
|
|
|
self.rectangularWall(x, y, "ffff", callback=[self.drillholes],
|
|
|
|
move="up")
|
|
|
|
self.rectangularWall(x, y, "ffff", callback=[self.drillholes,
|
|
|
|
self.description],
|
|
|
|
move="up")
|
|
|
|
|
2014-03-21 21:08:54 +01:00
|
|
|
self.close()
|
2013-12-07 17:40:08 +01:00
|
|
|
|
2016-03-23 22:05:06 +01:00
|
|
|
def main():
|
2016-07-31 14:15:06 +02:00
|
|
|
b = DrillBox()
|
2016-03-03 13:27:22 +01:00
|
|
|
b.parseArgs()
|
|
|
|
b.render()
|
2016-03-23 22:05:06 +01:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|