Exemplo n.º 1
0
def build_test_beam():
    a = Assembly('MyAssembly')
    p = Part('MyPart')
    p.add_beam(Beam('Bm', (0, 0, 0), (1, 0, 0), 'IPE300'))
    p.gmsh.mesh(0.5)
    a.add_part(p)
    return a
Exemplo n.º 2
0
 def test_write_simple_stru(self):
     from ada.param_models.basic_module import SimpleStru
     a = Assembly('MyTest')
     p = SimpleStru('SimpleStru')
     a.add_part(p)
     p.gmsh.mesh()
     a.to_fem('MyTest', fem_format='sesam', overwrite=True)
Exemplo n.º 3
0
 def test_profiles_to_ifc(self):
     a = Assembly("MyAssembly")
     p = Part("MyPart")
     p.add_beam(
         Beam("bm1", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE220",
              colour="red"))
     p.add_beam(
         Beam("bm2",
              n1=[0, 0, 1],
              n2=[2, 0, 1],
              sec="HP220x10",
              colour="blue"))
     p.add_beam(
         Beam("bm3",
              n1=[0, 0, 2],
              n2=[2, 0, 2],
              sec="BG800x400x20x40",
              colour="green"))
     p.add_beam(
         Beam("bm4",
              n1=[0, 0, 3],
              n2=[2, 0, 3],
              sec="CIRC200",
              colour="green"))
     p.add_beam(
         Beam("bm5",
              n1=[0, 0, 4],
              n2=[2, 0, 4],
              sec="TUB200x10",
              colour="green"))
     a.add_part(p)
     a.to_ifc(test_folder / "my_beam_profiles.ifc")
Exemplo n.º 4
0
    def test_ifc_groups(self):
        a = Assembly("MySiteName", project="MyTestProject")
        p = Part(
            "MyTopSpatialLevel",
            metadata=dict(ifctype="spatial", description="MyTopLevelSpace"),
        )
        p.add_beam(Beam("bm1", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE220", colour="red"))
        a.add_part(p)

        newp = Part(
            "MySecondLevel",
            metadata=dict(ifctype="spatial", description="MySecondLevelSpace"),
        )
        newp.add_beam(Beam("bm2", n1=[0, 0, 0], n2=[0, 2, 0], sec="IPE220", colour="blue"))
        p.add_part(newp)

        newp2 = Part(
            "MyThirdLevel",
            metadata=dict(ifctype="spatial", description="MyThirdLevelSpace"),
        )
        newp2.add_beam(Beam("bm3", n1=[0, 0, 0], n2=[0, 0, 2], sec="IPE220", colour="green"))
        newp2.add_plate(
            Plate(
                "pl1",
                [(0, 0, 0), (0, 0, 2), (0, 2, 2), (0, 2.0, 0.0)],
                0.01,
                use3dnodes=True,
            )
        )
        newp.add_part(newp2)

        a.to_ifc(test_folder / "my_test_groups.ifc")
Exemplo n.º 5
0
def build_test_beam():
    a = Assembly("MyAssembly")
    p = Part("MyPart")
    p.add_beam(Beam("Bm", (0, 0, 0), (1, 0, 0), "IPE300"))
    p.gmsh.mesh(0.5)
    a.add_part(p)
    return a
Exemplo n.º 6
0
    def test_basic_module_to_from_ifc(self):
        a = Assembly("ParametricSite")
        a.add_part(SimpleStru("ParametricModel"))
        a.to_ifc(test_folder / "param1.ifc")

        a2 = Assembly("ImportedParam")
        a2.read_ifc(test_folder / "param1.ifc")
        a2.to_ifc(test_folder / "param1_reimported.ifc")
Exemplo n.º 7
0
    def test_module(self):
        a = Assembly("ParametricSite")
        pm = SimpleStru("ParametricModel")
        a.add_part(pm)
        a.gmsh.mesh()

        a._repr_html_()
        a._renderer.toggle_mesh_visibility()
Exemplo n.º 8
0
def build_test_model():
    param_model = SimpleStru("ParametricModel")
    a = Assembly("ParametricSite")
    a.add_part(param_model)
    param_model.gmsh.mesh(max_dim=2, interactive=False)
    param_model.add_bcs()

    return a
Exemplo n.º 9
0
    def test_fem(self):
        a = Assembly("MyAssembly")
        p = Part("MyPart")
        p.add_beam(Beam("Bm", (0, 0, 0), (1, 0, 0), "IPE300"))
        a.add_part(p)
        a.gmsh.mesh()

        a._repr_html_()
        a._renderer.toggle_mesh_visibility()
Exemplo n.º 10
0
    def test_2ifc_simple(self):
        a = Assembly("ExportedPlates")
        p = Part("MyPart")
        a.add_part(p)

        atts2 = dict(origin=(0, 0, 0), xdir=(1, 0, 0), normal=(0, -1, 0))
        pl2 = Plate("MyPl2", [(0, 0, 0.2), (5, 0, 0.2), (5, 5), (0, 5)], 20e-3, **atts2)
        p.add_plate(pl2)
        a.to_ifc(test_folder / "my_plate_poly.ifc")
Exemplo n.º 11
0
 def test_module2(self):
     param_model = SimpleStru("ParametricModel")
     param_model.gmsh.mesh(size=0.1, max_dim=2)
     param_model.add_bcs()
     a = Assembly("ParametricSite")
     a.add_part(param_model)
     a._repr_html_()
     # a._renderer.toggle_geom_visibility()
     a._renderer.toggle_mesh_visibility()
Exemplo n.º 12
0
def test_profiles_to_ifc(ifc_test_dir):
    a = Assembly("MyAssembly")
    p = Part("MyPart")
    p.add_beam(Beam("bm1", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE220", colour="red"))
    p.add_beam(Beam("bm2", n1=[0, 0, 1], n2=[2, 0, 1], sec="HP220x10", colour="blue"))
    p.add_beam(Beam("bm3", n1=[0, 0, 2], n2=[2, 0, 2], sec="BG800x400x20x40", colour="green"))
    p.add_beam(Beam("bm4", n1=[0, 0, 3], n2=[2, 0, 3], sec="CIRC200", colour="green"))
    p.add_beam(Beam("bm5", n1=[0, 0, 4], n2=[2, 0, 4], sec="TUB200x10", colour="green"))
    a.add_part(p)
    _ = a.to_ifc(ifc_test_dir / "my_beam_profiles.ifc", return_file_obj=True)
Exemplo n.º 13
0
def read_hierarchy(f, a: Assembly, ifc_ref: IfcRef):
    for product in f.by_type("IfcProduct"):
        parent, new_part = import_ifc_hierarchy(a, product, ifc_ref)
        if new_part is None:
            continue
        if parent is None:
            a.add_part(new_part)
        elif type(parent) is not Part:
            raise NotImplementedError()
        else:
            parent.add_part(new_part)
Exemplo n.º 14
0
    def test_ifc_roundtrip(self):
        a = Assembly("my_test_assembly")
        a.add_part(SimpleStru("my_simple_stru"))
        a.to_ifc(test_folder / "my_test.ifc")

        b = Assembly("MyReImport")
        b.read_ifc(test_folder / "my_test.ifc")
        b.to_ifc(test_folder / "my_test_re_exported.ifc")

        all_parts = b.get_all_parts_in_assembly()
        assert len(all_parts) == 3
Exemplo n.º 15
0
    def test_material_ifc_roundtrip(self):

        ifc_name = "my_material.ifc"

        a = Assembly("MyAssembly")
        p = Part("MyPart")
        p.add_material(Material("my_mat"))
        a.add_part(p)
        a.to_ifc(test_folder / ifc_name)

        b = Assembly("MyImport")
        b.read_ifc(test_folder / ifc_name)
Exemplo n.º 16
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)
Exemplo n.º 17
0
    def test_material_ifc_roundtrip(self):

        ifc_name = 'my_material.ifc'

        a = Assembly('MyAssembly')
        p = Part('MyPart')
        p.add_material(Material('my_mat'))
        a.add_part(p)
        a.to_ifc(test_folder / ifc_name)

        b = Assembly('MyImport')
        b.read_ifc(test_folder / ifc_name)
Exemplo n.º 18
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_()
Exemplo n.º 19
0
    def test_beam_directions(self):
        a = Assembly("AdaRotatedProfiles")
        p = Part("Part")
        a.add_part(p)

        props = dict(spre="/JSB_VA-DIN-SPEC/Y26IPE400", matr="/GR.355-II(Y26)_jsb_va")

        p.add_beam(
            Beam(
                "bm_test2X0",
                n1=[0, 0, 0],
                n2=[5, 0, 0],
                sec=section,
                angle=0,
                metadata=dict(props=props),
            )
        )
        p.add_beam(
            Beam(
                "bm_test2X90",
                n1=[0, 0, 1],
                n2=[5, 0, 1],
                sec=section,
                angle=90,
                metadata=dict(props=props),
            )
        )
        p.add_beam(
            Beam(
                "bm_test2Y0",
                n1=[0, 0, 2],
                n2=[0, 5, 2],
                sec=section,
                angle=0,
                metadata=dict(props=props),
            )
        )
        p.add_beam(
            Beam(
                "bm_test2Y90",
                n1=[0, 0, 3],
                n2=[0, 5, 3],
                sec=section,
                angle=90,
                metadata=dict(props=props),
            )
        )

        a.to_ifc(test_folder / "my_angled_profiles.ifc")
Exemplo n.º 20
0
 def create_ifc(name, up=(0, 0, 1)):
     a = Assembly("MyAssembly")
     p = Part(name)
     p.add_beam(
         Beam(
             "bm_up",
             n1=[0, 0, 0],
             n2=[2, 0, 0],
             sec="HP200x10",
             mat=Material("SteelMat", CarbonSteel("S420")),
             colour="red",
             up=up,
         ))
     a.add_part(p)
     a.to_ifc(test_folder / name)
Exemplo n.º 21
0
    def test_meter_to_millimeter(self):
        a = Assembly("MySiteName", project="MyTestProject")
        p = Part(
            "MyTopSpatialLevel",
            metadata=dict(ifctype="storey", description="MyTopLevelSpace"),
        )
        bm1 = Beam("bm1",
                   n1=[0, 0, 0],
                   n2=[2, 0, 0],
                   sec="IPE220",
                   colour="red")
        p.add_beam(bm1)
        a.add_part(p)

        newp = Part(
            "MySecondLevel",
            metadata=dict(ifctype="storey", description="MySecondLevelSpace"),
        )
        bm2 = Beam("bm2",
                   n1=[0, 0, 0],
                   n2=[0, 2, 0],
                   sec="IPE220",
                   colour="blue")
        newp.add_beam(bm2)
        p.add_part(newp)

        newp2 = Part(
            "MyThirdLevel",
            metadata=dict(ifctype="storey", description="MyThirdLevelSpace"),
        )
        bm3 = Beam("bm3",
                   n1=[0, 0, 0],
                   n2=[0, 0, 2],
                   sec="IPE220",
                   colour="green")
        newp2.add_beam(bm3)
        pl1 = Plate(
            "pl1",
            [(0, 0, 0), (0, 0, 2), (0, 2, 2), (0, 2.0, 0.0)],
            0.01,
            use3dnodes=True,
        )
        newp2.add_plate(pl1)
        newp.add_part(newp2)

        a.to_ifc(test_folder / "my_test_in_meter.ifc")

        a.units = "mm"
Exemplo n.º 22
0
    def test_write_simple_stru(self):
        from ada.param_models.basic_module import SimpleStru

        a = Assembly("MyTest")
        p = a.add_part(SimpleStru("SimpleStru"))
        p.gmsh.mesh()
        a.to_fem("MyTest", fem_format="sesam", overwrite=True)
Exemplo n.º 23
0
    def test_wall_simple(self):
        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)

        a = Assembly("MyAssembly")
        p = Part("MyPart")
        a.add_part(p)
        p.add_wall(w)
        a.to_ifc(test_folder / "my_wall_wDoorsWindows.ifc")
        a._repr_html_()
Exemplo n.º 24
0
    def test_roundtrip_fillets(self):
        a = Assembly("ExportedPlates")
        p = Part("MyPart")
        a.add_part(p)
        pl1 = Plate("MyPl", [(0, 0, 0.2), (5, 0), (5, 5), (0, 5)], 20e-3, **atts)
        p.add_plate(pl1)

        atts2 = dict(origin=(0, 0, 0), xdir=(1, 0, 0), normal=(0, -1, 0))
        pl2 = Plate("MyPl2", [(0, 0, 0.2), (5, 0, 0.2), (5, 5), (0, 5)], 20e-3, **atts2)
        p.add_plate(pl2)

        a.to_ifc(test_folder / "my_plate_simple.ifc")

        b = Assembly("MyReimport")
        b.read_ifc(test_folder / "my_plate_simple.ifc")
        b.to_ifc(test_folder / "my_plate_simple_re_exported.ifc")
Exemplo n.º 25
0
def test_beam_rotation_by_angle():
    # Define beam rotations using vectors
    angles = [0, 90, 180, 270]
    vectorX = [(0, 0, 1), (0, -1, 0), (0, 0, -1), (0, 1, 0)]
    vectorY = [(0, 0, 1), (1, 0, 0), (0, 0, -1), (-1, 0, 0)]
    vectorZ = [(0, 1, 0), (-1, 0, 0), (0, -1, 0), (1, 0, 0)]

    a = Assembly("AdaRotatedProfiles")
    p = a.add_part(Part("RotatedBeams"))
    sec = "HP200x10"
    d1 = dict(n1=(0, 0, 0), n2=(5, 0, 0), sec=sec)
    d2 = dict(n1=(0, 0, 0), n2=(0, 5, 0), sec=sec)
    d3 = dict(n1=(0, 0, 0), n2=(0, 0, 5), sec=sec)

    for i, angle in enumerate(angles):
        # Along X-Axis
        bm = p.add_beam(Beam(f"bmX_n{i}_a", **d1, angle=angle))
        assert all([x == y for x, y in zip(bm.up, vectorX[i])]) is True
        p.add_beam(Beam(f"bmX_n{i}_v", **d1, up=vectorX[i]))

        # Along Y-Axis
        bm = p.add_beam(Beam(f"bmY_n{i}_a", **d2, angle=angle))
        assert all([x == y for x, y in zip(bm.up, vectorY[i])]) is True
        p.add_beam(Beam(f"bmY_n{i}_v", **d2, up=vectorY[i]))

        # Along Z-Axis
        bm = p.add_beam(Beam(f"bmZ_n{i}_a", **d3, angle=angle))
        assert all([x == y for x, y in zip(bm.up, vectorZ[i])]) is True
        p.add_beam(Beam(f"bmZ_n{i}_v", **d3, up=vectorZ[i]))
Exemplo n.º 26
0
    def test_parts_list(self):
        a = Assembly("MyAssembly")
        # Level 1
        part = Part("my_part1")
        a.add_part(part)
        a.add_part(Part("my_part2"))
        # Level 2
        part.add_part(Part("my_part1_subpart1"))
        part.add_part(Part("my_part1_subpart2"))
        # Level 3
        subpart3 = Part("my_part1_subpart3")
        subpart3.add_part(Part("my_part1_subpart3_sub1"))
        part.add_part(subpart3)
        list_of_ps = a.get_all_parts_in_assembly()

        self.assertEqual(len(list_of_ps), 6)
Exemplo n.º 27
0
def test_wall_simple(dummy_display):
    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)

    a = Assembly("MyAssembly")
    p = Part("MyPart")
    a.add_part(p)
    p.add_wall(w)
    _ = a.to_ifc(test_folder / "my_wall_wDoorsWindows.ifc", return_file_obj=True)

    dummy_display(a)
Exemplo n.º 28
0
    def test_to_fem(self):

        param_model = SimpleStru("ParametricModel")
        param_model.gmsh.mesh(order=1, size=0.1, max_dim=2, interactive=False)
        param_model.add_bcs()
        assert len(param_model.fem.bcs) == 4
        assert len(param_model.fem.elements) == 10420
        assert len(param_model.fem.nodes) == 5318

        a = Assembly("ParametricSite")
        a.add_part(param_model)

        my_step = Step("static", "static", total_time=1, max_incr=1, init_incr=1, nl_geom=True)
        my_step.add_load(Load("Gravity", "gravity", -9.81))
        a.fem.add_step(my_step)

        a.to_fem("SimpleStru", fem_format="abaqus", overwrite=True)
Exemplo n.º 29
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")
Exemplo n.º 30
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