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/Speckle.py ADDED
@@ -0,0 +1,433 @@
1
+ from specklepy.api.client import SpeckleClient
2
+ from specklepy.api.wrapper import StreamWrapper
3
+ from specklepy.api import operations
4
+ from specklepy.objects import Base
5
+ from specklepy.transports.server import ServerTransport
6
+
7
+ class Speckle:
8
+ @staticmethod
9
+ def SpeckleBranchByID(branch_list, branch_id):
10
+ """
11
+ Parameters
12
+ ----------
13
+ branch_list : TYPE
14
+ DESCRIPTION.
15
+ branch_id : TYPE
16
+ DESCRIPTION.
17
+
18
+ Returns
19
+ -------
20
+ branch : TYPE
21
+ DESCRIPTION.
22
+
23
+ """
24
+ # branch_list, branch_id = item
25
+ for branch in branch_list:
26
+ if branch.id == branch_id:
27
+ return branch
28
+ return None
29
+
30
+ @staticmethod
31
+ def SpeckleBranchesByStream(client, stream):
32
+ """
33
+ Parameters
34
+ ----------
35
+ client : TYPE
36
+ DESCRIPTION.
37
+ stream : TYPE
38
+ DESCRIPTION.
39
+
40
+ Returns
41
+ -------
42
+ branches : TYPE
43
+ DESCRIPTION.
44
+
45
+ """
46
+ # client, stream = item
47
+ bList = client.branch.list(stream.id)
48
+ branches = []
49
+ for b in bList:
50
+ branches.append(client.branch.get(stream.id, b.name))
51
+ return branches
52
+
53
+ @staticmethod
54
+ def SpeckleClientByHost(url, token):
55
+ """
56
+ Parameters
57
+ ----------
58
+ url : TYPE
59
+ DESCRIPTION.
60
+ token : TYPE
61
+ DESCRIPTION.
62
+
63
+ Returns
64
+ -------
65
+ client : TYPE
66
+ DESCRIPTION.
67
+
68
+ """
69
+ # url, token = item
70
+ client = SpeckleClient(host=url) # or whatever your host is
71
+ client.authenticate_with_token(token)
72
+ return client
73
+
74
+ @staticmethod
75
+ def SpeckleClientByURL(url, token):
76
+ """
77
+ Parameters
78
+ ----------
79
+ url : TYPE
80
+ DESCRIPTION.
81
+ token : TYPE
82
+ DESCRIPTION.
83
+
84
+ Returns
85
+ -------
86
+ client : TYPE
87
+ DESCRIPTION.
88
+
89
+ """
90
+ # url, token = item
91
+ # provide any stream, branch, commit, object, or globals url
92
+ wrapper = StreamWrapper(url)
93
+ client = wrapper.get_client()
94
+ client.authenticate_with_token(token)
95
+ return client
96
+
97
+ @staticmethod
98
+ def SpeckleCommitByID(commit_list, commit_id):
99
+ """
100
+ Parameters
101
+ ----------
102
+ commit_list : TYPE
103
+ DESCRIPTION.
104
+ commit_id : TYPE
105
+ DESCRIPTION.
106
+
107
+ Returns
108
+ -------
109
+ commit : TYPE
110
+ DESCRIPTION.
111
+
112
+ """
113
+ # commit_list, commit_id = item
114
+ for commit in commit_list:
115
+ if commit.id == commit_id:
116
+ return commit
117
+ return None
118
+
119
+ @staticmethod
120
+ def SpeckleCommitByURL(url, token):
121
+ """
122
+ Parameters
123
+ ----------
124
+ url : TYPE
125
+ DESCRIPTION.
126
+ token : TYPE
127
+ DESCRIPTION.
128
+
129
+ Returns
130
+ -------
131
+ commit : TYPE
132
+ DESCRIPTION.
133
+
134
+ """
135
+ # url, token = item
136
+
137
+ def streamByID(item):
138
+ stream_list, stream_id = item
139
+ for stream in stream_list:
140
+ if stream.id == stream_id:
141
+ return stream
142
+ return None
143
+
144
+ def streamsByClient(client):
145
+ return client.stream.list()
146
+
147
+ def commitByID(item):
148
+ commit_list, commit_id = item
149
+ for commit in commit_list:
150
+ if commit.id == commit_id:
151
+ return commit
152
+ return None
153
+
154
+ # provide any stream, branch, commit, object, or globals url
155
+ wrapper = StreamWrapper(url)
156
+ client = wrapper.get_client()
157
+ client.authenticate_with_token(token)
158
+ print("Client", client)
159
+ streams = streamsByClient(client)
160
+ print("Streams", streams)
161
+ stream = streamByID([streams, wrapper.stream_id])
162
+ print("Stream", stream)
163
+ commits = client.commit.list(wrapper.stream_id)
164
+ commit = commitByID([commits, wrapper.commit_id])
165
+ print(commit)
166
+ return commit
167
+
168
+ @staticmethod
169
+ def SpeckleCommitDelete(client, stream, commit, confirm):
170
+ """
171
+ Parameters
172
+ ----------
173
+ client : TYPE
174
+ DESCRIPTION.
175
+ stream : TYPE
176
+ DESCRIPTION.
177
+ commit : TYPE
178
+ DESCRIPTION.
179
+ confirm : TYPE
180
+ DESCRIPTION.
181
+
182
+ Returns
183
+ -------
184
+ TYPE
185
+ DESCRIPTION.
186
+
187
+ """
188
+ # client, stream, commit, confirm = item
189
+ if confirm:
190
+ try:
191
+ deleted = client.commit.delete(stream_id=stream.id, commit_id=commit.id)
192
+ return deleted
193
+ except:
194
+ return False
195
+ return False
196
+
197
+ @staticmethod
198
+ def SpeckleCommitsByBranch(item):
199
+ """
200
+ Parameters
201
+ ----------
202
+ item : TYPE
203
+ DESCRIPTION.
204
+
205
+ Returns
206
+ -------
207
+ TYPE
208
+ DESCRIPTION.
209
+
210
+ """
211
+ return item.commits.items
212
+
213
+ @staticmethod
214
+ def SpeckleGlobalsByStream(client, stream):
215
+ """
216
+ Parameters
217
+ ----------
218
+ client : TYPE
219
+ DESCRIPTION.
220
+ stream : TYPE
221
+ DESCRIPTION.
222
+
223
+ Returns
224
+ -------
225
+ TYPE
226
+ DESCRIPTION.
227
+
228
+ """
229
+ # client, stream = item
230
+
231
+ def processBase(base):
232
+ dictionary = {}
233
+ dynamic_member_names = base.get_dynamic_member_names()
234
+ for dynamic_member_name in dynamic_member_names:
235
+ attribute = base[dynamic_member_name]
236
+ if isinstance(attribute, float) or isinstance(attribute, int) or isinstance(attribute, str) or isinstance(attribute, list):
237
+ dictionary[dynamic_member_name] = attribute
238
+ if isinstance(attribute, Base):
239
+ dictionary[dynamic_member_name] = processBase(attribute)
240
+ return dictionary
241
+
242
+ transport = ServerTransport(client=client, stream_id=stream.id)
243
+
244
+ # get the `globals` branch
245
+ branch = client.branch.get(stream.id, "globals")
246
+
247
+ # get the latest commit
248
+ if len(branch.commits.items) > 0:
249
+ latest_commit = branch.commits.items[0]
250
+
251
+ # receive the globals object
252
+ globs = operations.receive(latest_commit.referencedObject, transport)
253
+ return processBase(globs)
254
+ return None
255
+
256
+ @staticmethod
257
+ def SpeckleSend(client, stream, branch, description, message, key, data, run):
258
+ """
259
+ Parameters
260
+ ----------
261
+ client : TYPE
262
+ DESCRIPTION.
263
+ stream : TYPE
264
+ DESCRIPTION.
265
+ branch : TYPE
266
+ DESCRIPTION.
267
+ description : TYPE
268
+ DESCRIPTION.
269
+ message : TYPE
270
+ DESCRIPTION.
271
+ key : TYPE
272
+ DESCRIPTION.
273
+ data : TYPE
274
+ DESCRIPTION.
275
+ run : TYPE
276
+ DESCRIPTION.
277
+
278
+ Returns
279
+ -------
280
+ commit : TYPE
281
+ DESCRIPTION.
282
+
283
+ """
284
+ # client, stream, branch, description, message, key, data, run = item
285
+ if not run:
286
+ return None
287
+ # create a base object to hold data
288
+ base = Base()
289
+ base[key] = data
290
+ transport = ServerTransport(stream.id, client)
291
+ # and send the data to the server and get back the hash of the object
292
+ obj_id = operations.send(base, [transport])
293
+
294
+ # now create a commit on that branch with your updated data!
295
+ commit_id = client.commit.create(
296
+ stream.id,
297
+ obj_id,
298
+ "gbxml",
299
+ message=message,
300
+ )
301
+ print("COMMIT ID", commit_id)
302
+ for commit in branch.commits.items:
303
+ print(" VS. COMMIT.ID", commit.id)
304
+ if commit.id == commit_id:
305
+ return commit
306
+ return None
307
+
308
+
309
+ @staticmethod
310
+ def SpeckleSendObjects(client, stream, branch, description, message, key, data, run):
311
+ """
312
+ Parameters
313
+ ----------
314
+ client : TYPE
315
+ DESCRIPTION.
316
+ stream : TYPE
317
+ DESCRIPTION.
318
+ branch : TYPE
319
+ DESCRIPTION.
320
+ description : TYPE
321
+ DESCRIPTION.
322
+ message : TYPE
323
+ DESCRIPTION.
324
+ key : TYPE
325
+ DESCRIPTION.
326
+ data : TYPE
327
+ DESCRIPTION.
328
+ run : TYPE
329
+ DESCRIPTION.
330
+
331
+ Returns
332
+ -------
333
+ commit : TYPE
334
+ DESCRIPTION.
335
+
336
+ """
337
+ # client, stream, branch, description, message, key, data, run = item
338
+ if not run:
339
+ return None
340
+ # create a base object to hold data
341
+ base = Base()
342
+ base[key] = data
343
+ transport = ServerTransport(stream.id, client)
344
+ # and send the data to the server and get back the hash of the object
345
+ obj_id = operations.send(base, [transport])
346
+
347
+ # now create a commit on that branch with your updated data!
348
+ commit_id = client.commit.create(
349
+ stream.id,
350
+ obj_id,
351
+ "gbxml",
352
+ message=message,
353
+ )
354
+ print("COMMIT ID", commit_id)
355
+ for commit in branch.commits.items:
356
+ print(" VS. COMMIT.ID", commit.id)
357
+ if commit.id == commit_id:
358
+ return commit
359
+ return None
360
+
361
+ @staticmethod
362
+ def SpeckleStreamByID(stream_list, stream_id):
363
+ """
364
+ Parameters
365
+ ----------
366
+ stream_list : TYPE
367
+ DESCRIPTION.
368
+ stream_id : TYPE
369
+ DESCRIPTION.
370
+
371
+ Returns
372
+ -------
373
+ stream : TYPE
374
+ DESCRIPTION.
375
+
376
+ """
377
+ # stream_list, stream_id = item
378
+ for stream in stream_list:
379
+ if stream.id == stream_id:
380
+ return stream
381
+ return None
382
+
383
+ @staticmethod
384
+ def SpeckleStreamByURL(url, token):
385
+ """
386
+ Parameters
387
+ ----------
388
+ url : TYPE
389
+ DESCRIPTION.
390
+ token : TYPE
391
+ DESCRIPTION.
392
+
393
+ Returns
394
+ -------
395
+ stream : TYPE
396
+ DESCRIPTION.
397
+
398
+ """
399
+ # url, token = item
400
+
401
+ def streamByID(item):
402
+ stream_list, stream_id = item
403
+ for stream in stream_list:
404
+ if stream.id == stream_id:
405
+ return stream
406
+ return None
407
+
408
+ def streamsByClient(client):
409
+ return client.stream.list()
410
+
411
+ # provide any stream, branch, commit, object, or globals url
412
+ wrapper = StreamWrapper(url)
413
+ client = wrapper.get_client()
414
+ client.authenticate_with_token(token)
415
+ streams = streamsByClient(client)
416
+ stream = streamByID([streams, wrapper.stream_id])
417
+ return stream
418
+
419
+ @staticmethod
420
+ def SpeckleStreamsByClient(item):
421
+ """
422
+ Parameters
423
+ ----------
424
+ item : TYPE
425
+ DESCRIPTION.
426
+
427
+ Returns
428
+ -------
429
+ TYPE
430
+ DESCRIPTION.
431
+
432
+ """
433
+ return item.stream.list()