예제 #1
0
    def test_simplestru_units(self):

        pm = SimpleStru("ParametricModel")
        elev = pm.Params.h - 0.4
        offset_Y = 0.4

        pipe1 = Pipe(
            "Pipe1",
            [
                (0, offset_Y, elev),
                (pm.Params.w + 0.4, offset_Y, elev),
                (pm.Params.w + 0.4, pm.Params.l + 0.4, elev),
                (pm.Params.w + 0.4, pm.Params.l + 0.4, 0.4),
                (0, pm.Params.l + 0.4, 0.4),
            ],
            Section("PSec1", "PIPE", r=0.1, wt=10e-3),
        )

        pipe2 = Pipe(
            "Pipe2",
            [
                (0.5, offset_Y + 0.5, elev + 1.4),
                (0.5, offset_Y + 0.5, elev),
                (0.2 + pm.Params.w, offset_Y + 0.5, elev),
                (0.2 + pm.Params.w, pm.Params.l + 0.4, elev),
                (0.2 + pm.Params.w, pm.Params.l + 0.4, 0.6),
                (0, pm.Params.l + 0.4, 0.6),
            ],
            Section("PSec1", "PIPE", r=0.05, wt=5e-3),
        )

        a = Assembly("ParametricSite")
        a.add_part(pm)
        pm.add_pipe(pipe1)
        pm.add_pipe(pipe2)

        for p in pm.parts.values():
            if type(p) is ReinforcedFloor:
                p.penetration_check()

        a.units = "mm"
        a.to_ifc(test_folder / "my_simple_stru_mm.ifc")
예제 #2
0
def make_it_complex():
    from ada import Assembly, Pipe, Section

    a = Assembly("ParametricSite")

    pm = SimpleStru("ParametricModel")
    a.add_part(pm)

    elev = pm.Params.h - 0.4
    offset_Y = 0.4
    pipe1 = Pipe(
        "Pipe1",
        [
            (0, offset_Y, elev),
            (pm.Params.w + 0.4, offset_Y, elev),
            (pm.Params.w + 0.4, pm.Params.l + 0.4, elev),
            (pm.Params.w + 0.4, pm.Params.l + 0.4, 0.4),
            (0, pm.Params.l + 0.4, 0.4),
        ],
        Section("PSec1", "PIPE", r=0.1, wt=10e-3),
    )

    pipe2 = Pipe(
        "Pipe2",
        [
            (0.5, offset_Y + 0.5, elev + 1.4),
            (0.5, offset_Y + 0.5, elev),
            (0.2 + pm.Params.w, offset_Y + 0.5, elev),
            (0.2 + pm.Params.w, pm.Params.l + 0.4, elev),
            (0.2 + pm.Params.w, pm.Params.l + 0.4, 0.6),
            (0, pm.Params.l + 0.4, 0.6),
        ],
        Section("PSec1", "PIPE", r=0.05, wt=5e-3),
    )

    pm.add_pipe(pipe1)
    pm.add_pipe(pipe2)
    for p in pm.parts.values():
        if type(p) is ReinforcedFloor:
            p.penetration_check()
    return a
예제 #3
0
    def test_pipe_straight(self):
        a = Assembly("MyTest")

        p = Part("MyPart")
        a.add_part(p)
        z = 3.2
        y0 = -200e-3
        pipe1 = Pipe("Pipe1", [(0, y0, 0), (0, y0, z)],
                     Section("PSec", "PIPE", r=0.10, wt=5e-3))
        p.add_pipe(pipe1)
        a.to_ifc(test_folder / "pipe_straight.ifc")
        a._repr_html_()
예제 #4
0
def test_pipe_straight(dummy_display):
    a = Assembly("MyTest")

    p = Part("MyPart")
    a.add_part(p)
    z = 3.2
    y0 = -200e-3
    pipe1 = Pipe("Pipe1", [(0, y0, 0), (0, y0, z)],
                 Section("PSec", "PIPE", r=0.10, wt=5e-3))
    p.add_pipe(pipe1)
    _ = a.to_ifc(test_dir / "pipe_straight.ifc", return_file_obj=True)
    dummy_display(a)
예제 #5
0
    def test_add_piping(self):
        a = Assembly("ParametricSite")

        pm = SimpleStru("ParametricModel")
        a.add_part(pm)

        elev = pm.Params.h - 0.4
        offset_Y = 0.4
        pipe1 = Pipe(
            "Pipe1",
            [
                (0, offset_Y, elev),
                (pm.Params.w + 0.4, offset_Y, elev),
                (pm.Params.w + 0.4, pm.Params.l + 0.4, elev),
                (pm.Params.w + 0.4, pm.Params.l + 0.4, 0.4),
                (0, pm.Params.l + 0.4, 0.4),
            ],
            Section("PSec1", "PIPE", r=0.1, wt=10e-3),
        )

        pipe2 = Pipe(
            "Pipe2",
            [
                (0.5, offset_Y + 0.5, elev + 1.4),
                (0.5, offset_Y + 0.5, elev),
                (0.2 + pm.Params.w, offset_Y + 0.5, elev),
                (0.2 + pm.Params.w, pm.Params.l + 0.4, elev),
                (0.2 + pm.Params.w, pm.Params.l + 0.4, 0.6),
                (0, pm.Params.l + 0.4, 0.6),
            ],
            Section("PSec1", "PIPE", r=0.05, wt=5e-3),
        )

        pm.add_pipe(pipe1)
        pm.add_pipe(pipe2)
        for p in pm.parts.values():
            if "floor" in p.name:
                p.penetration_check()

        a.to_ifc(test_folder / "my_simple_stru.ifc")
예제 #6
0
def simplestru_with_cutouts():
    pm = SimpleStru("ParametricModel")
    a = Assembly("ParametricSite") / pm

    elev = pm.Params.h - 0.4
    offset_y = 0.4
    pipe1 = Pipe(
        "Pipe1",
        [
            (0, offset_y, elev),
            (pm.Params.w + 0.4, offset_y, elev),
            (pm.Params.w + 0.4, pm.Params.l + 0.4, elev),
            (pm.Params.w + 0.4, pm.Params.l + 0.4, 0.4),
            (0, pm.Params.l + 0.4, 0.4),
        ],
        Section("PSec1", "PIPE", r=0.1, wt=10e-3),
    )

    pipe2 = Pipe(
        "Pipe2",
        [
            (0.5, offset_y + 0.5, elev + 1.4),
            (0.5, offset_y + 0.5, elev),
            (0.2 + pm.Params.w, offset_y + 0.5, elev),
            (0.2 + pm.Params.w, pm.Params.l + 0.4, elev),
            (0.2 + pm.Params.w, pm.Params.l + 0.4, 0.6),
            (0, pm.Params.l + 0.4, 0.6),
        ],
        Section("PSec2", "PIPE", r=0.05, wt=5e-3),
    )
    pm.add_part(Part("Piping") / [pipe1, pipe2])
    for p in pm.parts.values():
        if type(p) is ReinforcedFloor:
            penetration_check(p)

    return a
예제 #7
0
    def test_pipe_bend(self):
        a = Assembly("MyTest")
        p = a.add_part(Part("MyPart"))

        pipe1 = Pipe(
            "Pipe1",
            [
                (0, y0, z),
                (5 + x0, y0, z),
                (5 + x0, y0 + 5, z),
                (10, y0 + 5, z + 2),
                (10, y0 + 5, z + 10),
            ],
            Section("PSec", "PIPE", r=0.10, wt=5e-3),
        )
        p.add_pipe(pipe1)
        a.to_ifc(test_folder / "pipe_bend.ifc")
예제 #8
0
def assembly() -> Assembly:
    bm1 = Beam("bm1", (0, 0, 1), (1, 0, 1), "IPE300")
    bm2 = Beam("bm2", (1.1, 0, 1), (2, 0, 1), "IPE300")
    bm3 = Beam("bm3", (2.1, 0, 1), (3, 0, 1), "IPE300")

    placement = Placement(origin=(1, 1, 1), xdir=(1, 0, 0), zdir=(0, 0, 1))
    pl_points = [(0, 0), (1, 0), (1, 1), (0, 1)]
    pl1 = Plate("pl1", pl_points, 10e-3, placement=placement)

    pipe = Pipe("pipe", [(0, 0.5, 0), (1, 0.5, 0), (1.2, 0.7, 0.2),
                         (1.5, 0.7, 0.2)], "OD120x6")

    p1, p2 = (1, -2, 0), (2, -1, 1)
    shp1 = PrimBox("MyBox", p1, p2)
    shp1.add_penetration(PrimSphere("MyCutout", p1, 0.5))

    return Assembly() / (Part("MyFemObjects") /
                         [bm1, bm2, bm3, pl1, shp1, pipe])
예제 #9
0
파일: test_units.py 프로젝트: Krande/adapy
def test_ifc_reimport():
    # Model to be re-imported
    a = Assembly("my_test_assembly") / SimpleStru("my_simple_stru")
    fp = a.to_ifc(test_folder / "my_exported_param_model.ifc",
                  return_file_obj=True)

    points = [(0, 0, 0), (5, 0, 0), (5, 5, 0)]
    w = Wall("MyWall", points, 3, 0.15, offset="LEFT")
    wi = Window("MyWindow1", 1.5, 1, 0.15)
    wi2 = Window("MyWindow2", 2, 1, 0.15)
    door = Door("Door1", 1.5, 2, 0.2)
    w.add_insert(wi, 0, 1, 1.2)
    w.add_insert(wi2, 1, 1, 1.2)
    w.add_insert(door, 0, 3.25, 0)

    p = Part("MyPart")

    p.add_elements_from_ifc(fp)
    p.add_wall(w)

    z = 3.2
    y0 = -200e-3
    x0 = -y0
    pipe1 = Pipe(
        "Pipe1",
        [
            (0, y0, z),
            (5 + x0, y0, z),
            (5 + x0, y0 + 5, z),
            (10, y0 + 5, z + 2),
            (10, y0 + 5, z + 10),
        ],
        Section("PSec1", "PIPE", r=0.10, wt=5e-3),
    )
    p.add_pipe(pipe1)

    b = Assembly("MyTest") / p

    b.units = "mm"
    b.to_ifc(test_folder / "my_reimport_of_elements_mm.ifc")
    # TODO: Re-import is still not supported. Should look into same approach as BlenderBIM by
    #       only communicating and updating the ifcopenshell file object.
    b.units = "m"
예제 #10
0
def test_pipe_bend():

    z = 3.2
    y0 = -200e-3
    x0 = -y0

    pipe1 = Pipe(
        "Pipe1",
        [
            (0, y0, z),
            (5 + x0, y0, z),
            (5 + x0, y0 + 5, z),
            (10, y0 + 5, z + 2),
            (10, y0 + 5, z + 10),
        ],
        Section("PSec", "PIPE", r=0.10, wt=5e-3),
    )

    assert pipe1.segments[1].bend_radius == pytest.approx(0.195958125)
예제 #11
0
 def test_pipe_bend(self):
     a = Assembly("MyTest")
     p = Part("MyPart")
     a.add_part(p)
     z = 3.2
     y0 = -200e-3
     x0 = -y0
     pipe1 = Pipe(
         "Pipe1",
         [
             (0, y0, z),
             (5 + x0, y0, z),
             (5 + x0, y0 + 5, z),
             (10, y0 + 5, z + 2),
             (10, y0 + 5, z + 10),
         ],
         Section("PSec", "PIPE", r=0.10, wt=5e-3),
     )
     p.add_pipe(pipe1)
     a.to_ifc(test_folder / "pipe_bend.ifc")
     a._repr_html_()
예제 #12
0
    def test_ifc_reimport(self):
        # Model to be re-imported
        a = Assembly("my_test_assembly") / SimpleStru("my_simple_stru")
        a.to_ifc(test_folder / "my_exported_param_model.ifc")

        points = [(0, 0, 0), (5, 0, 0), (5, 5, 0)]
        w = Wall("MyWall", points, 3, 0.15, offset="LEFT")
        wi = Window("MyWindow1", 1.5, 1, 0.15)
        wi2 = Window("MyWindow2", 2, 1, 0.15)
        door = Door("Door1", 1.5, 2, 0.2)
        w.add_insert(wi, 0, 1, 1.2)
        w.add_insert(wi2, 1, 1, 1.2)
        w.add_insert(door, 0, 3.25, 0)

        p = Part("MyPart")

        p.add_elements_from_ifc(test_folder / "my_exported_param_model.ifc")
        p.add_wall(w)

        z = 3.2
        y0 = -200e-3
        x0 = -y0
        pipe1 = Pipe(
            "Pipe1",
            [
                (0, y0, z),
                (5 + x0, y0, z),
                (5 + x0, y0 + 5, z),
                (10, y0 + 5, z + 2),
                (10, y0 + 5, z + 10),
            ],
            Section("PSec1", "PIPE", r=0.10, wt=5e-3),
        )
        p.add_pipe(pipe1)

        b = Assembly("MyTest") / p

        b.units = "mm"
        b.to_ifc(test_folder / "my_reimport_of_elements_mm.ifc")