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
@@ -16,15 +16,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import numpy
import pytest
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.structural
class TestAddStructuralAnalysisModel(test.bootstrap.IFC4):
def test_adding_a_structural_analysis_model(self):
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
subject = ifcopenshell.api.structural.add_structural_analysis_model(self.file)
models = self.file.by_type("IfcStructuralAnalysisModel")
assert subject == models[0]
assert subject.is_a("IfcStructuralAnalysisModel")
@@ -16,20 +16,18 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import numpy
import pytest
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.api.structural
class TestAssignStructuralAnalysisModel(test.bootstrap.IFC4):
def test_assigning_a_structural_analysis_model(self):
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
product = ifcopenshell.api.run(
"root.create_entity", self.file, ifc_class="IfcStructuralMember", predefined_type=None, name=None
subject = ifcopenshell.api.structural.add_structural_analysis_model(self.file)
product = ifcopenshell.api.root.create_entity(
self.file, ifc_class="IfcStructuralMember", predefined_type=None, name=None
)
rel = ifcopenshell.api.run(
"structural.assign_structural_analysis_model",
rel = ifcopenshell.api.structural.assign_structural_analysis_model(
self.file,
product=product,
structural_analysis_model=subject,
@@ -16,17 +16,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import numpy
import pytest
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.structural
class TestEditStructuralAnalysisModel(test.bootstrap.IFC4):
def test_editing_a_structural_analysis_model(self):
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
subject = ifcopenshell.api.run(
"structural.edit_structural_analysis_model",
subject = ifcopenshell.api.structural.add_structural_analysis_model(self.file)
subject = ifcopenshell.api.structural.edit_structural_analysis_model(
self.file,
structural_analysis_model=subject,
attributes={"Name": "My edited model", "Description": "Description of my model"},
@@ -16,17 +16,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import numpy
import pytest
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.structural
class TestRemoveStructuralAnalysisModel(test.bootstrap.IFC4):
def test_removing_a_structural_analysis_model(self):
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
ifcopenshell.api.run(
"structural.remove_structural_analysis_model",
subject = ifcopenshell.api.structural.add_structural_analysis_model(self.file)
ifcopenshell.api.structural.remove_structural_analysis_model(
self.file,
structural_analysis_model=subject,
)
@@ -16,26 +16,23 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import numpy
import pytest
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.api.structural
class TestUnassignStructuralAnalysisModel(test.bootstrap.IFC4):
def test_unassigning_a_structural_analysis_model(self):
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
product = ifcopenshell.api.run(
"root.create_entity", self.file, ifc_class="IfcStructuralMember", predefined_type=None, name=None
subject = ifcopenshell.api.structural.add_structural_analysis_model(self.file)
product = ifcopenshell.api.root.create_entity(
self.file, ifc_class="IfcStructuralMember", predefined_type=None, name=None
)
rel = ifcopenshell.api.run(
"structural.assign_structural_analysis_model",
ifcopenshell.api.structural.assign_structural_analysis_model(
self.file,
product=product,
structural_analysis_model=subject,
)
ifcopenshell.api.run(
"structural.unassign_structural_analysis_model",
ifcopenshell.api.structural.unassign_structural_analysis_model(
self.file,
product=product,
structural_analysis_model=subject,