mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
refactor structural module - wip - structural analysis models #1848
This commit is contained in:
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import numpy
|
||||
import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
class TestAddStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||
def test_adding_a_structural_analysis_model(self):
|
||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
||||
models = self.file.by_type("IfcStructuralAnalysisModel")
|
||||
assert subject == models[0]
|
||||
assert subject.is_a("IfcStructuralAnalysisModel")
|
||||
@@ -0,0 +1,24 @@
|
||||
import numpy
|
||||
import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
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
|
||||
)
|
||||
rel = ifcopenshell.api.run(
|
||||
"structural.assign_structural_analysis_model",
|
||||
self.file,
|
||||
product=product,
|
||||
structural_analysis_model=subject,
|
||||
)
|
||||
assert rel.is_a("IfcRelAssignsToGroup")
|
||||
assert rel.RelatingGroup == subject
|
||||
assert product in rel.RelatedObjects
|
||||
@@ -0,0 +1,20 @@
|
||||
import numpy
|
||||
import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
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",
|
||||
self.file,
|
||||
structural_analysis_model=subject,
|
||||
attributes={
|
||||
"Name": "My edited model",
|
||||
"Description": "Description of my model"
|
||||
}
|
||||
)
|
||||
models = self.file.by_type("IfcStructuralAnalysisModel")
|
||||
assert subject == models[0]
|
||||
assert subject.is_a("IfcStructuralAnalysisModel")
|
||||
@@ -0,0 +1,16 @@
|
||||
import numpy
|
||||
import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
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",
|
||||
self.file,
|
||||
structural_analysis_model=subject,
|
||||
|
||||
)
|
||||
models = self.file.by_type("IfcStructuralAnalysisModel")
|
||||
assert len(models) == 0
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
import numpy
|
||||
import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
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
|
||||
)
|
||||
rel = ifcopenshell.api.run(
|
||||
"structural.assign_structural_analysis_model",
|
||||
self.file,
|
||||
product=product,
|
||||
structural_analysis_model=subject,
|
||||
)
|
||||
ifcopenshell.api.run(
|
||||
"structural.unassign_structural_analysis_model",
|
||||
self.file,
|
||||
product=product,
|
||||
structural_analysis_model=subject,
|
||||
)
|
||||
models = self.file.by_type("IfcStructuralAnalysisModel")
|
||||
rels = self.file.by_type("IfcRelAssignsToGroup")
|
||||
assert len(models[0].IsGroupedBy) == 0
|
||||
assert len(rels) == 0
|
||||
Reference in New Issue
Block a user