示例#1
0
文件: TJoint.py 项目: donrv/ROSLab
    def assemble(self):
        sw = self.getParameter("stemwidth")
        cw = self.getParameter("crosswidth")
        t = self.getParameter("thickness")

        r = Rectangle(sw, cw)
        s = Rectangle(sw, t)

        self.drawing.append(r, 'r0')
        self.drawing.attach('r0.e2', s, 'e0', 'r1', Fold(90))
        self.drawing.attach('r1.e2', r, 'e0', 'r2', Fold(90))

        self.setInterface("stemedge", "r0.e0")
        self.setInterface("stemtab", "r2.e2")
        self.setInterface("leftedge", ["r%d.e1" % x for x in range(3)])
        self.setInterface("rightedge", ["r%d.e3" % x for x in range(3)])
示例#2
0
文件: HWBotTest.py 项目: donrv/ROSLab
    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"))
示例#3
0
    def assemble(self):
        lx = self.getParameter("flexlengthx")
        ly = self.getParameter("flexlengthy")
        w = self.getParameter("flexwidth")
        t = self.getParameter("depth")

        r = Rectangle(w, lx)
        s = Rectangle(w, t)

        self.drawing.append(r, 'r0')
        self.drawing.attach('r0.e2', s, 'e0', 'r1', Fold(90))
        self.drawing.attach('r1.e2', r, 'e0', 'r2', Fold(90))

        r = Rectangle(t, lx / 2.)
        self.drawing.attach('r1.e1', r, 'e0', 'r3', Fold(90))

        r = Rectangle(t, ly)
        self.drawing.attach('r3.e2', r, 'e0', 'r5', Fold(90))
示例#4
0
    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")
示例#5
0
文件: beam.py 项目: donrv/ROSLab
  def __init__(self, length, diameter, langle=90, rangle=90, shape=3, phase=0):
    """
    Initializes a Beam object 

    @type length: 
    @param length: 
    @type diameter: 
    @param diameter: 
    @type langle: 
    @param rangle: 
    @type shape:
    @param shape:
    @return: a Beam object
    """

    Drawing.__init__(self)

    radius = diameter/2.
    dtheta = np.deg2rad(360. / shape)
    thetas = [ dtheta / 2. + dtheta * i for i in range(phase, shape+phase) ]

    thickness = 2 * radius * np.sin(dtheta / 2.)

    dl = [ radius * (1 - np.cos(t)) / np.tan(np.deg2rad(langle)) for t in thetas ]
    dl = [ l - dl[-phase % shape] for l in dl ]
    dr = [ radius * (1 - np.cos(t)) / np.tan(np.deg2rad(rangle)) for t in thetas ]
    dr = [ r - dr[-phase % shape] for r in dr ]

    r = Face(((thickness, dr[0]), (thickness, length - dl[0]), (0, length - dl[-1]), (0, dr[-1])), origin = False);
    self.append(r, 'r0')
    self.renameedge('r0.e1', 'e1')
    self.renameedge('r0.e3', 'e3')

    angle = 360. / shape
    for i in range(1,len(thetas)):
      r = Face(((thickness, dr[i]), (thickness, length - dl[i]), (0, length - dl[i-1]), (0, dr[i-1])), origin = False);
      self.attach('e1', r, 'e3', 'r%d' % i, Fold(angle))
      self.renameedge('r%d.e1' % i, 'e1')
示例#6
0
                depth))
        rs.append(
            Face((
                (0, length),
                (0, 0),
                (depth, np.tan(np.deg2rad(rangle)) * depth),
                (depth, length - np.tan(np.deg2rad(langle)) * depth),
            ),
                 origin=False))

        for i in range(phase):
            rs.append(rs.pop(0))

        i = faces[0]
        self.append(rs[i], 'r%d' % i)
        self.renameedge('r%d.e1' % i, 'e1')
        self.renameedge('r%d.e3' % i, 'e3')

        for i in faces[1:]:
            self.attach('e1', rs[i], 'e3', 'r%d' % i, Fold(90))
            self.renameedge('r%d.e1' % i, 'e1')


if __name__ == "__main__":
    print "hi"
    import display
    b = RectBeam(10, (5, 2), 45, 135)
    b.transform(origin=(10, 10))
    display.displayTkinter(b)
    #b.toSVG('testbeam.svg', labels=False, mode='Corel')