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_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_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)