(self, version)
| 102 | return [coordinates[0], -coordinates[2], coordinates[1]] |
| 103 | |
| 104 | def create_ifc_file(self, version): |
| 105 | self.file = ifcopenshell.api.project.create_file(version=version) |
| 106 | person = ifcopenshell.api.owner.add_person(self.file) |
| 107 | person[0] = person.GivenName = None |
| 108 | person.FamilyName = "user" |
| 109 | org = ifcopenshell.api.owner.add_organisation(self.file) |
| 110 | org[0] = None |
| 111 | org.Name = "template" |
| 112 | user = ifcopenshell.api.owner.add_person_and_organisation(self.file, person=person, organisation=org) |
| 113 | application = ifcopenshell.api.owner.add_application(self.file) |
| 114 | ifcopenshell.api.owner.settings.get_user = lambda ifc: user |
| 115 | ifcopenshell.api.owner.settings.get_application = lambda ifc: application |
| 116 | |
| 117 | project = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject", name=self.basename) |
| 118 | lengthunit = ifcopenshell.api.unit.add_si_unit(self.file, unit_type="LENGTHUNIT") |
| 119 | ifcopenshell.api.unit.assign_unit(self.file, units=[lengthunit]) |
| 120 | model = ifcopenshell.api.context.add_context(self.file, context_type="Model") |
| 121 | self.context = ifcopenshell.api.context.add_context( |
| 122 | self.file, |
| 123 | context_type="Model", |
| 124 | context_identifier="Body", |
| 125 | target_view="MODEL_VIEW", |
| 126 | parent=model, |
| 127 | ) |
| 128 | site = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcSite", name="My Site") |
| 129 | building = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcBuilding", name="My Building") |
| 130 | self.storey = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcBuildingStorey", name="My Storey") |
| 131 | ifcopenshell.api.aggregate.assign_object(self.file, products=[site], relating_object=project) |
| 132 | ifcopenshell.api.aggregate.assign_object(self.file, products=[building], relating_object=site) |
| 133 | ifcopenshell.api.aggregate.assign_object(self.file, products=[self.storey], relating_object=building) |
| 134 | |
| 135 | ifcopenshell.api.geometry.edit_object_placement(self.file, product=site) |
| 136 | ifcopenshell.api.geometry.edit_object_placement(self.file, product=building) |
| 137 | ifcopenshell.api.geometry.edit_object_placement(self.file, product=self.storey) |
| 138 | |
| 139 | self.origin = self.file.createIfcAxis2Placement3D( |
| 140 | self.file.createIfcCartesianPoint((0.0, 0.0, 0.0)), |
| 141 | self.file.createIfcDirection((0.0, 0.0, 1.0)), |
| 142 | self.file.createIfcDirection((1.0, 0.0, 0.0)), |
| 143 | ) |
| 144 | self.placement = self.file.createIfcLocalPlacement(self.storey.ObjectPlacement, self.origin) |
| 145 | self.history = ifcopenshell.api.owner.create_owner_history(self.file) |
| 146 | |
| 147 | |
| 148 | if __name__ == "__main__": |
no test coverage detected