MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / get_load_groups

Method get_load_groups

src/ifc2ca/ifc2ca.py:156–181  ·  view source on GitHub ↗
(self, load_case: ios.entity_instance | None = None, model: ios.entity_instance | None = None)

Source from the content-addressed store, hash-verified

154 return [item for item in self.file.by_type("IfcStructuralReaction")]
155
156 def get_load_groups(self, load_case: ios.entity_instance | None = None, model: ios.entity_instance | None = None):
157 if load_case is not None:
158 load_groups = [
159 item
160 for item in ifcopenshell.util.element.get_grouped_by(load_case)
161 if (item.is_a("IfcStructuralLoadGroup") and item.PredefinedType == "LOAD_GROUP")
162 ]
163 return load_groups
164
165 if model is not None:
166 load_group_set = set()
167 for load_case in self.get_load_cases(model):
168 load_groups = set(
169 [
170 item
171 for item in ifcopenshell.util.element.get_grouped_by(load_case)
172 if (item.is_a("IfcStructuralLoadGroup") and item.PredefinedType == "LOAD_GROUP")
173 ]
174 )
175 load_group_set = load_group_set.union(load_groups)
176 load_groups = list(load_group_set)
177 load_groups.sort(key=lambda x: x.id())
178
179 return load_groups
180
181 return [item for item in self.file.by_type("IfcStructuralLoadGroup") if item.PredefinedType == "LOAD_GROUP"]
182
183 ## functions related to load cases and load combinations
184 def get_load_cases(self, model: ios.entity_instance | None = None, load_group: ios.entity_instance | None = None):

Callers 1

parse_modelMethod · 0.95

Calls 7

get_load_casesMethod · 0.95
unionMethod · 0.80
sortMethod · 0.80
setFunction · 0.50
is_aMethod · 0.45
idMethod · 0.45
by_typeMethod · 0.45

Tested by

no test coverage detected