def assemble(self): ### Assemble the object # Insert the main beam self.append("brain", "core") self.attach(("brain", "core", "botright"), ("half", "front", "topright"), Fold(-180)) self.attach(("brain", "core", "topleft"), ("half", "back", "topright"), Fold(-180)) self.addTabs((Tab(), "tabfront", 9), ("half", "front", "botedge.2"), ("half", "back", "topedge.3")) self.addTabs((Tab(), "tabback", 9), ("half", "back", "botedge.2"), ("half", "front", "topedge.3"))
def assemble(self): try: rangle = self.getParameter("angle") langle = self.getParameter("angle") except KeyError: rangle = self.getParameter("rangle") langle = self.getParameter("langle") try: faces = self.getParameter("faces") except KeyError: faces = None ### Assemble the object b = BeamDrawing( self.getParameter("length"), (self.getParameter("width"), self.getParameter("depth")), langle=langle, rangle=rangle, phase=self.getParameter("phase"), faces=faces) self.drawing.append(b) tabwidth = self.getParameter("width") if self.getParameter("phase") % 2: tabwidth = self.getParameter("depth") if faces is None: t = Tab() t.setParameter("noflap", self.getParameter("noflap")) self.addConnectors((t, "tabs"), "e1", "e3", min(10, tabwidth), angle=90) self.drawing.edges["e3"].flip() self.setInterface("topedge", ["r%d.e0" % n for n in range(4)]) self.setInterface("botedge", ["r%d.e2" % n for n in range(4)]) self.setInterface("tabedge", "tabstab.e2") self.setInterface("slotedge", "e3")
def assemble(self): try: rangle = self.getParameter("angle") langle = self.getParameter("angle") except KeyError: rangle = self.getParameter("rangle") langle = self.getParameter("langle") try: faces = self.getParameter("faces") except KeyError: faces = None ### Assemble the object b = BeamDrawing(self.getParameter("length"), (self.getParameter("width"), self.getParameter("depth")), langle = langle, rangle = rangle, phase = self.getParameter("phase"), faces = faces) self.drawing.append(b) tabwidth = self.getParameter("width") if self.getParameter("phase") % 2: tabwidth = self.getParameter("depth") if faces is None: t = Tab() t.setParameter("noflap", self.getParameter("noflap")) self.addConnectors((t, "tabs"), "e1", "e3", min(10, tabwidth), angle=90) self.drawing.edges["e3"].flip() self.setInterface("topedge", ["r%d.e0" % n for n in range(4)]) self.setInterface("botedge", ["r%d.e2" % n for n in range(4)]) self.setInterface("tabedge", "tabstab.e2") self.setInterface("slotedge", "e3")
def assemble(self): ### Assemble the object self.append("mount", "topmount") self.attach(("mount", "topmount", "t"), ("split", "topsplit", "botedge"), Flat()) self.attach(("split", "topsplit", "topedge.0"), ("linkage", "l1", "topedge"), Flat()) self.attach(("split", "topsplit", "topedge.2"), ("linkage", "l2", "botedge"), Flat()) # TODO: make cleaner abstsraction self.drawing.attach((self.getInterfaces("linkage", "topedge", "l2"), self.getInterfaces("linkage", "botedge", "l1")), self.getComponent("split").drawing, (self.getInterfaces("split", "topedge.0"), self.getInterfaces("split", "topedge.2")), "botsplit", Flat()) self.attach(("split", "botsplit", "botedge"), ("mount", "botmount", "t"), Flat()) # TODO: make cleaner abstsraction self.getComponent("hole").drawing.transform(origin = (self.getParameter("depth")/2., sqrt(2) * self.getParameter("leg.beamwidth")/2.)) self.getComponent("spacer").drawing.append(self.getComponent("hole").drawing, "hole") self.attach(("linkage", "l2", "output"), ("spacer", "s1", "b"), Flat()) self.attach(("spacer", "s1", "r"), ("leg", "leg1", "diag"), Flat()) self.attach(("linkage", "l1", "output"), ("spacer", "s2", "t"), Flat()) self.attach(("spacer", "s2", "r"), ("fakeleg", "leg2", "r"), Flat()) self.addTabs((Tab(), "tab1", min(10, sqrt(2) * self.getParameter("leg.beamwidth"))), None, ("fakeleg", "leg2", "t"), (Flat(), Cut())) self.setInterface("topedge", self.getInterfaces("mount", "b", "topmount")) self.setInterface("botedge", self.getInterfaces("mount", "b", "botmount"))
def assemble(self): l = self.getParameter("length") w = self.getParameter("beamwidth") w2 = w * sqrt(2) self.drawing.append(Rectangle(w2, l), "r0") self.drawing.attach("r0.e1", Face(((w, -w), (w, l), (0, l))), "e3", "r1", Fold(135)) self.drawing.attach("r1.e1", Face(((w, w), (w, l + w), (0, l + w))), "e3", "r2", Fold(90)) self.addConnectors((Tab(), "t1"), "r2.e1", "r0.e3", min(10, w2), angle=135) self.setInterface("front", "r1.e2") self.setInterface("right", "r2.e2") self.setInterface("slots", "r0.e3") self.setInterface("diag", "r0.e2")
def assemble(self): ### Assemble the object try: rangle = self.getParameter("angle") langle = self.getParameter("angle") except KeyError: rangle = self.getParameter("rangle") langle = self.getParameter("langle") try: d = self.getParameter("diameter") t = self.getParameter("diameter") * sin( pi / self.getParameter("shape")) except KeyError: d = self.getParameter("beamwidth") / sin( pi / self.getParameter("shape")) t = self.getParameter("beamwidth") b = BeamDrawing(length=self.getParameter("length"), diameter=d, langle=langle, rangle=rangle, shape=self.getParameter("shape"), phase=self.getParameter("phase")) self.drawing.append(b) self.addConnectors((Tab(), "tabs"), "e1", "e3", min(10, t), angle=360. / self.getParameter("shape")) # Assign interfaces self.setInterface( "topedge", ["r%d.e0" % n for n in range(self.getParameter("shape"))]) self.setInterface( "botedge", ["r%d.e2" % n for n in range(self.getParameter("shape"))])
def assemble(self): ### Assemble the object self.append("servo", "servo") self.attach(("servo", "servo", "slotedge"), ("move", "move", "topedge"), Flat()) self.addTabs( (Tab(), "t1", min(10, self.getParameter("servo").getParameter("motorheight"))), ("move", "move", "botedge"), ("servo", "servo", "insideedge"), (Flat(), Flex())) self.setInterface("topedge", self.getInterfaces("servo", "topedge", "servo")) self.setInterface( "topright", self.getInterfaces("servo", "topedge", "servo", index=1)) self.setInterface("botedge", self.getInterfaces("servo", "botedge", "servo"))
def assemble(self): #an equilateral triangular face requires width = unitheight* rt(3) fullwidth = self.getParameter("perimeter")/4. fullheight = fullwidth*(3**.5)/2. h = fullheight * abs(self.getParameter("end") - self.getParameter("start")) def splits(width, frac): return [width * x for x in (frac/2., 1-frac, 1+frac, 1-frac, 1+frac/2.)] se = splits(fullwidth, self.getParameter("end")) ss = splits(fullwidth, self.getParameter("start")) m = min(self.getParameter("start"), self.getParameter("end"), self.getParameter("min")) * fullwidth / 2. se[0] -= m ss[0] -= m se[-1] += m ss[-1] += m xb, xt, index = 0, 0, 0 for (xstart, xend) in zip(ss, se): r = Face(((xb, 0), (xb+xstart, 0), (xt+xend, h), (xt, h)), origin=False) if index: self.drawing.attach("r%d.e2" % (index-1), r, "e0", "r%d" % index, Fold(109.5)) else: self.drawing.append(r, "r%d" % index) xb += xstart xt += xend index += 1 self.addConnectors((Tab(), "t1"), "r0.e0", "r4.e2", min(10, fullwidth / 2.), (Flat(), Cut())) self.setInterface("startedge", ["r%d.e1" % x for x in range(5)]) self.setInterface("endedge", ["r%d.e3" % x for x in range(5)])