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

Method create_comm

src/ifc2ca/scriptCodeAster.py:152–408  ·  view source on GitHub ↗
(self, path, cases)

Source from the content-addressed store, hash-verified

150 conn["stiffnesses"] = tuple(stiffnesses)
151
152 def create_comm(self, path, cases):
153 self.comm_path = Path(path)
154 self.cases = cases
155
156 data = self.data
157
158 elements = data["elements"]
159 connections = data["connections"]
160 # --> Delete this reference data and repopulate it with the objects
161 # while going through elements
162 for conn in connections:
163 conn["related_elements"] = []
164 self.calculateRestraints(conn)
165 for el in elements:
166 for rel in el["connections"]:
167 conn = next(c for c in connections if c["ref_id"] == rel["related_connection"])
168 rel["conn_string"] = None
169 if conn["geometry_type"] == "Vertex":
170 rel["conn_string"] = "_0DC_"
171 rel["springGroupName"] = (
172 self.getGroupName(rel["relating_element"])
173 + "_1DS_"
174 + self.getGroupName(rel["related_connection"])
175 )
176 if conn["geometry_type"] == "Edge":
177 rel["conn_string"] = "_1DC_"
178 rel["springGroupName"] = None
179 if conn["geometry_type"] == "Face":
180 rel["conn_string"] = "_2DC_"
181 rel["springGroupName"] = None
182
183 rel["groupName1"] = (
184 self.getGroupName(rel["relating_element"])
185 + rel["conn_string"]
186 + self.getGroupName(rel["related_connection"])
187 )
188 if rel["eccentricity"]:
189 rel["groupName2"] = (
190 self.getGroupName(rel["related_connection"])
191 + "_0DC_"
192 + self.getGroupName(rel["relating_element"])
193 )
194 rel["index"] = len(conn["related_elements"]) + 1
195 rel["unifiedGroupName"] = self.getGroupName(rel["related_connection"]) + "_0DC_%g" % rel["index"]
196 else:
197 rel["groupName2"] = self.getGroupName(rel["related_connection"])
198 self.calculateConstraints(rel)
199 conn["related_elements"].append(rel)
200 # End <--
201
202 materials = data["db"]["materials"]
203 for _, material in materials.items():
204 material["groupNames"] = tuple([self.getGroupName(rel) for rel in material["related_elements"]])
205
206 profiles = data["db"]["profiles"]
207 for _, profile in profiles.items():
208 profile["groupNames"] = tuple([self.getGroupName(rel) for rel in profile["related_elements"]])
209

Callers 1

run_code_asterMethod · 0.95

Calls 11

calculateRestraintsMethod · 0.95
getGroupNameMethod · 0.95
calculateConstraintsMethod · 0.95
flattenFunction · 0.85
openMethod · 0.80
rangeFunction · 0.50
appendMethod · 0.45
itemsMethod · 0.45
insertMethod · 0.45
extendMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected