Replace all ifcopenshell.api.run with ifcopenshell.api static functions.

This commit is contained in:
Dion Moult
2024-06-28 12:36:31 +10:00
parent b5d613989e
commit 07060fc769
432 changed files with 4633 additions and 4856 deletions
@@ -17,30 +17,31 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.void
import ifcopenshell.api.root
class TestAddFilling(test.bootstrap.IFC4):
def test_adding_a_filling(self):
opening = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcOpeningElement")
door = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcDoor")
ifcopenshell.api.run("void.add_filling", self.file, opening=opening, element=door)
opening = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcOpeningElement")
door = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcDoor")
ifcopenshell.api.void.add_filling(self.file, opening=opening, element=door)
assert door.FillsVoids[0].RelatingOpeningElement == opening
def test_adding_a_filling_twice(self):
opening = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcOpeningElement")
door = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcDoor")
ifcopenshell.api.run("void.add_filling", self.file, opening=opening, element=door)
ifcopenshell.api.run("void.add_filling", self.file, opening=opening, element=door)
opening = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcOpeningElement")
door = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcDoor")
ifcopenshell.api.void.add_filling(self.file, opening=opening, element=door)
ifcopenshell.api.void.add_filling(self.file, opening=opening, element=door)
assert door.FillsVoids[0].RelatingOpeningElement == opening
assert len(opening.HasFillings) == 1
def test_adding_a_filling_which_is_already_filling_another_opening(self):
door = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcDoor")
opening1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcOpeningElement")
opening2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcOpeningElement")
ifcopenshell.api.run("void.add_filling", self.file, opening=opening1, element=door)
ifcopenshell.api.run("void.add_filling", self.file, opening=opening2, element=door)
door = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcDoor")
opening1 = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcOpeningElement")
opening2 = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcOpeningElement")
ifcopenshell.api.void.add_filling(self.file, opening=opening1, element=door)
ifcopenshell.api.void.add_filling(self.file, opening=opening2, element=door)
assert not opening1.HasFillings
assert opening2.HasFillings[0].RelatedBuildingElement == door