topologicpy 0.4.8__py3-none-any.whl → 0.4.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. topologicpy/Aperture.py +46 -0
  2. topologicpy/Cell.py +1780 -0
  3. topologicpy/CellComplex.py +791 -0
  4. topologicpy/Cluster.py +591 -0
  5. topologicpy/Color.py +157 -0
  6. topologicpy/Context.py +56 -0
  7. topologicpy/DGL.py +2661 -0
  8. topologicpy/Dictionary.py +470 -0
  9. topologicpy/Edge.py +855 -0
  10. topologicpy/EnergyModel.py +1052 -0
  11. topologicpy/Face.py +1810 -0
  12. topologicpy/Graph.py +3526 -0
  13. topologicpy/Graph_Export.py +858 -0
  14. topologicpy/Grid.py +338 -0
  15. topologicpy/Helper.py +182 -0
  16. topologicpy/Honeybee.py +424 -0
  17. topologicpy/Matrix.py +255 -0
  18. topologicpy/Neo4jGraph.py +311 -0
  19. topologicpy/Plotly.py +1396 -0
  20. topologicpy/Polyskel.py +524 -0
  21. topologicpy/Process.py +1368 -0
  22. topologicpy/SQL.py +48 -0
  23. topologicpy/Shell.py +1418 -0
  24. topologicpy/Speckle.py +433 -0
  25. topologicpy/Topology.py +5854 -0
  26. topologicpy/UnitTest.py +29 -0
  27. topologicpy/Vector.py +555 -0
  28. topologicpy/Vertex.py +714 -0
  29. topologicpy/Wire.py +2346 -0
  30. topologicpy/__init__.py +20 -0
  31. topologicpy/bin/linux/topologic/__init__.py +2 -0
  32. topologicpy/bin/linux/topologic/topologic.cpython-310-x86_64-linux-gnu.so +0 -0
  33. topologicpy/bin/linux/topologic/topologic.cpython-311-x86_64-linux-gnu.so +0 -0
  34. topologicpy/bin/linux/topologic/topologic.cpython-38-x86_64-linux-gnu.so +0 -0
  35. topologicpy/bin/linux/topologic/topologic.cpython-39-x86_64-linux-gnu.so +0 -0
  36. topologicpy/bin/linux/topologic.libs/libTKBO-6bdf205d.so.7.7.0 +0 -0
  37. topologicpy/bin/linux/topologic.libs/libTKBRep-2960a069.so.7.7.0 +0 -0
  38. topologicpy/bin/linux/topologic.libs/libTKBool-c44b74bd.so.7.7.0 +0 -0
  39. topologicpy/bin/linux/topologic.libs/libTKFillet-9a670ba0.so.7.7.0 +0 -0
  40. topologicpy/bin/linux/topologic.libs/libTKG2d-8f31849e.so.7.7.0 +0 -0
  41. topologicpy/bin/linux/topologic.libs/libTKG3d-4c6bce57.so.7.7.0 +0 -0
  42. topologicpy/bin/linux/topologic.libs/libTKGeomAlgo-26066fd9.so.7.7.0 +0 -0
  43. topologicpy/bin/linux/topologic.libs/libTKGeomBase-2116cabe.so.7.7.0 +0 -0
  44. topologicpy/bin/linux/topologic.libs/libTKMath-72572fa8.so.7.7.0 +0 -0
  45. topologicpy/bin/linux/topologic.libs/libTKMesh-2a060427.so.7.7.0 +0 -0
  46. topologicpy/bin/linux/topologic.libs/libTKOffset-6cab68ff.so.7.7.0 +0 -0
  47. topologicpy/bin/linux/topologic.libs/libTKPrim-eb1262b3.so.7.7.0 +0 -0
  48. topologicpy/bin/linux/topologic.libs/libTKShHealing-e67e5cc7.so.7.7.0 +0 -0
  49. topologicpy/bin/linux/topologic.libs/libTKTopAlgo-e4c96c33.so.7.7.0 +0 -0
  50. topologicpy/bin/linux/topologic.libs/libTKernel-fb7fe3b7.so.7.7.0 +0 -0
  51. topologicpy/bin/linux/topologic.libs/libgcc_s-32c1665e.so.1 +0 -0
  52. topologicpy/bin/linux/topologic.libs/libstdc++-672d7b41.so.6.0.30 +0 -0
  53. topologicpy/bin/windows/topologic/TKBO-f6b191de.dll +0 -0
  54. topologicpy/bin/windows/topologic/TKBRep-e56a600e.dll +0 -0
  55. topologicpy/bin/windows/topologic/TKBool-7b8d47ae.dll +0 -0
  56. topologicpy/bin/windows/topologic/TKFillet-0ddbf0a8.dll +0 -0
  57. topologicpy/bin/windows/topologic/TKG2d-2e2dee3d.dll +0 -0
  58. topologicpy/bin/windows/topologic/TKG3d-6674513d.dll +0 -0
  59. topologicpy/bin/windows/topologic/TKGeomAlgo-d240e370.dll +0 -0
  60. topologicpy/bin/windows/topologic/TKGeomBase-df87aba5.dll +0 -0
  61. topologicpy/bin/windows/topologic/TKMath-45bd625a.dll +0 -0
  62. topologicpy/bin/windows/topologic/TKMesh-d6e826b1.dll +0 -0
  63. topologicpy/bin/windows/topologic/TKOffset-79b9cc94.dll +0 -0
  64. topologicpy/bin/windows/topologic/TKPrim-aa430a86.dll +0 -0
  65. topologicpy/bin/windows/topologic/TKShHealing-bb48be89.dll +0 -0
  66. topologicpy/bin/windows/topologic/TKTopAlgo-7d0d1e22.dll +0 -0
  67. topologicpy/bin/windows/topologic/TKernel-08c8cfbb.dll +0 -0
  68. topologicpy/bin/windows/topologic/__init__.py +2 -0
  69. topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd +0 -0
  70. topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd +0 -0
  71. topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd +0 -0
  72. topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd +0 -0
  73. {topologicpy-0.4.8.dist-info → topologicpy-0.4.9.dist-info}/METADATA +1 -1
  74. topologicpy-0.4.9.dist-info/RECORD +77 -0
  75. topologicpy-0.4.9.dist-info/top_level.txt +1 -0
  76. topologicpy-0.4.8.dist-info/RECORD +0 -5
  77. topologicpy-0.4.8.dist-info/top_level.txt +0 -1
  78. {topologicpy-0.4.8.dist-info → topologicpy-0.4.9.dist-info}/LICENSE +0 -0
  79. {topologicpy-0.4.8.dist-info → topologicpy-0.4.9.dist-info}/WHEEL +0 -0
topologicpy/Process.py ADDED
@@ -0,0 +1,1368 @@
1
+ import topologic
2
+
3
+ def internalVertex(topology, tolerance):
4
+ vst = None
5
+ classType = topology.Type()
6
+ if classType == 64: #CellComplex
7
+ tempCells = []
8
+ _ = topology.Cells(None,tempCells)
9
+ tempCell = tempCells.front()
10
+ vst = topologic.CellUtility.InternalVertex(tempCell, tolerance)
11
+ elif classType == 32: #Cell
12
+ vst = topologic.CellUtility.InternalVertex(topology, tolerance)
13
+ elif classType == 16: #Shell
14
+ tempFaces = []
15
+ _ = topology.Faces(None, tempFaces)
16
+ tempFace = tempFaces.front()
17
+ vst = topologic.FaceUtility.InternalVertex(tempFace, tolerance)
18
+ elif classType == 8: #Face
19
+ vst = topologic.FaceUtility.InternalVertex(topology, tolerance)
20
+ elif classType == 4: #Wire
21
+ if topology.IsClosed():
22
+ internalBoundaries = []
23
+ tempFace = topologic.Face.ByExternalInternalBoundaries(topology, internalBoundaries)
24
+ vst = topologic.FaceUtility.InternalVertex(tempFace, tolerance)
25
+ else:
26
+ tempEdges = []
27
+ _ = topology.Edges(None, tempEdges)
28
+ vst = topologic.EdgeUtility.PointAtParameter(tempVertex.front(), 0.5)
29
+ elif classType == 2: #Edge
30
+ vst = topologic.EdgeUtility.PointAtParameter(topology, 0.5)
31
+ elif classType == 1: #Vertex
32
+ vst = topology
33
+ else:
34
+ vst = topology.CenterOfMass()
35
+ return vst
36
+
37
+ def listAttributeValues(listAttribute):
38
+ listAttributes = listAttribute.ListValue()
39
+ returnList = []
40
+ for attr in listAttributes:
41
+ if isinstance(attr, topologic.IntAttribute):
42
+ returnList.append(attr.IntValue())
43
+ elif isinstance(attr, topologic.DoubleAttribute):
44
+ returnList.append(attr.DoubleValue())
45
+ elif isinstance(attr, topologic.StringAttribute):
46
+ returnList.append(attr.StringValue())
47
+ return returnList
48
+
49
+ def getValues(item):
50
+ keys = item.Keys()
51
+ returnList = []
52
+ for key in keys:
53
+ try:
54
+ attr = item.ValueAtKey(key)
55
+ except:
56
+ raise Exception("Dictionary.Values - Error: Could not retrieve a Value at the specified key ("+key+")")
57
+ if isinstance(attr, topologic.IntAttribute):
58
+ returnList.append(attr.IntValue())
59
+ elif isinstance(attr, topologic.DoubleAttribute):
60
+ returnList.append(attr.DoubleValue())
61
+ elif isinstance(attr, topologic.StringAttribute):
62
+ returnList.append(attr.StringValue())
63
+ elif isinstance(attr, topologic.ListAttribute):
64
+ returnList.append(listAttributeValues(attr))
65
+ else:
66
+ returnList.append("")
67
+ return returnList
68
+
69
+ def getKeys(item):
70
+ stlKeys = item.Keys()
71
+ returnList = []
72
+ copyKeys = stlKeys.__class__(stlKeys) #wlav suggested workaround. Make a copy first
73
+ for x in copyKeys:
74
+ k = x.c_str()
75
+ returnList.append(k)
76
+ return returnList
77
+
78
+ def getValueAtKey(item, key):
79
+ try:
80
+ attr = item.ValueAtKey(key)
81
+ except:
82
+ raise Exception("Dictionary.ValueAtKey - Error: Could not retrieve a Value at the specified key ("+key+")")
83
+ if isinstance(attr, topologic.IntAttribute):
84
+ return (attr.IntValue())
85
+ elif isinstance(attr, topologic.DoubleAttribute):
86
+ return (attr.DoubleValue())
87
+ elif isinstance(attr, topologic.StringAttribute):
88
+ return (attr.StringValue())
89
+ elif isinstance(attr, topologic.ListAttribute):
90
+ return (listAttributeValues(attr))
91
+ else:
92
+ return None
93
+
94
+ def processKeysValues(keys, values):
95
+ if len(keys) != len(values):
96
+ raise Exception("DictionaryByKeysValues - Keys and Values do not have the same length")
97
+ stl_keys = []
98
+ stl_values = []
99
+ for i in range(len(keys)):
100
+ if isinstance(keys[i], str):
101
+ stl_keys.append(keys[i])
102
+ else:
103
+ stl_keys.append(str(keys[i]))
104
+ if isinstance(values[i], list) and len(values[i]) == 1:
105
+ value = values[i][0]
106
+ else:
107
+ value = values[i]
108
+ if isinstance(value, bool):
109
+ if value == False:
110
+ stl_values.append(topologic.IntAttribute(0))
111
+ else:
112
+ stl_values.append(topologic.IntAttribute(1))
113
+ elif isinstance(value, int):
114
+ stl_values.append(topologic.IntAttribute(value))
115
+ elif isinstance(value, float):
116
+ stl_values.append(topologic.DoubleAttribute(value))
117
+ elif isinstance(value, str):
118
+ stl_values.append(topologic.StringAttribute(value))
119
+ elif isinstance(value, list):
120
+ l = []
121
+ for v in value:
122
+ if isinstance(v, bool):
123
+ l.append(topologic.IntAttribute(v))
124
+ elif isinstance(v, int):
125
+ l.append(topologic.IntAttribute(v))
126
+ elif isinstance(v, float):
127
+ l.append(topologic.DoubleAttribute(v))
128
+ elif isinstance(v, str):
129
+ l.append(topologic.StringAttribute(v))
130
+ stl_values.append(topologic.ListAttribute(l))
131
+ else:
132
+ raise Exception("Error: Value type is not supported. Supported types are: Boolean, Integer, Double, String, or List.")
133
+ myDict = topologic.Dictionary.ByKeysValues(stl_keys, stl_values)
134
+ return myDict
135
+
136
+ def mergeDictionaries(sources):
137
+ if isinstance(sources, list) == False:
138
+ sources = [sources]
139
+ sinkKeys = []
140
+ sinkValues = []
141
+ d = sources[0].GetDictionary()
142
+ if d != None:
143
+ stlKeys = d.Keys()
144
+ if len(stlKeys) > 0:
145
+ sinkKeys = d.Keys()
146
+ sinkValues = getValues(d)
147
+ for i in range(1,len(sources)):
148
+ d = sources[i].GetDictionary()
149
+ if d == None:
150
+ continue
151
+ stlKeys = d.Keys()
152
+ if len(stlKeys) > 0:
153
+ sourceKeys = d.Keys()
154
+ for aSourceKey in sourceKeys:
155
+ if aSourceKey not in sinkKeys:
156
+ sinkKeys.append(aSourceKey)
157
+ sinkValues.append("")
158
+ for i in range(len(sourceKeys)):
159
+ index = sinkKeys.index(sourceKeys[i])
160
+ sourceValue = getValueAtKey(d, sourceKeys[i])
161
+ if sourceValue != None:
162
+ if sinkValues[index] != "":
163
+ if isinstance(sinkValues[index], list):
164
+ sinkValues[index].append(sourceValue)
165
+ else:
166
+ sinkValues[index] = [sinkValues[index], sourceValue]
167
+ else:
168
+ sinkValues[index] = sourceValue
169
+ if len(sinkKeys) > 0 and len(sinkValues) > 0:
170
+ return processKeysValues(sinkKeys, sinkValues)
171
+ return None
172
+
173
+ def mergeDictionaries2(sources):
174
+ if isinstance(sources, list) == False:
175
+ sources = [sources]
176
+ sinkKeys = []
177
+ sinkValues = []
178
+ d = sources[0]
179
+ if d != None:
180
+ stlKeys = d.Keys()
181
+ if len(stlKeys) > 0:
182
+ sinkKeys = d.Keys()
183
+ sinkValues = getValues(d)
184
+ for i in range(1,len(sources)):
185
+ d = sources[i]
186
+ if d == None:
187
+ continue
188
+ stlKeys = d.Keys()
189
+ if len(stlKeys) > 0:
190
+ sourceKeys = d.Keys()
191
+ for aSourceKey in sourceKeys:
192
+ if aSourceKey not in sinkKeys:
193
+ sinkKeys.append(aSourceKey)
194
+ sinkValues.append("")
195
+ for i in range(len(sourceKeys)):
196
+ index = sinkKeys.index(sourceKeys[i])
197
+ sourceValue = getValueAtKey(d, sourceKeys[i])
198
+ if sourceValue != None:
199
+ if sinkValues[index] != "":
200
+ if isinstance(sinkValues[index], list):
201
+ sinkValues[index].append(sourceValue)
202
+ else:
203
+ sinkValues[index] = [sinkValues[index], sourceValue]
204
+ else:
205
+ sinkValues[index] = sourceValue
206
+ if len(sinkKeys) > 0 and len(sinkValues) > 0:
207
+ return processKeysValues(sinkKeys, sinkValues)
208
+ return None
209
+
210
+ def processCellComplex(item):
211
+ topology, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, useInternalVertex, storeBRep, tolerance = item
212
+ graph = None
213
+ edges = []
214
+ vertices = []
215
+ cellmat = []
216
+ if direct == True:
217
+ cells = []
218
+ _ = topology.Cells(None, cells)
219
+ # Create a matrix of zeroes
220
+ for i in range(len(cells)):
221
+ cellRow = []
222
+ for j in range(len(cells)):
223
+ cellRow.append(0)
224
+ cellmat.append(cellRow)
225
+ for i in range(len(cells)):
226
+ for j in range(len(cells)):
227
+ if (i != j) and cellmat[i][j] == 0:
228
+ cellmat[i][j] = 1
229
+ cellmat[j][i] = 1
230
+ sharedt = []
231
+ cells[i].SharedTopologies(cells[j], 8, sharedt)
232
+ if len(sharedt) > 0:
233
+ if useInternalVertex == True:
234
+ v1 = topologic.CellUtility.InternalVertex(cells[i], tolerance)
235
+ v2 = topologic.CellUtility.InternalVertex(cells[j], tolerance)
236
+ else:
237
+ v1 = cells[i].CenterOfMass()
238
+ v2 = cells[j].CenterOfMass()
239
+ e = topologic.Edge.ByStartVertexEndVertex(v1, v2)
240
+ mDict = mergeDictionaries(sharedt)
241
+ if mDict:
242
+ e.SetDictionary(mDict)
243
+ edges.append(e)
244
+ if directApertures == True:
245
+ cellmat = []
246
+ cells = []
247
+ _ = topology.Cells(None, cells)
248
+ # Create a matrix of zeroes
249
+ for i in range(len(cells)):
250
+ cellRow = []
251
+ for j in range(len(cells)):
252
+ cellRow.append(0)
253
+ cellmat.append(cellRow)
254
+ for i in range(len(cells)):
255
+ for j in range(len(cells)):
256
+ if (i != j) and cellmat[i][j] == 0:
257
+ cellmat[i][j] = 1
258
+ cellmat[j][i] = 1
259
+ sharedt = []
260
+ cells[i].SharedTopologies(cells[j], 8, sharedt)
261
+ if len(sharedt) > 0:
262
+ apertureExists = False
263
+ for x in sharedt:
264
+ apList = []
265
+ _ = x.Apertures(apList)
266
+ if len(apList) > 0:
267
+ apTopList = []
268
+ for ap in apList:
269
+ apTopList.append(ap.Topology())
270
+ apertureExists = True
271
+ break
272
+ if apertureExists:
273
+ if useInternalVertex == True:
274
+ v1 = topologic.CellUtility.InternalVertex(cells[i], tolerance)
275
+ v2 = topologic.CellUtility.InternalVertex(cells[j], tolerance)
276
+ else:
277
+ v1 = cells[i].CenterOfMass()
278
+ v2 = cells[j].CenterOfMass()
279
+ e = topologic.Edge.ByStartVertexEndVertex(v1, v2)
280
+ mDict = mergeDictionaries(apTopList)
281
+ if mDict:
282
+ e.SetDictionary(mDict)
283
+ edges.append(e)
284
+
285
+ cells = []
286
+ _ = topology.Cells(None, cells)
287
+ if (viaSharedTopologies == True) or (viaSharedApertures == True) or (toExteriorTopologies == True) or (toExteriorApertures == True) or (toContents == True):
288
+ for aCell in cells:
289
+ if useInternalVertex == True:
290
+ vCell = topologic.CellUtility.InternalVertex(aCell, tolerance)
291
+ else:
292
+ vCell = aCell.CenterOfMass()
293
+ d1 = aCell.GetDictionary()
294
+ if storeBRep:
295
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [aCell.String(), aCell.Type(), aCell.GetTypeAsString()])
296
+ d3 = mergeDictionaries2([d1, d2])
297
+ _ = vCell.SetDictionary(d3)
298
+ else:
299
+ _ = vCell.SetDictionary(d1)
300
+ vertices.append(vCell)
301
+ faces = []
302
+ _ = aCell.Faces(None, faces)
303
+ sharedTopologies = []
304
+ exteriorTopologies = []
305
+ sharedApertures = []
306
+ exteriorApertures = []
307
+ contents = []
308
+ _ = aCell.Contents(contents)
309
+ for aFace in faces:
310
+ cells = []
311
+ _ = aFace.Cells(topology, cells)
312
+ if len(cells) > 1:
313
+ sharedTopologies.append(aFace)
314
+ apertures = []
315
+ _ = aFace.Apertures(apertures)
316
+ for anAperture in apertures:
317
+ sharedApertures.append(anAperture)
318
+ else:
319
+ exteriorTopologies.append(aFace)
320
+ apertures = []
321
+ _ = aFace.Apertures(apertures)
322
+ for anAperture in apertures:
323
+ exteriorApertures.append(anAperture)
324
+ if viaSharedTopologies:
325
+ for sharedTopology in sharedTopologies:
326
+ if useInternalVertex == True:
327
+ vst = internalVertex(sharedTopology, tolerance)
328
+ else:
329
+ vst = sharedTopology.CenterOfMass()
330
+ d1 = sharedTopology.GetDictionary()
331
+ if storeBRep:
332
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [sharedTopology.String(), sharedTopology.Type(), sharedTopology.GetTypeAsString()])
333
+ d3 = mergeDictionaries2([d1, d2])
334
+ _ = vst.SetDictionary(d3)
335
+ else:
336
+ _ = vst.SetDictionary(d1)
337
+ vertices.append(vst)
338
+ tempe = topologic.Edge.ByStartVertexEndVertex(vCell, vst)
339
+ tempd = processKeysValues(["relationship"],["Via Shared Topologies"])
340
+ _ = tempe.SetDictionary(tempd)
341
+ edges.append(tempe)
342
+ if toContents:
343
+ contents = []
344
+ _ = sharedTopology.Contents(contents)
345
+ for content in contents:
346
+ if useInternalVertex == True:
347
+ vst2 = internalVertex(content, tolerance)
348
+ else:
349
+ vst2 = content.CenterOfMass()
350
+ d1 = content.GetDictionary()
351
+ vst2 = topologic.Vertex.ByCoordinates(vst2.X(), vst2.Y(), vst2.Z())
352
+ if storeBRep:
353
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
354
+ d3 = mergeDictionaries2([d1, d2])
355
+ _ = vst2.SetDictionary(d3)
356
+ else:
357
+ _ = vst2.SetDictionary(d1)
358
+ vertices.append(vst2)
359
+ tempe = topologic.Edge.ByStartVertexEndVertex(vst, vst2)
360
+ tempd = processKeysValues(["relationship"],["To Contents"])
361
+ _ = tempe.SetDictionary(tempd)
362
+ edges.append(tempe)
363
+ if viaSharedApertures:
364
+ for sharedAperture in sharedApertures:
365
+ if useInternalVertex == True:
366
+ vst = internalVertex(sharedAperture.Topology(), tolerance)
367
+ else:
368
+ vst = sharedAperture.Topology().CenterOfMass()
369
+ d1 = sharedAperture.Topology().GetDictionary()
370
+ if storeBRep:
371
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [sharedAperture.Topology().String(), sharedAperture.Topology().Type(), sharedAperture.Topology().GetTypeAsString()])
372
+ d3 = mergeDictionaries2([d1, d2])
373
+ _ = vst.SetDictionary(d3)
374
+ else:
375
+ _ = vst.SetDictionary(d1)
376
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
377
+ vertices.append(vst)
378
+ tempe = topologic.Edge.ByStartVertexEndVertex(vCell, vst)
379
+ tempd = processKeysValues(["relationship"],["Via Shared Apertures"])
380
+ _ = tempe.SetDictionary(tempd)
381
+ edges.append(tempe)
382
+ if toExteriorTopologies:
383
+ for exteriorTopology in exteriorTopologies:
384
+ if useInternalVertex == True:
385
+ vst = internalVertex(exteriorTopology, tolerance)
386
+ else:
387
+ vst = exteriorTopology.CenterOfMass()
388
+ _ = vst.SetDictionary(exteriorTopology.GetDictionary())
389
+ d1 = exteriorTopology.GetDictionary()
390
+ if storeBRep:
391
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorTopology.String(), exteriorTopology.Type(), exteriorTopology.GetTypeAsString()])
392
+ d3 = mergeDictionaries2([d1, d2])
393
+ _ = vst.SetDictionary(d3)
394
+ else:
395
+ _ = vst.SetDictionary(d1)
396
+ vertices.append(vst)
397
+ tempe = topologic.Edge.ByStartVertexEndVertex(vCell, vst)
398
+ tempd = processKeysValues(["relationship"],["To Exterior Topologies"])
399
+ _ = tempe.SetDictionary(tempd)
400
+ edges.append(tempe)
401
+ if toContents:
402
+ contents = []
403
+ _ = exteriorTopology.Contents(contents)
404
+ for content in contents:
405
+ if useInternalVertex == True:
406
+ vst2 = internalVertex(content, tolerance)
407
+ else:
408
+ vst2 = content.CenterOfMass()
409
+ d1 = content.GetDictionary()
410
+ vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
411
+ if storeBRep:
412
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
413
+ d3 = mergeDictionaries2([d1, d2])
414
+ _ = vst2.SetDictionary(d3)
415
+ else:
416
+ _ = vst2.SetDictionary(d1)
417
+ vertices.append(vst2)
418
+ tempe = topologic.Edge.ByStartVertexEndVertex(vst, vst2)
419
+ tempd = processKeysValues(["relationship"],["To Contents"])
420
+ _ = tempe.SetDictionary(tempd)
421
+ edges.append(tempe)
422
+ if toExteriorApertures:
423
+ for exteriorAperture in exteriorApertures:
424
+ extTop = exteriorAperture.Topology()
425
+ if useInternalVertex == True:
426
+ vst = internalVertex(extTop, tolerance)
427
+ else:
428
+ vst = exteriorAperture.Topology().CenterOfMass()
429
+ d1 = exteriorAperture.Topology().GetDictionary()
430
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
431
+ if storeBRep:
432
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorAperture.String(), exteriorAperture.Type(), exteriorAperture.GetTypeAsString()])
433
+ d3 = mergeDictionaries2([d1, d2])
434
+ _ = vst.SetDictionary(d3)
435
+ else:
436
+ _ = vst.SetDictionary(d1)
437
+ vertices.append(vst)
438
+ tempe = topologic.Edge.ByStartVertexEndVertex(vCell, vst)
439
+ tempd = processKeysValues(["relationship"],["To Exterior Apertures"])
440
+ _ = tempe.SetDictionary(tempd)
441
+ edges.append(tempe)
442
+ if toContents:
443
+ contents = []
444
+ _ = aCell.Contents(contents)
445
+ for content in contents:
446
+ if useInternalVertex == True:
447
+ vst = internalVertex(content, tolerance)
448
+ else:
449
+ vst = content.CenterOfMass()
450
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
451
+ d1 = content.GetDictionary()
452
+ if storeBRep:
453
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
454
+ d3 = mergeDictionaries2([d1, d2])
455
+ _ = vst.SetDictionary(d3)
456
+ else:
457
+ _ = vst.SetDictionary(d1)
458
+ vertices.append(vst)
459
+ tempe = topologic.Edge.ByStartVertexEndVertex(vCell, vst)
460
+ tempd = processKeysValues(["relationship"],["To Contents"])
461
+ _ = tempe.SetDictionary(tempd)
462
+ edges.append(tempe)
463
+
464
+ for aCell in cells:
465
+ if useInternalVertex == True:
466
+ vCell = topologic.CellUtility.InternalVertex(aCell, tolerance)
467
+ else:
468
+ vCell = aCell.CenterOfMass()
469
+ d1 = aCell.GetDictionary()
470
+ if storeBRep:
471
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [aCell.String(), aCell.Type(), aCell.GetTypeAsString()])
472
+ d3 = mergeDictionaries2([d1, d2])
473
+ _ = vCell.SetDictionary(d3)
474
+ else:
475
+ _ = vCell.SetDictionary(d1)
476
+ vertices.append(vCell)
477
+ return topologic.Graph.ByVerticesEdges(vertices,edges)
478
+
479
+ def processCell(item):
480
+ topology, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, useInternalVertex, storeBRep, tolerance = item
481
+ vertices = []
482
+ edges = []
483
+
484
+ if useInternalVertex == True:
485
+ vCell = topologic.CellUtility.InternalVertex(topology, tolerance)
486
+ else:
487
+ vCell = topology.CenterOfMass()
488
+ d1 = topology.GetDictionary()
489
+ if storeBRep:
490
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [topology.String(), topology.Type(), topology.GetTypeAsString()])
491
+ d3 = mergeDictionaries2([d1, d2])
492
+ _ = vCell.SetDictionary(d3)
493
+ else:
494
+ _ = vCell.SetDictionary(d1)
495
+ vertices.append(vCell)
496
+
497
+ if (toExteriorTopologies == True) or (toExteriorApertures == True) or (toContents == True):
498
+ faces = []
499
+ _ = topology.Faces(None, faces)
500
+ exteriorTopologies = []
501
+ exteriorApertures = []
502
+ for aFace in faces:
503
+ exteriorTopologies.append(aFace)
504
+ apertures = []
505
+ _ = aFace.Apertures(apertures)
506
+ for anAperture in apertures:
507
+ exteriorApertures.append(anAperture)
508
+ if toExteriorTopologies:
509
+ for exteriorTopology in exteriorTopologies:
510
+ if useInternalVertex == True:
511
+ vst = internalVertex(exteriorTopology, tolerance)
512
+ else:
513
+ vst = exteriorTopology.CenterOfMass()
514
+ d1 = exteriorTopology.GetDictionary()
515
+ if storeBRep:
516
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorTopology.String(), exteriorTopology.Type(), exteriorTopology.GetTypeAsString()])
517
+ d3 = mergeDictionaries2([d1, d2])
518
+ _ = vst.SetDictionary(d3)
519
+ else:
520
+ _ = vst.SetDictionary(d1)
521
+ vertices.append(vst)
522
+ tempe = topologic.Edge.ByStartVertexEndVertex(vCell, vst)
523
+ tempd = processKeysValues(["relationship"],["To Exterior Topologies"])
524
+ _ = tempe.SetDictionary(tempd)
525
+ edges.append(tempe)
526
+ if toContents:
527
+ contents = []
528
+ _ = exteriorTopology.Contents(contents)
529
+ for content in contents:
530
+ if useInternalVertex == True:
531
+ vst2 = internalVertex(content, tolerance)
532
+ else:
533
+ vst2 = content.CenterOfMass()
534
+ vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
535
+ d1 = content.GetDictionary()
536
+ if storeBRep:
537
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
538
+ d3 = mergeDictionaries2([d1, d2])
539
+ _ = vst2.SetDictionary(d3)
540
+ else:
541
+ _ = vst2.SetDictionary(d1)
542
+ vertices.append(vst2)
543
+ tempe = topologic.Edge.ByStartVertexEndVertex(vst, vst2)
544
+ tempd = processKeysValues(["relationship"],["To Contents"])
545
+ _ = tempe.SetDictionary(tempd)
546
+ edges.append(tempe)
547
+ if toExteriorApertures:
548
+ for exteriorAperture in exteriorApertures:
549
+ extTop = exteriorAperture.Topology()
550
+ if useInternalVertex == True:
551
+ vst = internalVertex(extTop, tolerance)
552
+ else:
553
+ vst = exteriorAperture.Topology().CenterOfMass()
554
+ d1 = exteriorAperture.Topology().GetDictionary()
555
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
556
+ if storeBRep:
557
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorAperture.Topology().String(), exteriorAperture.Topology().Type(), exteriorAperture.Topology().GetTypeAsString()])
558
+ d3 = mergeDictionaries2([d1, d2])
559
+ _ = vst.SetDictionary(d3)
560
+ else:
561
+ _ = vst.SetDictionary(d1)
562
+ vertices.append(vst)
563
+ tempe = topologic.Edge.ByStartVertexEndVertex(vCell, vst)
564
+ tempd = processKeysValues(["relationship"],["To Exterior Apertures"])
565
+ _ = tempe.SetDictionary(tempd)
566
+ edges.append(tempe)
567
+ if toContents:
568
+ contents = []
569
+ _ = topology.Contents(contents)
570
+ for content in contents:
571
+ if useInternalVertex == True:
572
+ vst = internalVertex(content, tolerance)
573
+ else:
574
+ vst = content.CenterOfMass()
575
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
576
+ d1 = content.GetDictionary()
577
+ if storeBRep:
578
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
579
+ d3 = mergeDictionaries2([d1, d2])
580
+ _ = vst.SetDictionary(d3)
581
+ else:
582
+ _ = vst.SetDictionary(d1)
583
+ vertices.append(vst)
584
+ tempe = topologic.Edge.ByStartVertexEndVertex(vCell, vst)
585
+ tempd = processKeysValues(["relationship"],["To Contents"])
586
+ _ = tempe.SetDictionary(tempd)
587
+ edges.append(tempe)
588
+
589
+ return topologic.Graph.ByVerticesEdges(vertices, edges)
590
+
591
+ def processShell(item):
592
+ topology, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, useInternalVertex, storeBRep, tolerance = item
593
+ graph = None
594
+ edges = []
595
+ vertices = []
596
+ facemat = []
597
+ if direct == True:
598
+ topFaces = []
599
+ _ = topology.Faces(None, topFaces)
600
+ # Create a matrix of zeroes
601
+ for i in range(len(topFaces)):
602
+ faceRow = []
603
+ for j in range(len(topFaces)):
604
+ faceRow.append(0)
605
+ facemat.append(faceRow)
606
+ for i in range(len(topFaces)):
607
+ for j in range(len(topFaces)):
608
+ if (i != j) and facemat[i][j] == 0:
609
+ facemat[i][j] = 1
610
+ facemat[j][i] = 1
611
+ sharedt = []
612
+ topFaces[i].SharedTopologies(topFaces[j], 2, sharedt)
613
+ if len(sharedt) > 0:
614
+ if useInternalVertex == True:
615
+ v1 = topologic.FaceUtility.InternalVertex(topFaces[i], tolerance)
616
+ v2 = topologic.FaceUtility.InternalVertex(topFaces[j], tolerance)
617
+ else:
618
+ v1 = topFaces[i].CenterOfMass()
619
+ v2 = topFaces[j].CenterOfMass()
620
+ e = topologic.Edge.ByStartVertexEndVertex(v1, v2)
621
+ mDict = mergeDictionaries(sharedt)
622
+ if mDict:
623
+ e.SetDictionary(mDict)
624
+ edges.append(e)
625
+ if directApertures == True:
626
+ facemat = []
627
+ topFaces = []
628
+ _ = topology.Faces(None, topFaces)
629
+ # Create a matrix of zeroes
630
+ for i in range(len(topFaces)):
631
+ faceRow = []
632
+ for j in range(len(topFaces)):
633
+ faceRow.append(0)
634
+ facemat.append(faceRow)
635
+ for i in range(len(topFaces)):
636
+ for j in range(len(topFaces)):
637
+ if (i != j) and facemat[i][j] == 0:
638
+ facemat[i][j] = 1
639
+ facemat[j][i] = 1
640
+ sharedt = []
641
+ topFaces[i].SharedTopologies(topFaces[j], 2, sharedt)
642
+ if len(sharedt) > 0:
643
+ apertureExists = False
644
+ for x in sharedt:
645
+ apList = []
646
+ _ = x.Apertures(apList)
647
+ if len(apList) > 0:
648
+ apertureExists = True
649
+ break
650
+ if apertureExists:
651
+ apTopList = []
652
+ for ap in apList:
653
+ apTopList.append(ap.Topology())
654
+ if useInternalVertex == True:
655
+ v1 = topologic.FaceUtility.InternalVertex(topFaces[i], tolerance)
656
+ v2 = topologic.FaceUtility.InternalVertex(topFaces[j], tolerance)
657
+ else:
658
+ v1 = topFaces[i].CenterOfMass()
659
+ v2 = topFaces[j].CenterOfMass()
660
+ e = topologic.Edge.ByStartVertexEndVertex(v1, v2)
661
+ mDict = mergeDictionaries(apTopList)
662
+ if mDict:
663
+ e.SetDictionary(mDict)
664
+ edges.append(e)
665
+
666
+ topFaces = []
667
+ _ = topology.Faces(None, topFaces)
668
+ if (viaSharedTopologies == True) or (viaSharedApertures == True) or (toExteriorTopologies == True) or (toExteriorApertures == True) or (toContents == True):
669
+ for aFace in topFaces:
670
+ if useInternalVertex == True:
671
+ vFace = topologic.FaceUtility.InternalVertex(aFace, tolerance)
672
+ else:
673
+ vFace = aFace.CenterOfMass()
674
+ _ = vFace.SetDictionary(aFace.GetDictionary())
675
+ vertices.append(vFace)
676
+ fEdges = []
677
+ _ = aFace.Edges(None, fEdges)
678
+ sharedTopologies = []
679
+ exteriorTopologies = []
680
+ sharedApertures = []
681
+ exteriorApertures = []
682
+ for anEdge in fEdges:
683
+ faces = []
684
+ _ = anEdge.Faces(topology, faces)
685
+ if len(faces) > 1:
686
+ sharedTopologies.append(anEdge)
687
+ apertures = []
688
+ _ = anEdge.Apertures(apertures)
689
+ for anAperture in apertures:
690
+ sharedApertures.append(anAperture)
691
+ else:
692
+ exteriorTopologies.append(anEdge)
693
+ apertures = []
694
+ _ = anEdge.Apertures(apertures)
695
+ for anAperture in apertures:
696
+ exteriorApertures.append(anAperture)
697
+ if viaSharedTopologies:
698
+ for sharedTopology in sharedTopologies:
699
+ if useInternalVertex == True:
700
+ vst = internalVertex(sharedTopology, tolerance)
701
+ else:
702
+ vst = sharedTopology.CenterOfMass()
703
+ d1 = sharedTopology.GetDictionary()
704
+ if storeBRep:
705
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [sharedTopology.String(), sharedTopology.Type(), sharedTopology.GetTypeAsString()])
706
+ d3 = mergeDictionaries2([d1, d2])
707
+ _ = vst.SetDictionary(d3)
708
+ else:
709
+ _ = vst.SetDictionary(d1)
710
+ vertices.append(vst)
711
+ tempe = topologic.Edge.ByStartVertexEndVertex(vFace, vst)
712
+ tempd = processKeysValues(["relationship"],["Via Shared Topologies"])
713
+ _ = tempe.SetDictionary(tempd)
714
+ edges.append(tempe)
715
+ if toContents:
716
+ contents = []
717
+ _ = sharedTopology.Contents(contents)
718
+ for content in contents:
719
+ if useInternalVertex == True:
720
+ vst2 = internalVertex(content, tolerance)
721
+ else:
722
+ vst2 = content.CenterOfMass()
723
+ vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
724
+ d1 = content.GetDictionary()
725
+ if storeBRep:
726
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
727
+ d3 = mergeDictionaries2([d1, d2])
728
+ _ = vst2.SetDictionary(d3)
729
+ else:
730
+ _ = vst2.SetDictionary(d1)
731
+ vertices.append(vst2)
732
+ tempe = topologic.Edge.ByStartVertexEndVertex(vst, vst2)
733
+ tempd = processKeysValues(["relationship"],["To Contents"])
734
+ _ = tempe.SetDictionary(tempd)
735
+ edges.append(tempe)
736
+ if viaSharedApertures:
737
+ for sharedAperture in sharedApertures:
738
+ if useInternalVertex == True:
739
+ vst = internalVertex(sharedAperture.Topology(), tolerance)
740
+ else:
741
+ vst = sharedAperture.Topology().CenterOfMass()
742
+ d1 = sharedAperture.Topology().GetDictionary()
743
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
744
+ if storeBRep:
745
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [sharedAperture.Topology().String(), sharedAperture.Topology().Type(), sharedAperture.Topology().GetTypeAsString()])
746
+ d3 = mergeDictionaries2([d1, d2])
747
+ _ = vst.SetDictionary(d3)
748
+ else:
749
+ _ = vst.SetDictionary(d1)
750
+ vertices.append(vst)
751
+ tempe = topologic.Edge.ByStartVertexEndVertex(vFace, vst)
752
+ tempd = processKeysValues(["relationship"],["Via Shared Apertures"])
753
+ _ = tempe.SetDictionary(tempd)
754
+ edges.append(tempe)
755
+ if toExteriorTopologies:
756
+ for exteriorTopology in exteriorTopologies:
757
+ if useInternalVertex == True:
758
+ vst = internalVertex(exteriorTopology, tolerance)
759
+ else:
760
+ vst = exteriorTopology.CenterOfMass()
761
+ d1 = exteriorTopology.GetDictionary()
762
+ if storeBRep:
763
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorTopology.String(), exteriorTopology.Type(), exteriorTopology.GetTypeAsString()])
764
+ d3 = mergeDictionaries2([d1, d2])
765
+ _ = vst.SetDictionary(d3)
766
+ else:
767
+ _ = vst.SetDictionary(d1)
768
+ vertices.append(vst)
769
+ tempe = topologic.Edge.ByStartVertexEndVertex(vFace, vst)
770
+ tempd = processKeysValues(["relationship"],["To Exterior Apertures"])
771
+ _ = tempe.SetDictionary(tempd)
772
+ edges.append(tempe)
773
+ if toContents:
774
+ contents = []
775
+ _ = exteriorTopology.Contents(contents)
776
+ for content in contents:
777
+ if useInternalVertex == True:
778
+ vst2 = internalVertex(content, tolerance)
779
+ else:
780
+ vst2 = content.CenterOfMass()
781
+ vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
782
+ d1 = content.GetDictionary()
783
+ if storeBRep:
784
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
785
+ d3 = mergeDictionaries2([d1, d2])
786
+ _ = vst2.SetDictionary(d3)
787
+ else:
788
+ _ = vst2.SetDictionary(d1)
789
+ vertices.append(vst2)
790
+ tempe = topologic.Edge.ByStartVertexEndVertex(vst, vst2)
791
+ tempd = processKeysValues(["relationship"],["To Contents"])
792
+ _ = tempe.SetDictionary(tempd)
793
+ edges.append(tempe)
794
+ if toExteriorApertures:
795
+ for exteriorAperture in exteriorApertures:
796
+ extTop = exteriorAperture.Topology()
797
+ if useInternalVertex == True:
798
+ vst = internalVertex(extTop, tolerance)
799
+ else:
800
+ vst = exteriorAperture.Topology().CenterOfMass()
801
+ d1 = exteriorAperture.Topology().GetDictionary()
802
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
803
+ if storeBRep:
804
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorAperture.Topology().String(), exteriorAperture.Topology().Type(), exteriorAperture.Topology().GetTypeAsString()])
805
+ d3 = mergeDictionaries2([d1, d2])
806
+ _ = vst.SetDictionary(d3)
807
+ else:
808
+ _ = vst.SetDictionary(d1)
809
+ vertices.append(vst)
810
+ tempe = topologic.Edge.ByStartVertexEndVertex(vFace, vst)
811
+ tempd = processKeysValues(["relationship"],["To Exterior Apertures"])
812
+ _ = tempe.SetDictionary(tempd)
813
+ edges.append(tempe)
814
+ if toContents:
815
+ contents = []
816
+ _ = aFace.Contents(contents)
817
+ for content in contents:
818
+ if useInternalVertex == True:
819
+ vst = internalVertex(content, tolerance)
820
+ else:
821
+ vst = content.CenterOfMass()
822
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
823
+ d1 = content.GetDictionary()
824
+ if storeBRep:
825
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
826
+ d3 = mergeDictionaries2([d1, d2])
827
+ _ = vst.SetDictionary(d3)
828
+ else:
829
+ _ = vst.SetDictionary(d1)
830
+ vertices.append(vst)
831
+ tempe = topologic.Edge.ByStartVertexEndVertex(vFace, vst)
832
+ tempd = processKeysValues(["relationship"],["To Contents"])
833
+ _ = tempe.SetDictionary(tempd)
834
+ edges.append(tempe)
835
+
836
+ for aFace in topFaces:
837
+ if useInternalVertex == True:
838
+ vFace = internalVertex(aFace, tolerance)
839
+ else:
840
+ vFace = aFace.CenterOfMass()
841
+ d1 = aFace.GetDictionary()
842
+ if storeBRep:
843
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [aFace.String(), aFace.Type(), aFace.GetTypeAsString()])
844
+ d3 = mergeDictionaries2([d1, d2])
845
+ _ = vFace.SetDictionary(d3)
846
+ else:
847
+ _ = vFace.SetDictionary(d1)
848
+ vertices.append(vFace)
849
+ return topologic.Graph.ByVerticesEdges(vertices, edges)
850
+
851
+ def processFace(item):
852
+ topology, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, useInternalVertex, storeBRep, tolerance = item
853
+
854
+ graph = None
855
+ vertices = []
856
+ edges = []
857
+
858
+ if useInternalVertex == True:
859
+ vFace = topologic.FaceUtility.InternalVertex(topology, tolerance)
860
+ else:
861
+ vFace = topology.CenterOfMass()
862
+ d1 = topology.GetDictionary()
863
+ if storeBRep:
864
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [topology.String(), topology.Type(), topology.GetTypeAsString()])
865
+ d3 = mergeDictionaries2([d1, d2])
866
+ _ = vFace.SetDictionary(d3)
867
+ else:
868
+ _ = vFace.SetDictionary(d1)
869
+ vertices.append(vFace)
870
+ if (toExteriorTopologies == True) or (toExteriorApertures == True) or (toContents == True):
871
+ fEdges = []
872
+ _ = topology.Edges(None, fEdges)
873
+ exteriorTopologies = []
874
+ exteriorApertures = []
875
+
876
+ for anEdge in fEdges:
877
+ exteriorTopologies.append(anEdge)
878
+ apertures = []
879
+ _ = anEdge.Apertures(apertures)
880
+ for anAperture in apertures:
881
+ exteriorApertures.append(anAperture)
882
+ if toExteriorTopologies:
883
+ for exteriorTopology in exteriorTopologies:
884
+ if useInternalVertex == True:
885
+ vst = internalVertex(exteriorTopology, tolerance)
886
+ else:
887
+ vst = exteriorTopology.CenterOfMass()
888
+ d1 = exteriorTopology.GetDictionary()
889
+ if storeBRep:
890
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorTopology.String(), exteriorTopology.Type(), exteriorTopology.GetTypeAsString()])
891
+ d3 = mergeDictionaries2([d1, d2])
892
+ _ = vst.SetDictionary(d3)
893
+ else:
894
+ _ = vst.SetDictionary(d1)
895
+ vertices.append(vst)
896
+ tempe = topologic.Edge.ByStartVertexEndVertex(vFace, vst)
897
+ tempd = processKeysValues(["relationship"],["To Exterior Topologies"])
898
+ _ = tempe.SetDictionary(tempd)
899
+ edges.append(tempe)
900
+ if toContents:
901
+ contents = []
902
+ _ = exteriorTopology.Contents(contents)
903
+ for content in contents:
904
+ if useInternalVertex == True:
905
+ vst2 = internalVertex(content, tolerance)
906
+ else:
907
+ vst2 = content.CenterOfMass()
908
+ vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
909
+ d1 = content.GetDictionary()
910
+ if storeBRep:
911
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
912
+ d3 = mergeDictionaries2([d1, d2])
913
+ _ = vst2.SetDictionary(d3)
914
+ else:
915
+ _ = vst2.SetDictionary(d1)
916
+ vertices.append(vst2)
917
+ tempe = topologic.Edge.ByStartVertexEndVertex(vst, vst2)
918
+ tempd = processKeysValues(["relationship"],["To Contents"])
919
+ _ = tempe.SetDictionary(tempd)
920
+ edges.append(tempe)
921
+ if toExteriorApertures:
922
+ for exteriorAperture in exteriorApertures:
923
+ extTop = exteriorAperture.Topology()
924
+ if useInternalVertex == True:
925
+ vst = internalVertex(extTop, tolerance)
926
+ else:
927
+ vst = exteriorAperture.Topology().CenterOfMass()
928
+ d1 = exteriorAperture.Topology().GetDictionary()
929
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
930
+ if storeBRep:
931
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorAperture.Topology().String(), exteriorAperture.Topology().Type(), exteriorAperture.Topology().GetTypeAsString()])
932
+ d3 = mergeDictionaries2([d1, d2])
933
+ _ = vst.SetDictionary(d3)
934
+ else:
935
+ _ = vst.SetDictionary(d1)
936
+ vertices.append(vst)
937
+ tempe = topologic.Edge.ByStartVertexEndVertex(vFace, vst)
938
+ tempd = processKeysValues(["relationship"],["To Exterior Apertures"])
939
+ _ = tempe.SetDictionary(tempd)
940
+ edges.append(tempe)
941
+ if toContents:
942
+ contents = []
943
+ _ = topology.Contents(contents)
944
+ for content in contents:
945
+ if useInternalVertex == True:
946
+ vst = internalVertex(content, tolerance)
947
+ else:
948
+ vst = content.CenterOfMass()
949
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
950
+ d1 = content.GetDictionary()
951
+ if storeBRep:
952
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
953
+ d3 = mergeDictionaries2([d1, d2])
954
+ _ = vst.SetDictionary(d3)
955
+ else:
956
+ _ = vst.SetDictionary(d1)
957
+ vertices.append(vst)
958
+ tempe = topologic.Edge.ByStartVertexEndVertex(vFace, vst)
959
+ tempd = processKeysValues(["relationship"],["To Contents"])
960
+ _ = tempe.SetDictionary(tempd)
961
+ edges.append(tempe)
962
+ return topologic.Graph.ByVertices(vertices, edges)
963
+
964
+ def processWire(item):
965
+ topology, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, useInternalVertex, storeBRep, tolerance = item
966
+ graph = None
967
+ edges = []
968
+ vertices = []
969
+ edgemat = []
970
+ if direct == True:
971
+ topEdges = []
972
+ _ = topology.Edges(None, topEdges)
973
+ # Create a matrix of zeroes
974
+ for i in range(len(topEdges)):
975
+ edgeRow = []
976
+ for j in range(len(topEdges)):
977
+ edgeRow.append(0)
978
+ edgemat.append(edgeRow)
979
+ for i in range(len(topEdges)):
980
+ for j in range(len(topEdges)):
981
+ if (i != j) and edgemat[i][j] == 0:
982
+ edgemat[i][j] = 1
983
+ edgemat[j][i] = 1
984
+ sharedt = []
985
+ topEdges[i].SharedTopologies(topEdges[j], 1, sharedt)
986
+ if len(sharedt) > 0:
987
+ try:
988
+ v1 = topologic.EdgeUtility.PointAtParameter(topEdges[i], 0.5)
989
+ except:
990
+ v1 = topEdges[j].CenterOfMass()
991
+ try:
992
+ v2 = topologic.EdgeUtility.PointAtParameter(topEdges[j], 0.5)
993
+ except:
994
+ v2 = topEdges[j].CenterOfMass()
995
+ e = topologic.Edge.ByStartVertexEndVertex(v1, v2)
996
+ mDict = mergeDictionaries(sharedt)
997
+ if mDict:
998
+ e.SetDictionary(mDict)
999
+ edges.append(e)
1000
+ if directApertures == True:
1001
+ edgemat = []
1002
+ topEdges = []
1003
+ _ = topology.Edges(None, topEdges)
1004
+ # Create a matrix of zeroes
1005
+ for i in range(len(topEdges)):
1006
+ edgeRow = []
1007
+ for j in range(len(topEdges)):
1008
+ edgeRow.append(0)
1009
+ edgemat.append(edgeRow)
1010
+ for i in range(len(topEdges)):
1011
+ for j in range(len(topEdges)):
1012
+ if (i != j) and edgemat[i][j] == 0:
1013
+ edgemat[i][j] = 1
1014
+ edgemat[j][i] = 1
1015
+ sharedt = []
1016
+ topEdges[i].SharedTopologies(topEdges[j], 1, sharedt)
1017
+ if len(sharedt) > 0:
1018
+ apertureExists = False
1019
+ for x in sharedt:
1020
+ apList = []
1021
+ _ = x.Apertures(apList)
1022
+ if len(apList) > 0:
1023
+ apertureExists = True
1024
+ break
1025
+ if apertureExists:
1026
+ try:
1027
+ v1 = topologic.EdgeUtility.PointAtParameter(topEdges[i], 0.5)
1028
+ except:
1029
+ v1 = topEdges[j].CenterOfMass()
1030
+ try:
1031
+ v2 = topologic.EdgeUtility.PointAtParameter(topEdges[j], 0.5)
1032
+ except:
1033
+ v2 = topEdges[j].CenterOfMass()
1034
+ e = topologic.Edge.ByStartVertexEndVertex(v1, v2)
1035
+ apTopologies = []
1036
+ for ap in apList:
1037
+ apTopologies.append(ap.Topology())
1038
+ mDict = mergeDictionaries(apTopologies)
1039
+ if mDict:
1040
+ e.SetDictionary(mDict)
1041
+ edges.append(e)
1042
+
1043
+ topEdges = []
1044
+ _ = topology.Edges(None, topEdges)
1045
+ if (viaSharedTopologies == True) or (viaSharedApertures == True) or (toExteriorTopologies == True) or (toExteriorApertures == True) or (toContents == True):
1046
+ for anEdge in topEdges:
1047
+ try:
1048
+ vEdge = topologic.EdgeUtility.PointAtParameter(anEdge, 0.5)
1049
+ except:
1050
+ vEdge = anEdge.CenterOfMass()
1051
+ d1 = anEdge.GetDictionary()
1052
+ if storeBRep:
1053
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [anEdge.String(), anEdge.Type(), anEdge.GetTypeAsString()])
1054
+ d3 = mergeDictionaries2([d1, d2])
1055
+ _ = vEdge.SetDictionary(d3)
1056
+ else:
1057
+ _ = vEdge.SetDictionary(d1)
1058
+ vertices.append(vEdge)
1059
+ eVertices = []
1060
+ _ = anEdge.Vertices(None, eVertices)
1061
+ sharedTopologies = []
1062
+ exteriorTopologies = []
1063
+ sharedApertures = []
1064
+ exteriorApertures = []
1065
+ contents = []
1066
+ _ = anEdge.Contents(contents)
1067
+ for aVertex in eVertices:
1068
+ tempEdges = []
1069
+ _ = aVertex.Edges(topology, tempEdges)
1070
+ if len(tempEdges) > 1:
1071
+ sharedTopologies.append(aVertex)
1072
+ apertures = []
1073
+ _ = aVertex.Apertures(apertures)
1074
+ for anAperture in apertures:
1075
+ sharedApertures.append(anAperture)
1076
+ else:
1077
+ exteriorTopologies.append(aVertex)
1078
+ apertures = []
1079
+ _ = aVertex.Apertures(apertures)
1080
+ for anAperture in apertures:
1081
+ exteriorApertures.append(anAperture)
1082
+ if viaSharedTopologies:
1083
+ for sharedTopology in sharedTopologies:
1084
+ vst = sharedTopology.CenterOfMass()
1085
+ d1 = sharedTopology.GetDictionary()
1086
+ if storeBRep:
1087
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [sharedTopology.String(), sharedTopology.Type(), sharedTopology.GetTypeAsString()])
1088
+ d3 = mergeDictionaries2([d1, d2])
1089
+ _ = vst.SetDictionary(d3)
1090
+ else:
1091
+ _ = vst.SetDictionary(d1)
1092
+ vertices.append(vst)
1093
+ tempe = topologic.Edge.ByStartVertexEndVertex(vEdge, vst)
1094
+ tempd = processKeysValues(["relationship"],["Via Shared Topologies"])
1095
+ _ = tempe.SetDictionary(tempd)
1096
+ edges.append(tempe)
1097
+ if toContents:
1098
+ contents = []
1099
+ _ = sharedTopology.Contents(contents)
1100
+ for content in contents:
1101
+ if useInternalVertex == True:
1102
+ vst2 = internalVertex(content, tolerance)
1103
+ else:
1104
+ vst2 = content.CenterOfMass()
1105
+ vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
1106
+ d1 = content.GetDictionary()
1107
+ if storeBRep:
1108
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
1109
+ d3 = mergeDictionaries2([d1, d2])
1110
+ _ = vst2.SetDictionary(d3)
1111
+ else:
1112
+ _ = vst2.SetDictionary(d1)
1113
+ vertices.append(vst2)
1114
+ tempe = topologic.Edge.ByStartVertexEndVertex(vst, vst2)
1115
+ tempd = processKeysValues(["relationship"],["To Contents"])
1116
+ _ = tempe.SetDictionary(tempd)
1117
+ edges.append(tempe)
1118
+ if viaSharedApertures:
1119
+ for sharedAperture in sharedApertures:
1120
+ if useInternalVertex == True:
1121
+ vst = internalVertex(sharedAperture.Topology(), tolerance)
1122
+ else:
1123
+ vst = sharedAperture.Topology().CenterOfMass()
1124
+ d1 = sharedAperture.Topology().GetDictionary()
1125
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
1126
+ if storeBRep:
1127
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [sharedAperture.Topology().String(), sharedAperture.Topology().Type(), sharedAperture.Topology().GetTypeAsString()])
1128
+ d3 = mergeDictionaries2([d1, d2])
1129
+ _ = vst.SetDictionary(d3)
1130
+ else:
1131
+ _ = vst.SetDictionary(d1)
1132
+ vertices.append(vst)
1133
+ tempe = topologic.Edge.ByStartVertexEndVertex(vEdge, vst)
1134
+ tempd = processKeysValues(["relationship"],["Via Shared Apertures"])
1135
+ _ = tempe.SetDictionary(tempd)
1136
+ edges.append(tempe)
1137
+ if toExteriorTopologies:
1138
+ for exteriorTopology in exteriorTopologies:
1139
+ vst = exteriorTopology
1140
+ vertices.append(exteriorTopology)
1141
+ tempe = topologic.Edge.ByStartVertexEndVertex(vEdge, vst)
1142
+ tempd = processKeysValues(["relationship"],["To Exterior Topologies"])
1143
+ _ = tempe.SetDictionary(tempd)
1144
+ edges.append(tempe)
1145
+ if toContents:
1146
+ contents = []
1147
+ _ = vst.Contents(contents)
1148
+ for content in contents:
1149
+ if useInternalVertex == True:
1150
+ vst2 = internalVertex(content, tolerance)
1151
+ else:
1152
+ vst2 = content.CenterOfMass()
1153
+ vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
1154
+ d1 = content.GetDictionary()
1155
+ if storeBRep:
1156
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
1157
+ d3 = mergeDictionaries2([d1, d2])
1158
+ _ = vst2.SetDictionary(d3)
1159
+ else:
1160
+ _ = vst2.SetDictionary(d1)
1161
+ vertices.append(vst2)
1162
+ tempe = topologic.Edge.ByStartVertexEndVertex(vst, vst2)
1163
+ tempd = processKeysValues(["relationship"],["To Contents"])
1164
+ _ = tempe.SetDictionary(tempd)
1165
+ edges.append(tempe)
1166
+ if toExteriorApertures:
1167
+ for exteriorAperture in exteriorApertures:
1168
+ extTop = exteriorAperture.Topology()
1169
+ if useInternalVertex == True:
1170
+ vst = internalVertex(extTop, tolerance)
1171
+ else:
1172
+ vst = extTop.CenterOfMass()
1173
+ d1 = extTop.GetDictionary()
1174
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
1175
+ if storeBRep:
1176
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [extTop.String(), extTop.Type(), extTop.GetTypeAsString()])
1177
+ d3 = mergeDictionaries2([d1, d2])
1178
+ _ = vst.SetDictionary(d3)
1179
+ else:
1180
+ _ = vst.SetDictionary(d1)
1181
+ vertices.append(vst)
1182
+ tempe = topologic.Edge.ByStartVertexEndVertex(vEdge, vst)
1183
+ tempd = processKeysValues(["relationship"],["To Exterior Apertures"])
1184
+ _ = tempe.SetDictionary(tempd)
1185
+ edges.append(tempe)
1186
+ if toContents:
1187
+ contents = []
1188
+ _ = anEdge.Contents(contents)
1189
+ for content in contents:
1190
+ if useInternalVertex == True:
1191
+ vst = internalVertex(content, tolerance)
1192
+ else:
1193
+ vst = content.CenterOfMass()
1194
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
1195
+ d1 = content.GetDictionary()
1196
+ vst = topologic.Vertex.ByCoordinates(vst.X(), vst.Y(), vst.Z())
1197
+ if storeBRep:
1198
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
1199
+ d3 = mergeDictionaries2([d1, d2])
1200
+ _ = vst.SetDictionary(d3)
1201
+ else:
1202
+ _ = vst.SetDictionary(d1)
1203
+ vertices.append(vst)
1204
+ tempe = topologic.Edge.ByStartVertexEndVertex(vEdge, vst)
1205
+ tempd = processKeysValues(["relationship"],["To Contents"])
1206
+ _ = tempe.SetDictionary(tempd)
1207
+ edges.append(tempe)
1208
+ for anEdge in topEdges:
1209
+ try:
1210
+ vEdge = topologic.EdgeUtility.PointAtParameter(anEdge, 0.5)
1211
+ except:
1212
+ vEdge = anEdge.CenterOfMass()
1213
+ d1 = anEdge.GetDictionary()
1214
+ if storeBRep:
1215
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [anEdge.String(), anEdge.Type(), anEdge.GetTypeAsString()])
1216
+ d3 = mergeDictionaries2([d1, d2])
1217
+ _ = vEdge.SetDictionary(d3)
1218
+ else:
1219
+ _ = vEdge.SetDictionary(d1)
1220
+ vertices.append(vEdge)
1221
+ return topologic.Graph.ByVerticesEdges(vertices, edges)
1222
+
1223
+ def processEdge(item):
1224
+ topology, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, useInternalVertex, storeBRep, tolerance = item
1225
+ graph = None
1226
+ vertices = []
1227
+ edges = []
1228
+
1229
+ if useInternalVertex == True:
1230
+ try:
1231
+ vEdge = topologic.EdgeUtility.PointAtParameter(topology, 0.5)
1232
+ except:
1233
+ vEdge = topology.CenterOfMass()
1234
+ else:
1235
+ vEdge = topology.CenterOfMass()
1236
+
1237
+ d1 = vEdge.GetDictionary()
1238
+ if storeBRep:
1239
+ d2 = processKeysValues(["brep"], [topology.String()])
1240
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [topology.String(), topology.Type(), topology.GetTypeAsString()])
1241
+ d3 = mergeDictionaries2([d1, d2])
1242
+ _ = vEdge.SetDictionary(d3)
1243
+ else:
1244
+ _ = vEdge.SetDictionary(topology.GetDictionary())
1245
+
1246
+ vertices.append(vEdge)
1247
+
1248
+ if (toExteriorTopologies == True) or (toExteriorApertures == True) or (toContents == True):
1249
+ eVertices = []
1250
+ _ = topology.Vertices(None, eVertices)
1251
+ exteriorTopologies = []
1252
+ exteriorApertures = []
1253
+ for aVertex in eVertices:
1254
+ exteriorTopologies.append(aVertex)
1255
+ apertures = []
1256
+ _ = aVertex.Apertures(apertures)
1257
+ for anAperture in apertures:
1258
+ exteriorApertures.append(anAperture)
1259
+ if toExteriorTopologies:
1260
+ for exteriorTopology in exteriorTopologies:
1261
+ if useInternalVertex == True:
1262
+ vst = internalVertex(exteriorTopology, tolerance)
1263
+ else:
1264
+ vst = exteriorTopology.CenterOfMass()
1265
+ d1 = exteriorTopology.GetDictionary()
1266
+ if storeBRep:
1267
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorTopology.String(), exteriorTopology.Type(), exteriorTopology.GetTypeAsString()])
1268
+ d3 = mergeDictionaries2([d1, d2])
1269
+ _ = vst.SetDictionary(d3)
1270
+ else:
1271
+ _ = vst.SetDictionary(d1)
1272
+ vertices.append(vst)
1273
+ tempe = topologic.Edge.ByStartVertexEndVertex(vEdge, vst)
1274
+ tempd = processKeysValues(["relationship"],["To Exterior Topologies"])
1275
+ _ = tempe.SetDictionary(tempd)
1276
+ edges.append(tempe)
1277
+ if toContents:
1278
+ contents = []
1279
+ _ = vst.Contents(contents)
1280
+ for content in contents:
1281
+ if useInternalVertex == True:
1282
+ vst2 = internalVertex(content, tolerance)
1283
+ else:
1284
+ vst2 = content.CenterOfMass()
1285
+ vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
1286
+ d1 = content.GetDictionary()
1287
+ if storeBRep:
1288
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
1289
+ d3 = mergeDictionaries2([d1, d2])
1290
+ _ = vst2.SetDictionary(d3)
1291
+ else:
1292
+ _ = vst2.SetDictionary(d1)
1293
+ vertices.append(vst2)
1294
+ tempe = topologic.Edge.ByStartVertexEndVertex(vst, vst2)
1295
+ tempd = processKeysValues(["relationship"],["To Contents"])
1296
+ _ = tempe.SetDictionary(tempd)
1297
+ edges.append(tempe)
1298
+ if toExteriorApertures:
1299
+ for exteriorAperture in exteriorApertures:
1300
+ extTop = exteriorAperture.Topology()
1301
+ if useInternalVertex == True:
1302
+ vst = internalVertex(extTop, tolerance)
1303
+ else:
1304
+ vst = exteriorAperture.Topology().CenterOfMass()
1305
+ d1 = exteriorAperture.Topology().GetDictionary()
1306
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
1307
+ if storeBRep:
1308
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [exteriorAperture.Topology().String(), exteriorAperture.Topology().Type(), exteriorAperture.Topology().GetTypeAsString()])
1309
+ d3 = mergeDictionaries2([d1, d2])
1310
+ _ = vst.SetDictionary(d3)
1311
+ else:
1312
+ _ = vst.SetDictionary(d1)
1313
+ _ = vst.SetDictionary(exteriorAperture.Topology().GetDictionary())
1314
+ vertices.append(vst)
1315
+ tempe = topologic.Edge.ByStartVertexEndVertex(vEdge, vst)
1316
+ tempd = processKeysValues(["relationship"],["To Exterior Apertures"])
1317
+ _ = tempe.SetDictionary(tempd)
1318
+ edges.append(tempe)
1319
+ if toContents:
1320
+ contents = []
1321
+ _ = topology.Contents(contents)
1322
+ for content in contents:
1323
+ if useInternalVertex == True:
1324
+ vst = internalVertex(content, tolerance)
1325
+ else:
1326
+ vst = content.CenterOfMass()
1327
+ d1 = content.GetDictionary()
1328
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
1329
+ if storeBRep:
1330
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
1331
+ d3 = mergeDictionaries2([d1, d2])
1332
+ _ = vst.SetDictionary(d3)
1333
+ else:
1334
+ _ = vst.SetDictionary(d1)
1335
+ vertices.append(vst)
1336
+ tempe = topologic.Edge.ByStartVertexEndVertex(vEdge, vst)
1337
+ tempd = processKeysValues(["relationship"],["To Contents"])
1338
+ _ = tempe.SetDictionary(tempd)
1339
+ edges.append(tempe)
1340
+ graph = topologic.Graph.ByVerticesEdges(vertices, edges)
1341
+ return graph
1342
+
1343
+ def processVertex(item):
1344
+ topology, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, useInternalVertex, storeBRep, tolerance = item
1345
+ vertices = [topology]
1346
+ edges = []
1347
+ if toContents:
1348
+ contents = []
1349
+ _ = topology.Contents(contents)
1350
+ for content in contents:
1351
+ if useInternalVertex == True:
1352
+ vst = internalVertex(content, tolerance)
1353
+ else:
1354
+ vst = content.CenterOfMass()
1355
+ d1 = content.GetDictionary()
1356
+ vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
1357
+ if storeBRep:
1358
+ d2 = processKeysValues(["brep", "brepType", "brepTypeString"], [content.String(), content.Type(), content.GetTypeAsString()])
1359
+ d3 = mergeDictionaries2([d1, d2])
1360
+ _ = vst.SetDictionary(d3)
1361
+ else:
1362
+ _ = vst.SetDictionary(d1)
1363
+ vertices.append(vst)
1364
+ tempe = topologic.Edge.ByStartVertexEndVertex(topology, vst)
1365
+ tempd = processKeysValues(["relationship"],["To Contents"])
1366
+ _ = tempe.SetDictionary(tempd)
1367
+ edges.append(tempe)
1368
+ return topologic.Graph.VerticesEdges(vertices, edges)