Ejemplo n.º 1
0
    def __init__(self):

        self.midi_jack_out = mj.midi_jack_t(hole_relative_to_bottom=False)
        self.midi_jack_in = mj.midi_jack_t(hole_relative_to_bottom=False)
        self.dc_jack = dj.dc_jack_t(overhang=wallgap + 1)
        self.usb_a = uta.usbtypea_t(overhang=wallgap - 1)

        self.parts = [self.midi_jack_out]
        self.parts = pa.stick_on_part(self.parts, self.midi_jack_in, 'e',
                                      ('', '+', '+'), False)
        self.parts = pa.stick_on_part(self.parts, self.usb_a, 'e',
                                      ('', '+', '+'), False)
        self.parts = pa.stick_on_part(self.parts, self.dc_jack, 'e',
                                      ('', '+', '+'), False)

        co, dim = pa.parts_hull(self.parts)
        pa.cube_t.__init__(self, coords=co.as_tuple(), dims=dim.as_tuple())
Ejemplo n.º 2
0
    def __init__(self):

        self.back_wall_parts = bwp.back_wall_parts_t()
        self.top_circuit = topcirc.top_circuit_t(
            ideal_width=self.back_wall_parts.get_dims().x)
        self.parts = pa.stick_on_part([self.back_wall_parts], self.top_circuit,
                                      's', ('-', '', '+'), False)
        self.top_circuit.translate(
            (0, 0, self.top_circuit.get_dims().z + pcb_thickness))
        co, dim = pa.parts_hull(self.parts)
        pa.cube_t.__init__(self, coords=co.as_tuple(), dims=dim.as_tuple())
Ejemplo n.º 3
0
]

points = []
for p in parts:
    points += p.get_rect_points()

ep = pa.extreme_points(points)
mi, ma = ep
sys.stderr.write("min\n")
for m in mi:
    sys.stderr.write(m.__string__() + '\n')
sys.stderr.write("max\n")
for m in ma:
    sys.stderr.write(m.__string__() + '\n')

parts = pa.stick_on_part(parts, pa.cube_t(dims=(0.5, 0.25, 0.5)), 'e',
                         ('', '+', '+'), False)
parts = pa.stick_on_part(parts, pa.cube_t(dims=(0.5, 0.25, 0.25)), 'w',
                         ('', '+', '-'), False)
parts = pa.stick_on_part(parts, pa.cube_t(dims=(0.5, 0.25, 0.25)), 'b',
                         ('+', '+', ''), False)
parts = pa.stick_on_part(parts, pa.cube_t(dims=(0.75, 0.25, 0.25), gap=0.2),
                         't', ('-', '+', ''), False)
parts = pa.stick_on_part(parts, pa.cube_t(dims=(0.75, 0.25, 0.25), gap=0.3),
                         'n', ('-', '', '-'), False)
parts = pa.stick_on_part(parts, pa.cube_t(dims=(0.75, 0.25, 0.25), gap=0.1),
                         'w', ('', '+', '-'), False)

for p in parts:
    print(p.oscad_draw_solid())
#print(parts[-1].oscad_draw())
Ejemplo n.º 4
0
# Include parent directory in python path
import partasm as pa
import midijack as mj

parts = [mj.midi_jack_t(hole_relative_to_bottom=False)]
parts = pa.stick_on_part(parts, mj.midi_jack_t(hole_relative_to_bottom=False),
                         'e', ('', '+', '-'), False)
co, di = pa.parts_hull(parts)
parts = pa.stick_on_part(parts,
                         pa.cube_t(coords=co.as_tuple(), dims=(di.x, 5, di.z)),
                         'n', ('-', '', '-'), True)

print("difference () {")
print("union () {")
for p in parts:
    print(p.oscad_draw_solid())
print("}")
print("union () {")
for p in parts:
    print(p.oscad_draw_void())
print("}")
print("}")
Ejemplo n.º 5
0
    def __init__(self, ideal_width=0):
        """
        ideal_width: tries to push encoders to the east side so that the width
        is ideal_width, but if it can't, the encoders are just stuck to the east
        side of the LED array.
        """

        self.led_array = leda.led_array_t(nrows=led_array['n_rows'],
                                          ncols=led_array['n_cols'],
                                          gapx=2,
                                          gapy=2)
        self.top_encoder = enc.encoder_t()
        self.bottom_encoder = enc.encoder_t()
        self.parts = [self.led_array]

        # Top encoder aligned to top of LED array, right side, trying to be
        # ideal_width
        self.parts = pa.stick_on_part(self.parts, self.top_encoder, 'e',
                                      ('', '+', '-'), False)
        if (pa.parts_hull(self.parts)[1].as_tuple()[0] +
                enc_gap) < ideal_width:
            transx = (ideal_width -
                      pa.parts_hull(self.parts)[1].as_tuple()[0] - enc_gap)
            self.top_encoder.translate((transx, 0, 0))

        # Bottom encoder just below
        self.parts = pa.stick_on_part(self.parts, self.bottom_encoder, 's',
                                      ('+', '', '-'), False)
        self.bottom_encoder.translate((0, -enc_gap, 0))

        # buttons on left side (initially below bottom encoder)
        self.buttons = [btn.button_t() for _ in range(6)]
        self.parts = pa.stick_on_part(self.parts, self.buttons[0], 's',
                                      ('-', '', '-'), True)

        # nudge it to make it work
        self.buttons[0].translate((0, -1e-4, 0))
        self.parts = pa.stick_on_part(self.parts, self.buttons[1], 'e',
                                      ('', '-', '-'), False)
        self.parts = pa.stick_on_part(self.parts, self.buttons[2], 's',
                                      ('-', '', '-'), True)

        # nudge it to make it work
        self.buttons[2].translate((0, -1e-4, 0))
        self.parts = pa.stick_on_part(self.parts, self.buttons[3], 'e',
                                      ('', '-', '-'), False)

        self.parts = pa.stick_on_part(self.parts, self.buttons[4], 's',
                                      ('-', '', '-'), True)
        # nudge it to make it work
        self.buttons[4].translate((0, -1e-4, 0))
        self.parts = pa.stick_on_part(self.parts, self.buttons[5], 'e',
                                      ('', '-', '-'), False)

        # move up to fill in empty space and bring them just below the LED array
        for b in self.buttons:
            b.translate((0, b.get_dims().y, 0))

        # move over last 2
        transx = ideal_width - pa.parts_hull(
            self.buttons[-2:])[1].as_tuple()[0] - enc_gap
        for b in self.buttons[-2:]:
            b.translate((transx, 0, 0))

        # put shafts around the buttons
        for b, t in zip(self.buttons, '!@#*%&'):
            self.parts.append(
                btn.button_shaft(b, inside=True, keytext=t, font="Helvetica"))

        co, dim = pa.parts_hull(self.parts)
        negco = tuple(-1 * c for c in co.as_tuple())
        # Make it so bottom corner is at origin
        for p in self.parts:
            p.translate(negco)
        pa.cube_t.__init__(self, coords=co.as_tuple(), dims=dim.as_tuple())
Ejemplo n.º 6
0
# Include parent directory in python path
import partasm as pa
import midijack as mj
import dcjack as dj
import usbtypea as uta
import domepartconfig as dpc

wallgap = dpc.wall_thickness

midi_jack_out = mj.midi_jack_t(hole_relative_to_bottom=False)
midi_jack_in = mj.midi_jack_t(hole_relative_to_bottom=False)
dc_jack = dj.dc_jack_t(overhang=wallgap + 1)
usb_a = uta.usbtypea_t(overhang=wallgap - 1)

parts = [midi_jack_out]
parts = pa.stick_on_part(parts, midi_jack_in, 'e', ('', '+', '+'), False)
parts = pa.stick_on_part(parts, usb_a, 'e', ('', '+', '+'), False)
parts = pa.stick_on_part(parts, dc_jack, 'e', ('', '+', '+'), False)

co, di = pa.parts_hull(parts)

back_wall = pa.cube_t(dims=(di.x + 2 * wallgap, wallgap, di.z + 2 * wallgap))

parts = pa.stick_on_part(parts, back_wall, 'n', ('-', '', '-'), False)

# The circuit
#print('color("MediumSeaGreen") {')
#print("difference () {")
#print("union () {")
#for p in [midi_jack_in,midi_jack_out,dc_jack,usb_a]:
#    print(p.oscad_draw_solid())