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

Method get_load_cases

src/ifc2ca/ifc2ca.py:184–214  ·  view source on GitHub ↗
(self, model: ios.entity_instance | None = None, load_group: ios.entity_instance | None = None)

Source from the content-addressed store, hash-verified

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):
185 if model is not None:
186 load_case_set = set(self.get_analysis_load_cases(model))
187 for comb in self.get_load_combinations(model):
188 load_cases = set(
189 [
190 item
191 for item in ifcopenshell.util.element.get_grouped_by(comb)
192 if (item.is_a("IfcStructuralLoadCase") and item.PredefinedType == "LOAD_CASE")
193 ]
194 )
195 load_case_set = load_case_set.union(load_cases)
196 load_cases = list(load_case_set)
197 load_cases.sort(key=lambda x: x.id())
198
199 return load_cases
200
201 if load_group is not None:
202 if load_group.HasAssignments is None:
203 return []
204 load_cases = [
205 item.RelatingGroup
206 for item in load_group.HasAssignments
207 if (
208 item.RelatingGroup.is_a("IfcStructuralLoadCase")
209 and item.RelatingGroup.PredefinedType == "LOAD_CASE"
210 )
211 ]
212 return load_cases
213
214 return [item for item in self.file.by_type("IfcStructuralLoadCase") if item.PredefinedType == "LOAD_CASE"]
215
216 def get_load_combinations(self, model: ios.entity_instance | None = None):
217 if model is not None:

Callers 3

get_load_groupsMethod · 0.95
add_action_loadsMethod · 0.95
parse_modelMethod · 0.95

Calls 8

get_load_combinationsMethod · 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