def GenerateOverlappedTreeCadModel(tree:ParentedTree):
    element = ops.Union()
    for i in range(0, len(tree)):
        cadFigure = GenerateCadFile(tree[i])
        if cadFigure != None:
            element.append(cadFigure)
    return element
def GenerateMirroredCadModel(tree:ParentedTree):
    cadFigure = GenerateCadFile(tree[2])
    cadFigure2 = deepcopy(cadFigure)
    cadFigure = cadFigure.mirror([1,0,0])
    result = ops.Union()
    result.append(cadFigure)
    result.append(cadFigure2)
    return result
Exemple #3
0
def generate_braces_center():
    braces_union = ops.Union()
    braces = [
        cube(50.1, 10, 10).translate([0.0, -30.0, 5.0]),
        cube(50.1, 10, 10).translate([0.0, 30.0, 5.0]),
    ]
    for b in braces:
        braces_union.append(b)
    return braces_union
Exemple #4
0
def generate_braces_side():
    # These should range from Y = -45.125 to Y = 50.125
    braces_union = ops.Union()
    braces = [
        cube(10, 95.25, 10).translate([0.0, 2.5, 5.0]),
        cube(10, 95.25, 10).translate([40.0, 2.5, 5.0]),
    ]
    for b in braces:
        braces_union.append(b)
    return braces_union
def GenerateConcatenatedCadModel(tree:ParentedTree):
    element = ops.Union()
    offset = 0 #TODO find better way to do concatenation
    for i in range(0, len(tree)):
        cadFigure = GenerateCadFile(tree[i])
        if cadFigure != None:
            for f in cadFigure:
                element.append(f.translate([offset,0,0]))
                offset = offset + 10
    return element
Exemple #6
0
def generate_risers_side():
    # These should go from -69.675, the left edge of the case, to 51.625, 4mm
    # past the nubs
    risers_union = ops.Union()
    risers = [
        cube(121.3, 10, 25).translate([-9.025, -45.125, 0.5]),
        cube(121.3, 10, 25).translate([-9.025, 50.125, 0.5]),
    ]
    for r in risers:
        risers_union.append(r)
    return risers_union
Exemple #7
0
def generate_risers_center():
    # These should go from Y = -62.125 to Y = 63.125

    # TODO: Figure out correct Z value
    risers_union = ops.Union()
    risers = [
        cube(10, 125.25, 40).translate([-25.05, 0.5, 0.0]),
        cube(10, 125.25, 40).translate([25.05, 0.5, 0.0]),
    ]
    for r in risers:
        risers_union.append(r)
    return risers_union
Exemple #8
0
def switch_cutouts(piece):
    switches = SwitchData(piece).get_switches()

    stats_x = Stats([s["x"] for s in switches])
    stats_y = Stats([s["y"] for s in switches])

    u = ops.Union()
    for s in switches:
        x = s["x"] - stats_x.mid
        y = -(s["y"] - stats_y.mid)
        u.append(switch_cutout().translate([x, y, 0.0]))
    return u
Exemple #9
0
def generate_nubs_side():
    nubs_union = ops.Union()
    nubs = [
        # 31.0 mm makes the nub stick out 3mm from the riser
        ops.Cylinder(h=31.0, r=1,
                     center=True).translate([-47.625, -45.125, 0.0]),
        ops.Cylinder(h=31.0, r=1,
                     center=True).translate([-47.625, 50.125, 0.0]),
        ops.Cylinder(h=31.0, r=1,
                     center=True).translate([47.625, -45.125, 0.0]),
        ops.Cylinder(h=31.0, r=1, center=True).translate([47.625, 50.125,
                                                          0.0]),
    ]
    for n in nubs:
        nubs_union.append(n)
    return nubs_union
def create_plan(data, outname, wall_height=9, ratio=0.05):
    union = ops.Union()
    for coords in data["walls"]:
        z = 0
        x = coords[0][0]
        y = coords[0][1]
        w = coords[1][0] - x
        h = coords[2][1] - y

        offsety = -y * ratio - h * ratio

        c = ops.Cube([w * ratio, h * ratio,
                      wall_height]).translate([x * ratio, offsety, z])
        union.append(c)

    diff = ops.Difference()
    diff.append(union)

    for coords in data["doors"]:
        z = 0
        x = coords[0][0]
        y = coords[0][1]
        w = coords[1][0] - x
        h = coords[2][1] - y

        offsety = -y * ratio - h * ratio

        c = ops.Cube([w * ratio, h * ratio,
                      wall_height * 0.75]).translate([x * ratio, offsety, z])
        diff.append(c)

    for coords in data["windows"]:
        z = wall_height * 0.5
        x = coords[0][0]
        y = coords[0][1]
        w = coords[1][0] - x
        h = coords[2][1] - y

        offsety = -y * ratio - h * ratio

        c = ops.Cube([w * ratio, h * ratio,
                      wall_height * 0.33]).translate([x * ratio, offsety, z])
        diff.append(c)

    scadfile = "out.scad"
    diff.write(scadfile)
    call([openscad_path, "-o", outname, scadfile])
Exemple #11
0
def generate_nubs_center():
    # Tenting holes:
    #    (-25.05, -42.125),
    #    (25.05, -42.125),
    #    (-25.05, 53.125),
    #    (25.05, 53.125),

    nubs_union = ops.Union()
    nubs = [
        # 31.0 mm makes the nub stick out 3mm from the riser
        ops.Cylinder(h=46.0, r=1,
                     center=True).translate([-25.05, -45.125, 0.0]),
        ops.Cylinder(h=46.0, r=1, center=True).translate([-25.05, 53.125,
                                                          0.0]),
        ops.Cylinder(h=46.0, r=1, center=True).translate([25.05, -45.125,
                                                          0.0]),
        ops.Cylinder(h=46.0, r=1, center=True).translate([25.05, 53.125, 0.0]),
    ]
    for n in nubs:
        nubs_union.append(n)
    return nubs_union
Exemple #12
0
cell_w = 0.059*2. #m , (2.25")
cell_l = 0.0571 #m , (2.0")
cell_h = 0.00635 #m , (0.25")

# Render in OpenSCAD using the OpenPySCAD library
import openpyscad as ops

cell = ops.Cube([cell_w, cell_l, cell_h]).color("yellow") # Amprius Cell
heater = ops.Cylinder(h=0.11, r=0.003,  _fn=100).color("orange")
heater2 = ops.Cube([cell_w-0.002, cell_l-0.002, cell_h/5]).color("orange") # Amprius Cell

sim = ops.Union()
# module = ops.Union()
d = ops.Difference()

sim.append(heater.rotate([0, 90, 0]).translate([0.005,0.014,0.003]))
sim.append(heater.rotate([0, 90, 0]).translate([0.005,0.028,0.003]))
sim.append(heater.rotate([0, 90, 0]).translate([0.005,0.042,0.003]))
sim.append(cell.translate([0, 0, 0])) # simulator cell
sim.append(heater2.translate([0.001,cell_l*1.1+0.001,0.003]))
sim.append(cell.translate([0, cell_l*1.1, 0])) # sensor cell
    


(sim).write("sim_sens.scad")

Exemple #13
0
n_cpbl = int(np.ceil(case.get_val('n_cpb'))/2.)
n_bps = int(np.ceil(case.get_val('n_bps')))


s_h = 1.1 # horizontal spacing
s_v = 1.3 # vertical spacing
s_h2 = ((s_h-1)/2 +1)
n_stacks_show = 1

cell = ops.Cube([cell_w, cell_l, cell_h]) # Amprius Cell
pcm = ops.Cube([cell_w, cell_l, t_PCM]).color("Orange") # Phase Change Material
ohp = ops.Cube([cell_w, cell_l*n_cpb*s_h, cell_h]).color("Gray") # Oscillating Heat Pipe Straight-away
# ohp_turn = ops.Cylinder(h=cell_h, r=cell_w*s_h2, _fn=100).color("Gray") # OHP End Turn
# ohp_turn_d = ops.Cube([cell_w*2*s_h,cell_w*s_h,cell_h+0.02]) # Make it a semi-circl
#pack = ops.Union()
bar = ops.Union()
# d = ops.Difference()
# d2 = ops.Difference()
# insulation = ops.Cube([cell_w*2,cell_l*s_h*n_cpb*1.1,cell_h*s_v]).color("Blue")

stack_h = cell_h*2 + t_PCM*2

for b in range(n_cpbl):
    # Cell Array
    bar.append(cell.translate([0, cell_l*s_h*b, 0])) # first row cell
    bar.append(cell.translate([0, cell_l*s_h*b, stack_h])) # second column, first row
    bar.append(cell.translate([cell_w*s_h, cell_l*s_h*b, 0])) # second row cell
    bar.append(cell.translate([cell_w*s_h, cell_l*s_h*b, stack_h])) # second column, second row cell
    # PCM Array
    bar.append(pcm.translate([0, cell_l*s_h*b, cell_h])) # first row PCM
    bar.append(pcm.translate([0, cell_l*s_h*b, stack_h-t_PCM])) # second column, first row