topologicpy 0.8.71__py3-none-any.whl → 0.8.72__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.
topologicpy/Topology.py CHANGED
@@ -224,9 +224,17 @@ class Topology():
224
224
  The input topology with the apertures added to it.
225
225
 
226
226
  """
227
+ from topologicpy.Vertex import Vertex
227
228
  from topologicpy.Dictionary import Dictionary
228
229
  from topologicpy.BVH import BVH
229
230
 
231
+ def best_candidate(aperture, candidates, tolerance=0.0001):
232
+ ap_iv = Topology.InternalVertex(aperture)
233
+ for candidate in candidates:
234
+ if Vertex.IsInternal(ap_iv, candidate, tolerance=tolerance):
235
+ return candidate
236
+ return None
237
+
230
238
  if not Topology.IsInstance(topology, "Topology"):
231
239
  print("Topology.AddApertures - Error: The input topology parameter is not a valid topology. Returning None.")
232
240
  return None
@@ -256,16 +264,20 @@ class Topology():
256
264
  bvh = BVH.ByTopologies(Topology.SubTopologies(topology, subTopologyType=subTopologyType), silent=True)
257
265
  used = []
258
266
  for aperture in apertures:
259
- result = BVH.Clashes(bvh, aperture)
260
- if isinstance(result, list):
261
- if len(result) > 0:
262
- subTopology = result[0]
263
- if Topology.IsInstance(subTopology, "topology"):
264
- used.append(subTopology)
265
- if exclusive == True:
266
- if subTopology in used:
267
- continue
268
- subTopology = Topology.AddContent(subTopology, [aperture], subTopologyType="self", tolerance=tolerance)
267
+ candidates = BVH.Clashes(bvh, aperture)
268
+ if isinstance(candidates, list):
269
+ if len(candidates) == 0:
270
+ return topology
271
+ elif len(candidates) == 1:
272
+ subTopology = candidates[0]
273
+ if len(candidates) > 0:
274
+ subTopology = best_candidate(aperture, candidates, tolerance=tolerance)
275
+ if Topology.IsInstance(subTopology, "topology"):
276
+ used.append(subTopology)
277
+ if exclusive == True:
278
+ if subTopology in used:
279
+ continue
280
+ subTopology = Topology.AddContent(subTopology, [aperture], subTopologyType="self", tolerance=tolerance)
269
281
  return topology
270
282
 
271
283
  @staticmethod
@@ -292,6 +304,8 @@ class Topology():
292
304
  """
293
305
 
294
306
  from topologicpy.Context import Context
307
+ from topologicpy.Dictionary import Dictionary
308
+
295
309
 
296
310
  if not Topology.IsInstance(topology, "Topology"):
297
311
  print("Topology.AddContent - Error: the input topology parameter is not a valid topology. Returning None.")
@@ -311,14 +325,20 @@ class Topology():
311
325
  if not subTopologyType.lower() in ["self", "cellcomplex", "cell", "shell", "face", "wire", "edge", "vertex"]:
312
326
  print("Topology.AddContent - Error: the input subtopology type parameter is not a recognized type. Returning None.")
313
327
  return None
328
+
329
+ copy_contents = [Topology.Copy(x) for x in contents]
330
+ for i, content in enumerate(contents):
331
+ d = Topology.Dictionary(content)
332
+ copy_contents[i] = Topology.SetDictionary(copy_contents[i], d)
333
+
314
334
  if subTopologyType.lower() == "self":
315
335
  context = Context.ByTopologyParameters(topology)
316
- for content in contents:
336
+ for content in copy_contents:
317
337
  content.AddContext(context) # Hook to Core
318
338
  topology.AddContent(content) # Hook to Core
319
339
  else:
320
340
  t = Topology.TypeID(subTopologyType)
321
- topology.AddContents(contents, t) # Hook to Core
341
+ topology.AddContents(copy_contents, t) # Hook to Core
322
342
  return topology
323
343
 
324
344
  @staticmethod
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.8.71'
1
+ __version__ = '0.8.72'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: topologicpy
3
- Version: 0.8.71
3
+ Version: 0.8.72
4
4
  Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
5
5
  Author-email: Wassim Jabi <wassim.jabi@gmail.com>
6
6
  License: AGPL v3 License
@@ -26,14 +26,14 @@ topologicpy/ShapeGrammar.py,sha256=KYsKDLXWdflAcYMAIz84AUF-GMkbTmaBDd2-ovbilqU,2
26
26
  topologicpy/Shell.py,sha256=JBTw3T1CjJt3ZPTjG1eBU2Oe2n_helW9ioML_bYK2_U,98545
27
27
  topologicpy/Speckle.py,sha256=-eiTqJugd7pHiHpD3pDUcDO6CGhVyPV14HFRzaqEoaw,18187
28
28
  topologicpy/Sun.py,sha256=8S6dhCKfOhUGVny-jEk87Q08anLYMB1JEBKRGCklvbQ,36670
29
- topologicpy/Topology.py,sha256=9reHlXzUXYbXt0FJbThL3Wr0JEF2oAHuNRerU2BshxM,473587
29
+ topologicpy/Topology.py,sha256=BC9JYfxComyAzmXrPdhmXlaFBGmZ_x7-oHl579E4qUY,474458
30
30
  topologicpy/Vector.py,sha256=pEC8YY3TeHGfGdeNgvdHjgMDwxGabp5aWjwYC1HSvMk,42236
31
31
  topologicpy/Vertex.py,sha256=eO74ZcuQUmiEHy5-Xyn7YDlt3R7YKoqB-BEwF-TUcDM,94101
32
32
  topologicpy/Wire.py,sha256=gjgQUGHdBdXUIijgZc_VIW0E39w-smaVhhdl0jF63fQ,230466
33
33
  topologicpy/__init__.py,sha256=RMftibjgAnHB1vdL-muo71RwMS4972JCxHuRHOlU428,928
34
- topologicpy/version.py,sha256=49ezdJH-CaZn_7E1pYgol2MJ6KVA4JWjsEILF4g69nI,23
35
- topologicpy-0.8.71.dist-info/licenses/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
36
- topologicpy-0.8.71.dist-info/METADATA,sha256=eJ0CeTYd_RvHdNXNjmyK1IRQzZqzuEDmqSuwbdLAGEY,10535
37
- topologicpy-0.8.71.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- topologicpy-0.8.71.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
39
- topologicpy-0.8.71.dist-info/RECORD,,
34
+ topologicpy/version.py,sha256=5keU0mboyFEsP7wnOuJd2VXsHYJviiaVppSSn9IAZJE,23
35
+ topologicpy-0.8.72.dist-info/licenses/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
36
+ topologicpy-0.8.72.dist-info/METADATA,sha256=Ivpypd-BnC6KU2xhc4Q-rsaQpAaFoLWseDSd_NfUYuo,10535
37
+ topologicpy-0.8.72.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ topologicpy-0.8.72.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
39
+ topologicpy-0.8.72.dist-info/RECORD,,