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")
def test_beams_viz(self): def viz(a): a._repr_html_() bm1 = Beam("bm1", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE220", colour="red") bm2 = Beam("bm2", n1=[0, 0, 1], n2=[2, 0, 1], sec="HP220x10", colour="blue") bm3 = Beam("bm3", n1=[0, 0, 2], n2=[2, 0, 2], sec="BG800x400x20x40", colour="green") bm4 = Beam("bm4", n1=[0, 0, 3], n2=[2, 0, 3], sec="CIRC200", colour="green") bm5 = Beam("bm5", n1=[0, 0, 4], n2=[2, 0, 4], sec="TUB200x10", colour="green") viz(bm1) viz(bm2) viz(bm3) viz(bm4) viz(bm5)
def test_beam_offset(self): bm1 = Beam( "bm1", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE300", mat=Material("SteelMat", CarbonSteel("S420")), colour="red", up=(0, 0, 1), e1=(0, 0, -0.1), e2=(0, 0, -0.1), ) bm2 = Beam( "bm2", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE300", mat=Material("SteelMat", CarbonSteel("S420")), colour="blue", up=(0, 0, -1), e1=(0, 0, -0.1), e2=(0, 0, -0.1), ) a = Assembly("Toplevel") / [Part("MyPart") / [bm1, bm2]] a.to_ifc(test_folder / "beams_offset.ifc")
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")
def _calc_bbox_of_beam(self) -> Tuple[tuple, tuple]: """Get the bounding box of a beam""" from itertools import chain from ada import Beam, Section from ada.core.utils import roundoff from ..sections import SectionCat bm = self.parent if SectionCat.is_circular_profile( bm.section.type) or SectionCat.is_tubular_profile( bm.section.type): d = bm.section.r * 2 dummy_beam = Beam("dummy", bm.n1.p, bm.n2.p, Section("DummySec", "BG", h=d, w_btn=d, w_top=d)) outer_curve = dummy_beam.get_outer_points() else: outer_curve = bm.get_outer_points() points = np.array(list(chain.from_iterable(outer_curve))) xv = sorted([roundoff(p[0]) for p in points]) yv = sorted([roundoff(p[1]) for p in points]) zv = sorted([roundoff(p[2]) for p in points]) xmin, xmax = xv[0], xv[-1] ymin, ymax = yv[0], yv[-1] zmin, zmax = zv[0], zv[-1] return (xmin, ymin, zmin), (xmax, ymax, zmax)
def test_viz_structural(): components = [ Beam("bm1", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE220", colour="red"), Beam("bm2", n1=[0, 0, 1], n2=[2, 0, 1], sec="HP220x10", colour="blue"), Beam("bm3", n1=[0, 0, 2], n2=[2, 0, 2], sec="BG800x400x20x40", colour="green"), Beam("bm4", n1=[0, 0, 3], n2=[2, 0, 3], sec="CIRC200", colour="green"), Beam("bm5", n1=[0, 0, 4], n2=[2, 0, 4], sec="TUB200x10", colour="green"), Plate( "pl1", [(0, 0, 0), (0, 0, 1), (0, 1, 1), (0, 1, 0)], 0.01, use3dnodes=True, ), ] a = Assembly("my_test_assembly") / components res = a.to_vis_mesh(auto_merge_by_color=False) merged = res.merge_objects_in_parts_by_color() assert res.num_polygons == 416 assert len(res.world[0].id_map.values()) == 6 assert merged.num_polygons == 416 assert len(merged.world[0].id_map.values()) == 4
def add_random_cutouts(bm: Beam): h = 0.2 r = 0.02 normal = [0, 1, 0] xdir = [-1, 0, 0] # Polygon Extrusions origin = np.array([0.2, -0.1, -0.1]) points = [(0, 0), (0.1, 0), (0.05, 0.1)] bm.add_penetration(PrimExtrude("Poly1", points, h, normal, origin, xdir)) origin += np.array([0.2, 0, 0]) points = [(0, 0, r), (0.1, 0, r), (0.05, 0.1, r)] bm.add_penetration(PrimExtrude("Poly2", points, h, normal, origin, xdir)) origin += np.array([0.2, 0, 0]) points = [(0, 0, r), (0.1, 0, r), (0.1, 0.2, r), (0.0, 0.2, r)] bm.add_penetration(PrimExtrude("Poly3", points, h, normal, origin, xdir)) # Cylinder Extrude x = origin[0] + 0.2 bm.add_penetration(PrimCyl("cylinder", (x, -0.1, 0), (x, 0.1, 0), 0.1)) # Box Extrude x += 0.2 bm.add_penetration(PrimBox("box", (x, -0.1, -0.1), (x + 0.2, 0.1, 0.1)))
def test_poly_extrude(): bm = Beam("MyBeam", (0, 0, 0), (2, 0, 0), Section("myIPE", from_str="IPE400")) a = Assembly("Test") / [Part("MyPart") / bm] h = 0.2 r = 0.02 origin = np.array([0.1, 0.1, -0.1]) normal = np.array([0, -1, 0]) xdir = np.array([1, 0, 0]) points = [(0, 0, r), (0.1, 0, r), (0.05, 0.1, r)] bm.add_penetration(PrimExtrude("my_pen1", points, h, normal, origin, xdir)) origin += np.array([0.2, 0, 0]) points = [(0, 0, r), (0.1, 0, r), (0.1, 0.2, r), (0, 0.2, r)] bm.add_penetration(PrimExtrude("my_pen2", points, h, normal, origin, xdir)) origin += np.array([0.2, 0, 0]) points = [(0, 0, r), (0.2, 0, r), (0.25, 0.1, r), (0.25, 0.25, r), (0, 0.25, r)] bm.add_penetration(PrimExtrude("my_pen3", points, h, normal, origin, xdir)) origin += np.array([0.4, 0, 0]) points = [ (0, 0, r), (0.2, 0, r), (0.25, 0.1, r), (0.5, 0.0, r), (0.5, 0.25, r), (0, 0.25, r), ] bm.add_penetration(PrimExtrude("my_pen4", points, h, normal, origin, xdir)) _ = a.to_ifc(test_dir / "penetrations_poly.ifc", return_file_obj=True)
def test_meter_to_millimeter(test_units_dir): p = Part( "MyTopSpatialLevel", metadata=dict(ifctype="storey", description="MyTopLevelSpace"), ) bm1 = Beam("bm1", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE220", colour="red") p2 = Part( "MySecondLevel", metadata=dict(ifctype="storey", description="MySecondLevelSpace"), ) bm2 = Beam("bm2", n1=[0, 0, 0], n2=[0, 2, 0], sec="IPE220", colour="blue") p3 = Part( "MyThirdLevel", metadata=dict(ifctype="storey", description="MyThirdLevelSpace"), ) bm3 = Beam("bm3", n1=[0, 0, 0], n2=[0, 0, 2], sec="IPE220", colour="green") pl1 = Plate( "pl1", [(0, 0, 0), (0, 0, 2), (0, 2, 2), (0, 2.0, 0.0)], 0.01, use3dnodes=True, ) a = Assembly("MySiteName", project="MyTestProject") / [ p / [bm1, p2 / [bm2, p3 / [bm3, pl1]]] ] # a.to_ifc(test_units_dir / "my_test_in_meter.ifc") a.units = "mm" assert tuple(bm3.n2.p) == (0, 0, 2000) assert pl1.t == 10
def test_viz_to_binary_json(test_dir): components = [ Beam("bm1", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE220", colour="red"), Beam("bm2", n1=[0, 0, 1], n2=[2, 0, 1], sec="HP220x10", colour="blue"), Beam("bm3", n1=[0, 0, 2], n2=[2, 0, 2], sec="BG800x400x20x40", colour="green"), Beam("bm4", n1=[0, 0, 3], n2=[2, 0, 3], sec="CIRC200", colour="green"), Beam("bm5", n1=[0, 0, 4], n2=[2, 0, 4], sec="TUB200x10", colour="green"), Plate( "pl1", [(0, 0, 0), (0, 0, 1), (0, 1, 1), (0, 1, 0)], 0.01, use3dnodes=True, ), ] a = Assembly("my_test_assembly") / components res = a.to_vis_mesh() res.to_binary_and_json(test_dir / "viz/binjson/beams") res.to_custom_json(test_dir / "viz/binjson/beams.json")
def test_simple_hinged_beam(test_dir): bm = Beam("MyBeam", (0, 0, 0), (1, 0, 0), "IPE400") bm.hinge_prop = HingeProp(end1=Hinge([1, 2, 3, 4, 6], Csys("MyBeam_hinge"))) p = Part("MyPart") / bm p.fem = p.to_fem_obj(0.1) convert_hinges_2_couplings(p.fem) assert len(p.fem.constraints.values()) == 1
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)
def test_poly_revolve(self): bm = Beam("MyBeam", (0, 0, 0), (2, 0, 0), Section("myIPE", from_str="IPE400")) a = Assembly("Test") / [Part("MyPart") / bm] origin = (1.5, 0, 0.05) normal = (1, 0, 0) xdir = (0, 1, 0) rev_angle = 180 points2d = [(1, 0.0), (1.2, 0.0), (1.1, 0.2)] bm.add_penetration(PrimRevolve("my_pen_revolved", points2d, origin, xdir, normal, rev_angle)) a.to_stp(test_folder / "penetrations_revolve.stp") a.to_ifc(test_folder / "penetrations_revolve.ifc")
def test_bbox_viz(): blist = [] ypos = 0 for sec in ["IPE300", "HP200x10", "TUB300x30", "TUB300/200x20"]: bm = Beam(sec, (0, ypos, 0), (0, ypos, 1), sec) blist += [ Part(sec + "_Z") / [ bm, PrimBox("Bbox_Z_" + sec, *bm.bbox.minmax, colour="red", opacity=0.5) ] ] bm = Beam(sec, (0, ypos, 2), (1, ypos, 2), sec) blist += [ Part(sec + "_X") / [ bm, PrimBox("Bbox_X_" + sec, *bm.bbox.minmax, colour="red", opacity=0.5) ] ] bm = Beam("bm_" + sec + "_Y", (ypos, 0, 3), (ypos, 1, 3), sec) blist += [ Part(sec + "_Y") / [ bm, PrimBox("Bbox_Y_" + sec, *bm.bbox.minmax, colour="red", opacity=0.5) ] ] bm = Beam("bm_" + sec + "_XYZ", (ypos, ypos, 4), (ypos + 1, ypos + 1, 5), sec) blist += [ Part(sec + "_XYZ") / [ bm, PrimBox("Bbox_XYZ_" + sec, *bm.bbox.minmax, colour="red", opacity=0.5) ] ] ypos += 1 a = Assembly() / blist _ = a.to_ifc(test_dir / "beam_bounding_box.ifc", return_file_obj=True)
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")
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"
def test_bm(): bm = Beam("MyBeam", (0, 0.5, 0.5), (5, 0.5, 0.5), "IPE400", Material("S420", CarbonSteel("S420"))) f1 = fundamental_eigenfrequency(bm) f2 = 6.268 * f1 f3 = 17.456 * f1 print(f"Fundamental Eigenfrequencies\n\n1: {f1}\n2: {f2}\n3: {f3}") return bm
def test_export_layers(): bm = Beam( "MyBeam", (0, 0, 0), (2, 0, 0), Section("MySec", from_str="BG300x200x10x20"), metadata=dict(hidden=True), ) webh = bm.section.h - bm.section.t_fbtn * 2 pl1 = Plate( "Web1", [(0, 0), (2, 0), (2, webh), (0, webh)], bm.section.t_w, placement=Placement(origin=(0, -bm.section.w_btn / 2 + bm.section.t_w, -webh / 2), zdir=(0, -1, 0), xdir=(1, 0, 0)), ) pl2 = Plate( "Web2", [(0, 0), (2, 0), (2, webh), (0, webh)], bm.section.t_w, placement=Placement(origin=(0, bm.section.w_btn / 2, -webh / 2), zdir=(0, -1, 0), xdir=(1, 0, 0)), ) pl3 = Plate( "Fla1", [(0, 0), (2, 0), (2, bm.section.w_top), (0, bm.section.w_top)], bm.section.t_fbtn, placement=Placement(origin=(0, -bm.section.w_btn / 2, -bm.section.h / 2), zdir=(0, 0, 1), xdir=(1, 0, 0)), ) pl4 = Plate( "Fla2", [(0, 0), (2, 0), (2, bm.section.w_top), (0, bm.section.w_top)], bm.section.t_fbtn, placement=Placement( origin=(0, -bm.section.w_btn / 2, bm.section.h / 2 - bm.section.t_fbtn), zdir=(0, 0, 1), xdir=(1, 0, 0), ), ) p = Part("MyBldg", metadata=dict(ifctype="building")) a = Assembly("MySite", project="MyLayersProject") / (p / [bm, pl1, pl2, pl3, pl4]) ifc_name = "MyLayerTest.ifc" fp = a.to_ifc(test_dir / ifc_name, return_file_obj=True) print(a) b = ada.from_ifc(fp) print(b)
def test_cone_beam(self): s_o = [(375.0, 375.0, 375.0), (375.0, -375.0, 375.0), (-375.0, -375.0, 375.0), (-375.0, 375.0, 375.0)] s_i = [(325.0, 325.0, 325.0), (-325.0, 325.0, 325.0), (-325.0, -325.0, 325.0), (325.0, -325.0, 325.0)] e_o = [(525.0, 525.0, 525.0), (525.0, -525.0, 525.0), (-525.0, -525.0, 525.0), (-525.0, 525.0, 525.0)] e_i = [(475.0, 475.0, 475.0), (-475.0, 475.0, 475.0), (-475.0, -475.0, 475.0), (475.0, -475.0, 475.0)] poly_s_o = CurvePoly(s_o, (0, 0, 0), (0, 0, 1), (1, 0, 0)) poly_s_i = CurvePoly(s_i, (0, 0, 0), (0, 0, 1), (1, 0, 0)) section_s = Section('MyStartCrossSection', "poly", outer_poly=poly_s_o, inner_poly=poly_s_i, units="mm") poly_e_o = CurvePoly(e_o, (0, 0, 0), (0, 0, 1), (1, 0, 0)) poly_e_i = CurvePoly(e_i, (0, 0, 0), (0, 0, 1), (1, 0, 0)) section_e = Section('MyEndCrossSection', "poly", outer_poly=poly_e_o, inner_poly=poly_e_i, units="mm") bm = Beam('MyCone', (2, 2, 2), (4, 4, 4), sec=section_s, tap=section_e) a = Assembly( 'Level1', project='Project0', creator='krande', units='mm') / (Part('Level2') / bm) a.to_ifc(test_folder / 'cone_ex.ifc')
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
def import_straight_beam(ifc_elem, axis, name, sec, mat, ifc_ref: IfcRef, assembly: Assembly) -> Beam: p1_loc = axis.Points[0].Coordinates p2_loc = axis.Points[1].Coordinates ifc_axis_2_place3d = ifc_elem.ObjectPlacement.RelativePlacement origin = ifc_axis_2_place3d.Location.Coordinates local_z = np.array(ifc_axis_2_place3d.Axis.DirectionRatios) local_x = np.array(ifc_axis_2_place3d.RefDirection.DirectionRatios) local_y = calc_yvec(local_x, local_z) # res = transform3d([local_x, local_y, local_z], [X, Y], origin, [p1_loc, p2_loc]) vlen = vector_length(np.array(p2_loc) - np.array(p1_loc)) p1 = origin p2 = np.array(p1) + local_z * vlen return Beam(name, p1, p2, sec=sec, mat=mat, up=local_y, guid=ifc_elem.GlobalId, ifc_ref=ifc_ref, units=assembly.units)
def test_cone_beam(): s_o = [(375.0, 375.0, 375.0), (375.0, -375.0, 375.0), (-375.0, -375.0, 375.0), (-375.0, 375.0, 375.0)] s_i = [(325.0, 325.0, 325.0), (-325.0, 325.0, 325.0), (-325.0, -325.0, 325.0), (325.0, -325.0, 325.0)] e_o = [(525.0, 525.0, 525.0), (525.0, -525.0, 525.0), (-525.0, -525.0, 525.0), (-525.0, 525.0, 525.0)] e_i = [(475.0, 475.0, 475.0), (-475.0, 475.0, 475.0), (-475.0, -475.0, 475.0), (475.0, -475.0, 475.0)] poly_s_o = CurvePoly(s_o, (0, 0, 0), (0, 0, 1), (1, 0, 0)) poly_s_i = CurvePoly(s_i, (0, 0, 0), (0, 0, 1), (1, 0, 0)) section_s = Section("MyStartCrossSection", "poly", outer_poly=poly_s_o, inner_poly=poly_s_i, units="mm") poly_e_o = CurvePoly(e_o, (0, 0, 0), (0, 0, 1), (1, 0, 0)) poly_e_i = CurvePoly(e_i, (0, 0, 0), (0, 0, 1), (1, 0, 0)) section_e = Section("MyEndCrossSection", "poly", outer_poly=poly_e_o, inner_poly=poly_e_i, units="mm") bm = Beam("MyCone", (2, 2, 2), (4, 4, 4), sec=section_s, tap=section_e) a = Assembly("Level1", project="Project0", units="mm") / (Part("Level2") / bm) _ = a.to_ifc(test_dir / "cone_ex.ifc", return_file_obj=True)
def test_circ_profile(self): validation = [dict(r=0.125)] for i, sec in enumerate(["CIRC125"]): bm = Beam("my_beam", (0, 0, 0), (1, 1, 1), sec) assert isinstance(bm.section, Section) assert isinstance(bm.material, Material) assert validation[i]["r"] == bm.section.r
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
def adjust_column(self, column: Beam, gi1: Beam, gi2: Beam, s): dist = max(gi1.section.h, gi2.section.h) / 2 xvec = column.xvec adjust_vec = 1 if s == 1.0 else -1 adjust_col_end = adjust_vec * xvec * dist if adjust_vec == 1: if column.e2 is None: column.e2 = adjust_col_end else: column.e2 += adjust_col_end else: if column.e1 is None: column.e1 = adjust_col_end else: column.e1 += adjust_col_end
def line_elem_to_beam(elem: Elem, parent: Part) -> Beam: """Convert FEM line element to Beam""" a = parent.get_assembly() n1 = elem.nodes[0] n2 = elem.nodes[-1] e1 = None e2 = None elem.fem_sec.material.parent = parent if a.convert_options.fem2concepts_include_ecc is True: if elem.eccentricity is not None: ecc = elem.eccentricity if ecc.end1 is not None and ecc.end1.node.id == n1.id: e1 = ecc.end1.ecc_vector if ecc.end2 is not None and ecc.end2.node.id == n2.id: e2 = ecc.end2.ecc_vector if elem.fem_sec.section.type == "GENBEAM": logging.error( f"Beam elem {elem.id} uses a GENBEAM which might not represent an actual cross section" ) return Beam( f"bm{elem.id}", n1, n2, elem.fem_sec.section, elem.fem_sec.material, up=elem.fem_sec.local_z, e1=e1, e2=e2, parent=parent, )
def test_tub_profile(self): validation = [dict(r=0.3, wt=0.04)] for i, sec in enumerate(["PIPE300x40"]): bm = Beam("my_beam", (0, 0, 0), (0, 0, 1), sec) assert isinstance(bm.section, Section) assert isinstance(bm.material, Material) assert validation[i]["r"] == bm.section.r assert validation[i]["wt"] == bm.section.wt
def test_fem(self): a = Assembly("MyAssembly") / (Part("MyPart") / Beam("Bm", (0, 0, 0), (1, 0, 0), "IPE300")) a.gmsh.mesh() a._repr_html_() a._renderer.toggle_mesh_visibility()
def test_to_ifc(self): bm1 = Beam("bm1", n1=[0, 0, 0], n2=[2, 0, 0], sec="IPE220", colour="red") bm2 = Beam("bm2", n1=[0, 0, 0], n2=[0, 2, 0], sec="IPE220", colour="blue") bm3 = Beam("bm3", n1=[0, 0, 0], n2=[0, 0, 2], sec="IPE220", colour="green") bm4 = Beam("bm4", n1=[0, 0, 0], n2=[2, 0, 2], sec="IPE220", colour="black") bm5 = Beam("bm5", n1=[0, 0, 2], n2=[2, 0, 2], sec="IPE220", colour="white") pl1 = Plate( "pl1", [(0, 0, 0), (0, 0, 2), (0, 2, 2), (0, 2.0, 0.0)], 0.01, use3dnodes=True, ) a = Assembly("MySite") / [Part("MyBuilding") / [bm1, bm2, bm3, bm4, bm5, pl1]] a.to_ifc(test_folder / "my_test.ifc")
def __init__( self, name, w=5, l=5, h=3, gsec="IPE200", csec="HEB200", pl_thick=10e-3, placement=Placement(), ): super(SimpleStru, self).__init__(name, placement=placement) self.Params.w = w self.Params.h = h self.Params.l = l # Define the 5 corner points of each storey c1, c2, c3, c4 = self.c1, self.c2, self.c3, self.c4 # Define the relationship of corners that make up the 4 support beams beams = [(c1, c2), (c2, c3), (c3, c4), (c4, c1)] z0 = 0 z1 = h sec = Section(gsec, from_str=gsec, parent=self) self._elevations = [z0, z1] for elev in self._elevations: for p1, p2 in beams: self.add_beam( Beam(next(bm_name), n1=p1(elev), n2=p2(elev), sec=sec, jusl=Beam.JUSL_TYPES.TOS)) points = [c1(elev), c2(elev), c3(elev), c4(elev)] p = self.add_part( ReinforcedFloor(next(floor_name), points, pl_thick)) self.add_set("floors", [p]) # Columns columns = [(c1(z0), c1(h)), (c2(z0), c2(h)), (c3(z0), c3(h)), (c4(z0), c4(h))] for p1, p2 in columns: bm = self.add_beam(Beam(next(bm_name), n1=p1, n2=p2, sec=csec)) self.add_set("columns", [bm])