topologicpy 0.7.51__py3-none-any.whl → 0.7.52__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/Graph.py CHANGED
@@ -2177,6 +2177,12 @@ class Graph:
2177
2177
  for ifc_rel in ifc_relationships:
2178
2178
  source = None
2179
2179
  destinations = []
2180
+ if ifc_rel.is_a("IfcRelConnectsPorts"):
2181
+ source = ifc_rel.RelatingPort
2182
+ destinations = ifc_rel.RelatedPorts
2183
+ if ifc_rel.is_a("IfcRelConnectsPortToElement"):
2184
+ source = ifc_rel.RelatingPort
2185
+ destinations = [ifc_rel.RelatedElement]
2180
2186
  if ifc_rel.is_a("IfcRelAggregates"):
2181
2187
  source = ifc_rel.RelatingObject
2182
2188
  destinations = ifc_rel.RelatedObjects
topologicpy/Plotly.py CHANGED
@@ -635,7 +635,7 @@ class Plotly:
635
635
  labels = []
636
636
  groupList = []
637
637
  label = ""
638
- group = ""
638
+ group = None
639
639
  if labelKey or groupKey:
640
640
  if groups:
641
641
  if len(groups) > 0:
@@ -655,7 +655,7 @@ class Plotly:
655
655
  y.append(v[1])
656
656
  z.append(v[2])
657
657
  label = ""
658
- group = ""
658
+ group = None
659
659
  if len(dictionaries) > 0:
660
660
  d = dictionaries[m]
661
661
  if d:
@@ -737,7 +737,7 @@ class Plotly:
737
737
  y+=[sv[1], ev[1], None] # y-coordinates of edge ends
738
738
  z+=[sv[2], ev[2], None] # z-coordinates of edge ends
739
739
  label = ""
740
- group = ""
740
+ group = None
741
741
  if len(dictionaries) > 0:
742
742
  d = dictionaries[m]
743
743
  if d:
topologicpy/Topology.py CHANGED
@@ -2475,9 +2475,9 @@ class Topology():
2475
2475
 
2476
2476
  # If no color is defined, return a consistent random color based on the entity type
2477
2477
  if "wall" in is_a:
2478
- color = (0.4, 0.4, 0.4)
2478
+ color = (175, 175, 175)
2479
2479
  elif "slab" in is_a:
2480
- color = (0.6, 0.6, 0.6)
2480
+ color = (200, 200, 200)
2481
2481
  elif "space" in is_a:
2482
2482
  color = (250, 250, 250)
2483
2483
  else:
@@ -8402,6 +8402,21 @@ class Topology():
8402
8402
  tran_mat = Vector.TransformationMatrix(up, direction)
8403
8403
  unflat_topology = Topology.Transform(topology, tran_mat)
8404
8404
  unflat_topology = Topology.Translate(unflat_topology, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
8405
+
8406
+ unflat_topology = Topology.SetDictionary(unflat_topology, Topology.Dictionary(topology), silent=True)
8407
+ unflat_vertices = Topology.Vertices(unflat_topology)
8408
+ vertices = Topology.Vertices(topology)
8409
+ unflat_edges = Topology.Edges(unflat_topology)
8410
+ edges = Topology.Edges(topology)
8411
+ faces = []
8412
+ unflat_faces = []
8413
+ if Topology.IsInstance(topology, "Face"):
8414
+ unflat_faces = Topology.Faces(unflat_topology)
8415
+ faces = Topology.Faces(topology)
8416
+ elements = vertices+edges+faces
8417
+ unflat_elements = unflat_vertices+unflat_edges+unflat_faces
8418
+ for i, f, in enumerate(unflat_elements):
8419
+ f = Topology.SetDictionary(f, Topology.Dictionary(elements[i]), silent=True)
8405
8420
  return unflat_topology
8406
8421
 
8407
8422
  @staticmethod
@@ -8763,8 +8778,8 @@ class Topology():
8763
8778
  tolerance : float , optional
8764
8779
  The desired tolerance. The default is 0.0001.
8765
8780
  numWorkers : int , optional
8766
- Number of workers run in parallel to process. The default is None which causes the algorithm to use twice the number of cpu cores in the host computer.
8767
-
8781
+ Number of workers run in parallel to process. If you set it to 1, no parallel processing will take place.
8782
+ The default is None which causes the algorithm to use twice the number of cpu cores in the host computer.
8768
8783
  Returns
8769
8784
  -------
8770
8785
  Topology
@@ -8775,6 +8790,42 @@ class Topology():
8775
8790
  from topologicpy.Dictionary import Dictionary
8776
8791
  from topologicpy.Cluster import Cluster
8777
8792
  from topologicpy.Plotly import Plotly
8793
+
8794
+
8795
+ def transfer_dictionaries_by_selectors(object, selectors, tranVertices=False, tranEdges=False, tranFaces=False, tranCells=False, tolerance=0.0001):
8796
+ if tranVertices == True:
8797
+ vertices = Topology.Vertices(object)
8798
+ for vertex in vertices:
8799
+ for selector in selectors:
8800
+ d = Vertex.Distance(selector, vertex)
8801
+ if d < tolerance:
8802
+ vertex = Topology.SetDictionary(vertex, Topology.Dictionary(selector))
8803
+ break
8804
+ if tranEdges == True:
8805
+ edges = Topology.Edges(object)
8806
+ for selector in selectors:
8807
+ for edge in edges:
8808
+ d = Vertex.Distance(selector, edge)
8809
+ if d < tolerance:
8810
+ edge = Topology.SetDictionary(edge, Topology.Dictionary(selector), silent=True)
8811
+ break
8812
+ if tranFaces == True:
8813
+ faces = Topology.Faces(object)
8814
+ for face in faces:
8815
+ for selector in selectors:
8816
+ d = Vertex.Distance(selector, face)
8817
+ if d < tolerance:
8818
+ face = Topology.SetDictionary(face, Topology.Dictionary(selector), silent=True)
8819
+ break
8820
+ if tranCells == True:
8821
+ cells = Topology.Cells(object)
8822
+ for cell in cells:
8823
+ for selector in selectors:
8824
+ if Vertex.IsInternal(selector, cell):
8825
+ cell = Topology.SetDictionary(cell, Topology.Dictionary(selector), silent=True)
8826
+ break
8827
+ return object
8828
+
8778
8829
  if not Topology.IsInstance(topology, "Topology"):
8779
8830
  print("Topology.TransferDictionariesBySelectors - Error: The input topology parameter is not a valid topology. Returning None.")
8780
8831
  return None
@@ -8788,6 +8839,9 @@ class Topology():
8788
8839
  if len(selectors_tmp) < 1:
8789
8840
  print("Topology.TransferDictionariesBySelectors - Error: The input selectors do not contain any valid topologies. Returning None.")
8790
8841
  return None
8842
+
8843
+ if numWorkers == 1:
8844
+ return transfer_dictionaries_by_selectors(topology, selectors, tranVertices=tranVertices, tranEdges=tranEdges, tranFaces=tranFaces, tranCells=tranCells, tolerance=tolerance)
8791
8845
  sinkEdges = []
8792
8846
  sinkFaces = []
8793
8847
  sinkCells = []
topologicpy/Wire.py CHANGED
@@ -310,7 +310,7 @@ class Wire():
310
310
  return Wire.ByEdges(edges, tolerance=tolerance)
311
311
 
312
312
  @staticmethod
313
- def ByOffset(wire, offset: float = 1.0, offsetKey: str = "offset", stepOffsetA: float = 0, stepOffsetB: float = 0, stepOffsetKeyA: str = "stepOffsetA", stepOffsetKeyB: str = "stepOffsetB", reverse: bool = False, bisectors: bool = False, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False):
313
+ def ByOffset(wire, offset: float = 1.0, offsetKey: str = "offset", stepOffsetA: float = 0, stepOffsetB: float = 0, stepOffsetKeyA: str = "stepOffsetA", stepOffsetKeyB: str = "stepOffsetB", reverse: bool = False, bisectors: bool = False, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False, numWorkers: int = None):
314
314
  """
315
315
  Creates an offset wire from the input wire. A positive offset value results in an offset to the interior of an anti-clockwise wire.
316
316
 
@@ -340,6 +340,10 @@ class Wire():
340
340
  The desired tolerance. The default is 0.0001.
341
341
  silent : bool , optional
342
342
  If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
343
+ numWorkers : int , optional
344
+ Number of workers run in parallel to process. If you set it to 1, no parallel processing will take place.
345
+ The default is None which causes the algorithm to use twice the number of cpu cores in the host computer.
346
+
343
347
 
344
348
  Returns
345
349
  -------
@@ -355,12 +359,43 @@ class Wire():
355
359
  from topologicpy.Cluster import Cluster
356
360
  from topologicpy.Topology import Topology
357
361
  from topologicpy.Vector import Vector
362
+ from topologicpy.Helper import Helper
363
+
364
+ def transfer_dictionaries_by_selectors(object, selectors, tranVertices=False, tranEdges=False, tranFaces=True, tolerance=0.0001):
365
+ if tranVertices == True:
366
+ vertices = Topology.Vertices(object)
367
+ for vertex in vertices:
368
+ for selector in selectors:
369
+ d = Vertex.Distance(selector, vertex)
370
+ if d < tolerance:
371
+ vertex = Topology.SetDictionary(vertex, Topology.Dictionary(selector), silent=True)
372
+ break
373
+ if tranEdges == True:
374
+ edges = Topology.Edges(object)
375
+ for edge in edges:
376
+ for selector in selectors:
377
+ d = Vertex.Distance(selector, edge)
378
+ if d < tolerance:
379
+ edge = Topology.SetDictionary(edge, Topology.Dictionary(selector), silent=True)
380
+ break
381
+
382
+ if tranFaces == True:
383
+ faces = Topology.Faces(object)
384
+ for face in faces:
385
+ for selector in selectors:
386
+ d = Vertex.Distance(selector, face)
387
+ if d < tolerance:
388
+ face = Topology.SetDictionary(face, Topology.Dictionary(selector), silent=True)
389
+ break
390
+ return object
358
391
 
359
392
  if not Topology.IsInstance(wire, "Wire"):
360
393
  if not silent:
361
394
  print("Wire.ByOffset - Error: The input wire parameter is not a valid wire. Returning None.")
362
395
  return None
363
396
 
397
+ temp_face = Face.ByWire(wire)
398
+ original_area = Face.Area(temp_face)
364
399
  if reverse == True:
365
400
  fac = -1
366
401
  else:
@@ -372,6 +407,7 @@ class Wire():
372
407
  flat_wire = Topology.Flatten(wire, direction=temp_normal, origin=origin)
373
408
  normal = Face.Normal(temp_face)
374
409
  flat_wire = Topology.Flatten(wire, direction=normal, origin=origin)
410
+ original_edges = Topology.Edges(wire)
375
411
  edges = Topology.Edges(flat_wire)
376
412
  original_edges = Topology.Edges(wire)
377
413
  offsets = []
@@ -482,16 +518,20 @@ class Wire():
482
518
  if bisectors == True:
483
519
  bisectors_list.append(Edge.ByVertices(v_a, v1))
484
520
 
485
- return_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire))
486
- if not Topology.IsInstance(return_wire, "Wire"):
487
- if not silent:
488
- print("Wire.ByOffset - Warning: The resulting wire is not well-formed, please check your offsets.")
489
- else:
490
- if not Wire.IsManifold(return_wire) and bisectors == False:
491
- if not silent:
492
- print("Wire.ByOffset - Warning: The resulting wire is non-manifold, please check your offsets.")
493
- wire_edges = Topology.Edges(return_wire)
494
521
 
522
+ wire_edges = []
523
+ for i in range(len(final_vertices)-1):
524
+ v1 = final_vertices[i]
525
+ v2 = final_vertices[i+1]
526
+ wire_edges.append(Edge.ByVertices(v1,v2))
527
+ if Wire.IsClosed(wire):
528
+ v1 = final_vertices[-1]
529
+ v2 = final_vertices[0]
530
+ wire_edges.append(Edge.ByVertices(v1,v2))
531
+
532
+ return_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire))
533
+ return_wire_edges = Topology.Edges(return_wire)
534
+ #wire_edges = Topology.Edges(return_wire)
495
535
  if transferDictionaries == True:
496
536
  if not len(wire_edges) == len(edge_dictionaries):
497
537
  if not silent:
@@ -502,8 +542,9 @@ class Wire():
502
542
  if len(edge_dictionaries) > 0:
503
543
  temp_dictionary = edge_dictionaries[min(i,len(edge_dictionaries)-1)]
504
544
  wire_edge = Topology.SetDictionary(wire_edge, temp_dictionary, silent=True)
545
+ return_wire_edges[i] = Topology.SetDictionary(return_wire_edges[i], temp_dictionary, silent=True)
505
546
  if bisectors == True:
506
- temp_return_wire = Topology.SelfMerge(Cluster.ByTopologies(Topology.Edges(return_wire)+bisectors_list))
547
+ temp_return_wire = Topology.SelfMerge(Cluster.ByTopologies(wire_edges+bisectors_list))
507
548
  if transferDictionaries == True:
508
549
  sel_vertices = Topology.Vertices(return_wire)
509
550
  sel_vertices += Topology.Vertices(flat_wire)
@@ -514,9 +555,39 @@ class Wire():
514
555
  c = Topology.Centroid(edge)
515
556
  c = Topology.SetDictionary(c, d)
516
557
  sel_edges.append(c)
517
- temp_return_wire = Topology.TransferDictionariesBySelectors(temp_return_wire, sel_vertices, tranVertices=True)
518
- temp_return_wire = Topology.TransferDictionariesBySelectors(temp_return_wire, sel_edges, tranEdges=True)
558
+ temp_return_wire = Topology.TransferDictionariesBySelectors(temp_return_wire, sel_vertices, tranVertices=True, numWorkers=numWorkers)
559
+ temp_return_wire = Topology.TransferDictionariesBySelectors(temp_return_wire, sel_edges, tranEdges=True, numWorkers=numWorkers)
560
+
519
561
  return_wire = temp_return_wire
562
+
563
+ if not Topology.IsInstance(return_wire, "Wire"):
564
+ if not silent:
565
+ print("Wire.ByOffset - Warning: The resulting wire is not well-formed, please check your offsets.")
566
+ else:
567
+ if not Wire.IsManifold(return_wire) and bisectors == False:
568
+ if not silent:
569
+ print("Wire.ByOffset - Warning: The resulting wire is non-manifold, please check your offsets.")
570
+ print("Pursuing a workaround, but it will take a LONG time.")
571
+ cycles = Wire.Cycles(return_wire, maxVertices = len(final_vertices))
572
+ distances = []
573
+ for cycle in cycles:
574
+ #cycle_face = Face.ByWire(cycle)
575
+ cycle_centroid = Topology.Centroid(cycle)
576
+ distance = Vertex.Distance(origin, cycle_centroid)
577
+ distances.append(distance)
578
+ cycles = Helper.Sort(cycles, distances)
579
+ return_cycle = Wire.Reverse(cycles[0])
580
+ sel_edges = []
581
+ for temp_edge in wire_edges:
582
+ x = Topology.Centroid(temp_edge)
583
+ d = Topology.Dictionary(temp_edge)
584
+ x = Topology.SetDictionary(x, d)
585
+ sel_edges.append(x)
586
+ print("Transfering Vertex Dictionaries")
587
+ return_cycle = Topology.TransferDictionariesBySelectors(return_cycle, Topology.Vertices(return_wire), tranVertices=True, tolerance=tolerance, numWorkers=numWorkers)
588
+ print("Transfering Edge Dictionaries")
589
+ return_cycle = Topology.TransferDictionariesBySelectors(return_cycle, sel_edges, tranEdges=True, tolerance=tolerance, numWorkers=numWorkers)
590
+ return_wire = return_cycle
520
591
  return_wire = Topology.Unflatten(return_wire, direction=normal, origin=origin)
521
592
  if transferDictionaries == True:
522
593
  return_wire = Topology.SetDictionary(return_wire, Topology.Dictionary(wire), silent=True)
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.51'
1
+ __version__ = '0.7.52'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.51
3
+ Version: 0.7.52
4
4
  Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
5
5
  Author-email: Wassim Jabi <wassim.jabi@gmail.com>
6
6
  License: MIT License
@@ -10,26 +10,26 @@ topologicpy/Dictionary.py,sha256=X_WARSYtWtYIsEUKdLH-plZmGZ3pHz_FBFxxeHGHdrU,270
10
10
  topologicpy/Edge.py,sha256=vhYHkobSLGSWV-oe2oJFFDobqFToDyb7s71yQ840AAA,65166
11
11
  topologicpy/EnergyModel.py,sha256=XcCP55VW5WHDIIKcURijmBOZEgNUDEn_V9h5EejkntA,53876
12
12
  topologicpy/Face.py,sha256=7GCYo4ATkMW1skiv4gXOVARM29A7Buim9lTQu57B22Y,115489
13
- topologicpy/Graph.py,sha256=1dtcE342b6d7cTiMbtUWWOud6Vu0vHaf4HP2eG_-iqg,402544
13
+ topologicpy/Graph.py,sha256=capDrtqrvNSyivrcRnHDIEGgO43ZxjqykeFiGBV3GIA,402880
14
14
  topologicpy/Grid.py,sha256=3-sn7CHWGcXk18XCnHjsUttNJTWwmN63g_Insj__p04,18218
15
15
  topologicpy/Helper.py,sha256=i-AfI29NMsZXBaymjilfvxQbuS3wpYbpPw4RWu1YCHs,16358
16
16
  topologicpy/Honeybee.py,sha256=vcBECJlgWVjNNdD9ZmjNik_pA1Y_ZNoOorsQb2CiyGA,21965
17
17
  topologicpy/Matrix.py,sha256=umgR7An919-wGInXJ1wpqnoQ2jCPdyMe2rcWTZ16upk,8079
18
18
  topologicpy/Neo4j.py,sha256=YvtF7RYUMATEZ8iHwFwK_MOxEDyARby2DTI2CCK6-cI,19694
19
- topologicpy/Plotly.py,sha256=gfGadsDBgXOeefzzceXkVshqONuPtkGiW-XNVuT2rrA,106193
19
+ topologicpy/Plotly.py,sha256=Aaq6D9D7gov5OrfoKLs_j3LJfdkCC-Gh8GaU5n2UOGQ,106199
20
20
  topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
21
21
  topologicpy/PyG.py,sha256=3U59QObO56EBwrvaplGeLZhbTao0gJCYhWm3oTpjFAE,109505
22
22
  topologicpy/Shell.py,sha256=joahFtpRQTWJpQOmi3qU4Xe0Sx2XXeayHlXTNx8CzMk,87610
23
23
  topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
24
24
  topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
25
- topologicpy/Topology.py,sha256=100DUg9EUcFg3K9wlNdaKrXcFEZLvqHsexs3R-8pbYw,416196
25
+ topologicpy/Topology.py,sha256=ZhfTwA-qwgISDJftRVB1l5DdbfI4fMBJ0kNbH2WFQMs,419038
26
26
  topologicpy/Vector.py,sha256=WQQUbwrg7VKImtxuBUi2i-FRiPT77WlrzLP05gdXKM8,33079
27
27
  topologicpy/Vertex.py,sha256=bLY60YWoMsgCgHk7F7k9F93Sq2FJ6AzUcTfJ83NZfHA,71107
28
- topologicpy/Wire.py,sha256=h-vcKAuyHVvfX34nJx4bVF-AxeaUCx4NbVzGBq98M9o,154201
28
+ topologicpy/Wire.py,sha256=POd3_jjSXsLV6OiH6PvGZvA3AS5OpesDI5Fahn59daI,158034
29
29
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
30
- topologicpy/version.py,sha256=Nl_BpJIhLQbbkeSiv2q5IgytCINu26pAUqkPjuq0FPg,23
31
- topologicpy-0.7.51.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
32
- topologicpy-0.7.51.dist-info/METADATA,sha256=E68AdA4I73vasiialUPW6sDhhX4xFhYSwysUl_7ZR1g,10918
33
- topologicpy-0.7.51.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
34
- topologicpy-0.7.51.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
35
- topologicpy-0.7.51.dist-info/RECORD,,
30
+ topologicpy/version.py,sha256=ojid7jrMog3tWPPKrqrquVx5_TXLYp_7tfVq6IeQYaE,23
31
+ topologicpy-0.7.52.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
32
+ topologicpy-0.7.52.dist-info/METADATA,sha256=q3XykClIfWtok_A1P6zYFpjyA4yHUJGNhcStZyOjAeM,10918
33
+ topologicpy-0.7.52.dist-info/WHEEL,sha256=ixB2d4u7mugx_bCBycvM9OzZ5yD7NmPXFRtKlORZS2Y,91
34
+ topologicpy-0.7.52.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
35
+ topologicpy-0.7.52.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.0.0)
2
+ Generator: setuptools (74.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5