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_ex2(self): origin = [362857.44778571784, 100000.0, 561902.5557556185] csys = [ [0.0, 1.0, 0.0], [-0.9756456931466083, 0.0, 0.2193524138104576], [0.2193524138104576, 0.0, 0.9756456931466083], ] local_points2d = [ [-35.000000000029075, 246.8832348783828], [-15.0, 154.3], [6.4472604556706474e-15, 74.98044924694155], [0.0, -170.7], [-3.376144703353855e-14, -320.6997855533479], [-330.0, -320.7, -1.0189517968329821e-10], [-400.0, -235.7, 50.0], [-400.0, -70.7, 50.0], [-325.0, 154.3, 50.0], [-85.00004587117287, 500.03303441608927, 24.99999999997542], [-34.99999999999994, 500.0330344161669, -7.881391015070461e-12], ] thick = 30 pl = Plate("test2", local_points2d, thick, origin=origin, normal=csys[2], xdir=csys[0], units="mm") a = Assembly(units="mm") / [Part("te", units="mm") / pl] a.to_ifc(test_folder / "error_plate2.ifc")
def test_poly_extrude(self): 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_folder / "penetrations_poly.ifc")
def test_ex1(self): origin = [362237.0037951513, 100000.0, 560985.9095763591] csys = [ [0.0, -1.0, 0.0], [-0.4626617625735456, 0.0, 0.8865348799975894], [-0.8865348799975894, 0.0, -0.4626617625735456], ] local_points2d = [ [4.363213751783499e-11, 229.80445306040926], [1.4557793281525672e-11, -57.217605078163196], [2.912511939794014e-11, -207.22885580839431], [-330.0, -207.25, -4.518217213237464e-11], [-400.0, -122.2, 50.0], [-400.0, 42.79, 50.0], [-325.0, 267.83, 50.0], [-85.00004587126028, 650.0198678083951, 24.999999999931404], [-35.0, 650.02, -7.881391015070461e-12], [-35.0, 350.1], [-15.14, 261.52], ] thick = 30 pl = Plate("test", local_points2d, thick, origin=origin, normal=csys[2], xdir=csys[0], units="mm") a = Assembly() / [Part("te") / pl] a.to_ifc(test_folder / "error_plate.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 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 test_export_basic(ifc_test_dir): bm = Beam( "MyBeam", (0, 0, 0), (2, 0, 0), Section("MySec", from_str="BG300x200x10x20"), metadata=dict(hidden=True), ) 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") user = User(user_id="krande", org_id="ADA", org_name="Assembly Test") pl1 = Plate( "pl1", [(0, 0, 0), (0, 0, 2), (0, 2, 2), (0, 2.0, 0.0)], 0.01, use3dnodes=True, ) a = Assembly("MyFirstIfcFile", user=user) / ( Part("MyBldg", metadata=dict(ifctype="building")) / [bm, bm1, bm2, bm3, bm4, bm5, pl1] ) a.to_ifc(ifc_test_dir / "my_test.ifc", return_file_obj=True)
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_mix_extrude(self): bm = Beam("MyBeam", (0, 0, 0), (1.5, 0, 0), Section("myIPE", from_str="IPE400")) a = Assembly("Test", creator="Kristoffer H. Andersen") / [Part("MyPart") / bm] h = 0.2 r = 0.02 # Polygon Extrusions origin = np.array([0.1, 0.1, -0.1]) normal = np.array([0, -1, 0]) xdir = np.array([1, 0, 0]) points = [(0, 0), (0.05, 0.1), (0.1, 0)] bm.add_penetration(PrimExtrude("my_pen", points, h, normal, origin, xdir)) origin = np.array([0.3, 0.1, -0.1]) points = [(0, 0, r), (0.1, 0, r), (0.05, 0.1, r)] bm.add_penetration(PrimExtrude("my_pen3", points, h, normal, origin, xdir)) origin = np.array([0.5, 0.1, -0.1]) points = [(0, 0, r), (0.1, 0, r), (0.1, 0.2, r), (0.0, 0.2, r)] bm.add_penetration(PrimExtrude("my_pen4", points, h, normal, origin, xdir)) # Cylinder Extrude x = 0.8 bm.add_penetration(PrimCyl("my_pen5", (x, -0.1, 0), (x, 0.1, 0), 0.1)) # Box Extrude x = 1.0 bm.add_penetration(PrimBox("my_pen6", (x, -0.1, -0.1), (x + 0.2, 0.1, 0.1))) a.to_ifc(test_folder / "penetrations_mix.ifc")
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")
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")
def test_export_layers(self): 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, origin=(0, -bm.section.w_btn / 2 + bm.section.t_w, -webh / 2), normal=(0, -1, 0), xdir=(1, 0, 0), ) pl2 = Plate( "Web2", [(0, 0), (2, 0), (2, webh), (0, webh)], bm.section.t_w, origin=(0, bm.section.w_btn / 2, -webh / 2), normal=(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, origin=(0, -bm.section.w_btn / 2, -bm.section.h / 2), normal=(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, origin=(0, -bm.section.w_btn / 2, bm.section.h / 2 - bm.section.t_fbtn), normal=(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" a.to_ifc(test_folder / ifc_name) b = Assembly("MyImportedLayers") b.read_ifc(test_folder / ifc_name)
def test_sweep_shape(self): sweep_curve = [(0, 0, 0), (5, 5.0, 0.0, 1), (10, 0, 0)] ot = [(-0.1, -0.1), (0.1, -0.1), (0.1, 0.1), (-0.1, 0.1)] shape = PrimSweep("MyShape", sweep_curve, (0, 1, 0), (1, 0, 0), ot) a = Assembly("SweptShapes", units="m") / [ Part("MyPart") / [shape, PrimBox("VolBox", p1, p2)] ] a.to_ifc(test_folder / "my_swept_shape_m.ifc")
def test_export_primrevolve(self): a = Assembly("Site") / SimpleStru("SimpleStru") points = [(0, 0), (1, 0), (0.5, 1)] origin = (2, 2, 3) xdir = (0, 0, 1) normal = (1, 0, 0) rev_angle = 275 a.add_shape( PrimRevolve("VolRevolve", points, origin, xdir, normal, rev_angle)) a.to_ifc(test_folder / "world_shape_revolve.ifc")
def test_export_basic(self): bm = Beam( "MyBeam", (0, 0, 0), (2, 0, 0), Section("MySec", from_str="BG300x200x10x20"), metadata=dict(hidden=True), ) a = Assembly("MyFirstIfcFile") / (Part("MyBldg", metadata=dict(ifctype="building")) / bm) a.to_ifc(test_folder / "MyTest.ifc")
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
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_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)
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)
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_()
def test_export_basic(self): bm = Beam( "MyBeam", (0, 0, 0), (2, 0, 0), Section("MySec", from_str="BG300x200x10x20"), metadata=dict(hidden=True), ) user = User(user_id="krande", org_id="ADA", org_name="Assembly Test") a = Assembly("MyFirstIfcFile", user=user) / ( Part("MyBldg", metadata=dict(ifctype="building")) / bm) a.to_ifc(test_folder / "MyTest.ifc")
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 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)
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_plate_mesh(self): import gmsh try: gmsh.finalize() except BaseException as e: logging.error(e) pass gmsh.initialize() gmsh.option.setNumber("General.Terminal", 1) gmsh.option.setNumber("Mesh.SecondOrderIncomplete", 1) gmsh.option.setNumber("Mesh.Algorithm", 8) gmsh.option.setNumber("Mesh.ElementOrder", 1) pl1 = Plate("MyPl", [(0, 0, 0.2), (5, 0, 0.2), (5, 5), (0, 5)], 20e-3, **atts) pl2 = Plate("MyPl2", [(0, 0, 0.2), (5, 0, 0.2), (5, 5), (0, 5)], 20e-3, **atts2) points = [(1, 1, 0.2), (2, 1, 0.2), (2, 2, 0.2), (1, 2, 0.2)] pl1.add_penetration( PrimExtrude("poly_extrude", points, **align_to_plate(pl1))) pl1.add_penetration( PrimExtrude("poly_extrude2", points, **align_to_plate(pl2))) gmsh.model.add("Test") p = Part("MyFem") / [pl1, pl2] create_plate_mesh(pl1, "shell", fem=p.fem, interactive=False, gmsh_session=gmsh) create_plate_mesh(pl2, "shell", fem=p.fem, interactive=False, gmsh_session=gmsh) a = Assembly("Test") / p a.to_ifc(test_folder / "ADA_pl_mesh_ifc") step = a.fem.add_step(Step("gravity", "static", nl_geom=True)) step.add_load(Load("grav", "gravity", -9.81)) a.to_fem("ADA_pl_mesh", "abaqus", scratch_dir=test_folder, overwrite=True)
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_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_()
def test_mix_extrude(): bm = Beam("MyBeam", (0, 0, 0), (1.5, 0, 0), Section("myIPE", from_str="IPE400")) a = Assembly("Test", user=User("krande")) / [Part("MyPart") / bm] h = 0.2 r = 0.02 # Polygon Extrusions origin = np.array([0.1, 0.1, -0.1]) normal = np.array([0, -1, 0]) xdir = np.array([1, 0, 0]) points = [(0, 0), (0.05, 0.1), (0.1, 0)] bm.add_penetration(PrimExtrude("my_pen", points, h, normal, origin, xdir)) origin = np.array([0.3, 0.1, -0.1]) points = [(0, 0, r), (0.1, 0, r), (0.05, 0.1, r)] bm.add_penetration(PrimExtrude("my_pen3", points, h, normal, origin, xdir)) origin = np.array([0.5, 0.1, -0.1]) points = [(0, 0, r), (0.1, 0, r), (0.1, 0.2, r), (0.0, 0.2, r)] bm.add_penetration(PrimExtrude("my_pen4", points, h, normal, origin, xdir)) # Cylinder Extrude x = 0.8 bm.add_penetration(PrimCyl("my_pen5", (x, -0.1, 0), (x, 0.1, 0), 0.1)) # Box Extrude x = 1.0 bm.add_penetration(PrimBox("my_pen6", (x, -0.1, -0.1), (x + 0.2, 0.1, 0.1))) _ = a.to_ifc(test_dir / "penetrations_mix.ifc", return_file_obj=True)
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_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")