Minor structural code review

This commit is contained in:
Dion Moult
2021-05-06 18:24:13 +10:00
parent 8a3e023408
commit 992474fbf2
7 changed files with 70 additions and 63 deletions
@@ -1,5 +1,6 @@
import ifcopenshell.api
class Usecase:
def __init__(self, file, **settings):
self.file = file
@@ -18,8 +19,8 @@ class Usecase:
self.file,
ifc_class="IfcStructuralLoadCase",
predefined_type=self.settings["predefined_type"],
action_type=self.settings["action_type"],
action_source=self.settings["action_source"],
name=self.settings["name"],
)
load_case.ActionType = self.settings["action_type"]
load_case.ActionSource = self.settings["action_source"]
return load_case
@@ -101,9 +101,9 @@ class Data:
def load_structural_load_case_combinations(cls):
cls.load_case_combinations = {}
for case in cls._file.by_type("IfcStructuralLoadGroup"):
for case in cls._file.by_type("IfcStructuralLoadGroup", include_subtypes=False):
if case.PredefinedType != "LOAD_COMBINATION":
return
continue
data = case.get_info()
del data["OwnerHistory"]
@@ -118,9 +118,9 @@ class Data:
def load_structural_load_groups(cls):
cls.load_groups = {}
for case in cls._file.by_type("IfcStructuralLoadGroup"):
if case.PredefinedType != "LOAD_COMBINATION":
return
for case in cls._file.by_type("IfcStructuralLoadGroup", include_subtypes=False):
if case.PredefinedType == "LOAD_COMBINATION":
continue
# if case.IsGroupedBy:
# for rel in case.IsGroupedBy:
# for product in rel.RelatedObjects:
@@ -213,4 +213,4 @@ class Data:
cls.load_connects_structural_activity(activity)
member_data["ConnectsStructuralActivities"].append(activity.id())
cls.members[member.id()] = member_data
cls.members[member.id()] = member_data