2017-02-08 20:50:40 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# 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/>.
|
|
|
|
|
|
|
|
from boxes import *
|
|
|
|
|
|
|
|
|
|
|
|
class OttoBody(Boxes):
|
|
|
|
"""Otto LC - a laser cut chassis for Otto DIY - body"""
|
|
|
|
|
|
|
|
ui_group = "Unstable"
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
Boxes.__init__(self)
|
|
|
|
self.addSettingsArgs(edges.FingerJointSettings)
|
|
|
|
self.addSettingsArgs(edges.ChestHingeSettings)
|
|
|
|
|
|
|
|
|
|
|
|
def bottomCB(self):
|
|
|
|
self.hole(6, self.y/2, 6)
|
|
|
|
self.hole(6, self.y/2-6, 3)
|
|
|
|
self.hole(self.x-6, self.y/2, 6)
|
|
|
|
self.hole(self.x-6, self.y/2-6, 3)
|
|
|
|
|
|
|
|
#self.rectangularHole(20, self.y/2, 4, 30, 1.5)
|
|
|
|
#self.rectangularHole(self.x-20, self.y/2, 4, 30, 1.5)
|
|
|
|
self.rectangularHole(self.x/2, self.y/2, 10, 5, 1.5)
|
|
|
|
|
2017-07-25 21:57:58 +02:00
|
|
|
self.rectangularHole(self.x-7, self.y-6.5, 7, 4)
|
|
|
|
|
2017-02-08 20:50:40 +01:00
|
|
|
self.moveTo(0, self.y-12)
|
|
|
|
self.hexHolesCircle(12, (1, 2, 'circle'))
|
|
|
|
|
|
|
|
def leftBottomCB(self):
|
|
|
|
self.hole(7, self.y-7, 6)
|
|
|
|
|
|
|
|
self.hole(6, self.y/2+9, 0.9)
|
|
|
|
self.rectangularHole(6, self.y/2-5.5, 12, 23)
|
|
|
|
self.hole(6, self.y/2-20, 0.9)
|
|
|
|
|
|
|
|
def rightBottomCB(self):
|
2017-07-25 21:57:58 +02:00
|
|
|
self.rectangularHole(7, self.y-6.5, 11.6, 5.6)
|
|
|
|
|
2017-02-08 20:50:40 +01:00
|
|
|
self.hole(8, self.y/2+9, 0.9)
|
|
|
|
self.rectangularHole(8, self.y/2-5.5, 12, 23)
|
|
|
|
self.hole(8, self.y/2-20, 0.9)
|
|
|
|
|
|
|
|
def eyeCB(self):
|
|
|
|
self.hole(self.x/2+13,self.hl/2, 8)
|
|
|
|
self.hole(self.x/2-13,self.hl/2, 8)
|
|
|
|
|
2017-07-31 21:08:26 +02:00
|
|
|
def frontCB(self):
|
|
|
|
t = self.thickness
|
|
|
|
self.rectangularHole(0.5*t, 2+t, t, 2.5)
|
|
|
|
self.rectangularHole(self.x-0.5*t, 2+t, t, 2.5)
|
|
|
|
|
2017-02-08 20:50:40 +01:00
|
|
|
def IOCB(self):
|
2017-07-25 22:43:11 +02:00
|
|
|
self.rectangularHole(26, 18, 12, 10)
|
2017-02-08 20:50:40 +01:00
|
|
|
# self.rectangularHole(42.2, 10.2, 9.5, 11.5)
|
|
|
|
|
2017-07-31 21:18:06 +02:00
|
|
|
def buttonCB(self):
|
|
|
|
px, py = 7.5, 7.5
|
|
|
|
|
|
|
|
self.rectangularHole(px, py-2.25, 5.2, 2.5)
|
|
|
|
self.rectangularHole(px, py+2.25, 5.2, 2.5)
|
|
|
|
|
2017-07-30 21:23:00 +02:00
|
|
|
def PCB_Clip(self, x , y, move=None):
|
|
|
|
|
|
|
|
if self.move(x+4, y, move, True):
|
|
|
|
return
|
|
|
|
self.moveTo(1.5)
|
2017-08-03 22:32:33 +02:00
|
|
|
self.polyline(x-1.5, 90, y, 90, x, 85, y-2-4, -30, 2, 120, 1, -90, 2, (180, 1.), y-7, -175, y-5)
|
2017-07-30 21:23:00 +02:00
|
|
|
|
|
|
|
self.move(x+4, y, move)
|
|
|
|
|
2017-07-31 20:46:41 +02:00
|
|
|
def PCB_Clamp(self, w, s, h, move=None):
|
2017-07-31 21:08:26 +02:00
|
|
|
t = self. thickness
|
|
|
|
f = 2**0.5
|
|
|
|
|
|
|
|
if self.move(w+4, h+8+t, move, True):
|
2017-07-31 20:46:41 +02:00
|
|
|
return
|
2017-07-31 21:08:26 +02:00
|
|
|
self.polyline(w, 90, s, -90, 1, (90, 1), h-s-1, 90, w-2, 90,
|
|
|
|
h-8, (-180, 1), h-8+3*t, 135, f*(4), 90, f*2, -45, h+t)
|
|
|
|
self.move(w+4, h+8+t, move)
|
2017-07-31 20:46:41 +02:00
|
|
|
|
2017-02-08 20:50:40 +01:00
|
|
|
def render(self):
|
|
|
|
self.open()
|
|
|
|
|
|
|
|
self.x = x = 60.
|
|
|
|
self.y = y = 60.
|
|
|
|
self.h = h = 35.
|
|
|
|
self.hl = hl = 30.
|
|
|
|
|
|
|
|
t = self.thickness
|
|
|
|
|
|
|
|
hx = self.edges["O"].startwidth()
|
|
|
|
|
|
|
|
e1 = edges.CompoundEdge(self, "Fe", (h-hx, hx))
|
|
|
|
e2 = edges.CompoundEdge(self, "eF", (hx, h-hx))
|
|
|
|
e_back = ("F", e1, "e", e2)
|
2017-07-30 21:23:00 +02:00
|
|
|
|
|
|
|
# sides
|
2017-02-08 20:50:40 +01:00
|
|
|
self.moveTo(hx)
|
|
|
|
self.rectangularWall(x, h-hx, "FfOf", ignore_widths=[2], move="up")
|
|
|
|
self.rectangularWall(x, hl-hx, "pfFf", ignore_widths=[1], move="up")
|
|
|
|
self.moveTo(-hx)
|
2017-07-31 21:18:06 +02:00
|
|
|
self.rectangularWall(x, h-hx, "Ffof", ignore_widths=[5], callback=[
|
2017-08-01 21:19:01 +02:00
|
|
|
lambda: self.rectangularHole(y-7.5, h-4-7.5, 6.2, 7.)],
|
2017-07-31 21:18:06 +02:00
|
|
|
move="up")
|
2017-02-08 20:50:40 +01:00
|
|
|
self.rectangularWall(x, hl-hx, "PfFf", ignore_widths=[6],
|
|
|
|
callback=[None, None, self.IOCB], move="up")
|
2017-07-30 21:23:00 +02:00
|
|
|
|
|
|
|
# lower walls
|
2017-07-31 21:08:26 +02:00
|
|
|
self.rectangularWall(y, h, "FFeF", callback=[
|
|
|
|
None, None, self.frontCB], move="up")
|
2017-02-08 20:50:40 +01:00
|
|
|
self.rectangularWall(y, h, e_back, move="up")
|
2017-07-30 21:23:00 +02:00
|
|
|
# upper walls
|
2017-02-08 20:50:40 +01:00
|
|
|
self.rectangularWall(y, hl, "FFeF", callback=[self.eyeCB], move="up")
|
|
|
|
self.rectangularWall(y, hl-hx, "FFqF", move="up")
|
|
|
|
|
2017-07-30 21:23:00 +02:00
|
|
|
# top
|
2017-02-08 20:50:40 +01:00
|
|
|
self.rectangularWall(x, y, "ffff", move="up")
|
2017-07-30 21:23:00 +02:00
|
|
|
# bottom
|
2017-02-08 20:50:40 +01:00
|
|
|
self.rectangularWall(x, y, "ffff", callback=[self.bottomCB], move="up")
|
2017-07-30 21:23:00 +02:00
|
|
|
# PCB mounts
|
2017-07-31 21:08:26 +02:00
|
|
|
self.ctx.save()
|
|
|
|
self.PCB_Clamp(y-53.5, 4.5, hl, move="right")
|
|
|
|
self.PCB_Clamp(y-50, 4.5, hl, move="right")
|
|
|
|
self.PCB_Clip(3.5, hl, move="right")
|
2017-07-31 21:18:06 +02:00
|
|
|
self.rectangularWall(15, 15, callback=[self.buttonCB])
|
2017-07-31 21:08:26 +02:00
|
|
|
self.ctx.restore()
|
|
|
|
self.PCB_Clamp(y-53.5, 4.5, hl, move="up only")
|
2017-07-30 21:23:00 +02:00
|
|
|
# servo mounts
|
2017-02-08 20:50:40 +01:00
|
|
|
self.rectangularWall(y, 14, callback=[None, self.leftBottomCB], move="up")
|
|
|
|
self.rectangularWall(y, 14, callback=[None, self.rightBottomCB], move="up")
|
|
|
|
|
|
|
|
self.close()
|
|
|
|
|
|
|
|
|