topologicpy 0.7.52__py3-none-any.whl → 0.7.54__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/Face.py CHANGED
@@ -276,7 +276,7 @@ class Face():
276
276
  return face
277
277
 
278
278
  @staticmethod
279
- def ByOffset(face, 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):
279
+ def ByOffset(face, 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, epsilon: float = 0.01, tolerance: float = 0.0001, silent: bool = False, numWorkers: int = None):
280
280
  """
281
281
  Creates an offset face from the input face. A positive offset value results in an offset to the interior of an anti-clockwise face.
282
282
 
@@ -302,10 +302,15 @@ class Face():
302
302
  If set to True, the direction of offsets is reversed. Otherwise, it is not. The default is False.
303
303
  transferDictionaries : bool , optional
304
304
  If set to True, the dictionaries of the original wire, its edges, and its vertices are transfered to the new wire. Otherwise, they are not. The default is False.
305
+ epsilon : float , optional
306
+ The desired epsilon (another form of tolerance for shortest edge to remove). The default is 0.01. (This is set to a larger number as it was found to work better)
305
307
  tolerance : float , optional
306
308
  The desired tolerance. The default is 0.0001.
307
309
  silent : bool , optional
308
310
  If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
311
+ numWorkers : int , optional
312
+ Number of workers run in parallel to process. If you set it to 1, no parallel processing will take place.
313
+ The default is None which causes the algorithm to use twice the number of cpu cores in the host computer.
309
314
 
310
315
  Returns
311
316
  -------
@@ -338,8 +343,10 @@ class Face():
338
343
  reverse=reverse,
339
344
  bisectors=bisectors,
340
345
  transferDictionaries=transferDictionaries,
346
+ epsilon=epsilon,
341
347
  tolerance=tolerance,
342
- silent=silent)
348
+ silent=silent,
349
+ numWorkers=numWorkers)
343
350
  offset_internal_boundaries = []
344
351
  for internal_boundary in internal_boundaries:
345
352
  offset_internal_boundary = Wire.ByOffset(internal_boundary,
@@ -352,8 +359,10 @@ class Face():
352
359
  reverse=reverse,
353
360
  bisectors=bisectors,
354
361
  transferDictionaries=transferDictionaries,
362
+ epsilon=epsilon,
355
363
  tolerance=tolerance,
356
- silent=silent)
364
+ silent=silent,
365
+ numWorkers=numWorkers)
357
366
  offset_internal_boundaries.append(offset_internal_boundary)
358
367
 
359
368
  if bisectors == True:
@@ -367,8 +376,10 @@ class Face():
367
376
  reverse=reverse,
368
377
  bisectors=False,
369
378
  transferDictionaries=transferDictionaries,
379
+ epsilon=epsilon,
370
380
  tolerance=tolerance,
371
- silent=silent)
381
+ silent=silent,
382
+ numWorkers=numWorkers)
372
383
  all_edges = Topology.Edges(offset_external_boundary)+[Topology.Edges(ib) for ib in offset_internal_boundaries]
373
384
  all_edges += Topology.Edges(face)
374
385
  all_edges = Helper.Flatten(all_edges)
topologicpy/PyG.py CHANGED
@@ -176,7 +176,12 @@ class CustomGraphDataset(Dataset):
176
176
  if self.graph_level:
177
177
  label_value = self.graph_df[self.graph_df['graph_id'] == graph_id]['label'].values[0]
178
178
 
179
- if isinstance(label_value, int):
179
+ if isinstance(label_value, np.int64):
180
+ label_value = int(label_value)
181
+ if isinstance(label_value, np.float64):
182
+ label_value = float(label_value)
183
+
184
+ if isinstance(label_value, int) or isinstance(label_value, np.int64):
180
185
  y = torch.tensor([label_value], dtype=torch.long)
181
186
  elif isinstance(label_value, float):
182
187
  y = torch.tensor([label_value], dtype=torch.float)
topologicpy/Topology.py CHANGED
@@ -8799,7 +8799,7 @@ class Topology():
8799
8799
  for selector in selectors:
8800
8800
  d = Vertex.Distance(selector, vertex)
8801
8801
  if d < tolerance:
8802
- vertex = Topology.SetDictionary(vertex, Topology.Dictionary(selector))
8802
+ vertex = Topology.SetDictionary(vertex, Topology.Dictionary(selector), silent=True)
8803
8803
  break
8804
8804
  if tranEdges == True:
8805
8805
  edges = Topology.Edges(object)
@@ -8807,6 +8807,7 @@ class Topology():
8807
8807
  for edge in edges:
8808
8808
  d = Vertex.Distance(selector, edge)
8809
8809
  if d < tolerance:
8810
+
8810
8811
  edge = Topology.SetDictionary(edge, Topology.Dictionary(selector), silent=True)
8811
8812
  break
8812
8813
  if tranFaces == True:
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, numWorkers: int = None):
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, epsilon: float = 0.01, 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
 
@@ -336,6 +336,8 @@ class Wire():
336
336
  If set to True, The bisectors (seams) edges will be included in the returned wire. The default is False.
337
337
  transferDictionaries : bool , optional
338
338
  If set to True, the dictionaries of the original wire, its edges, and its vertices are transfered to the new wire. Otherwise, they are not. The default is False.
339
+ epsilon : float , optional
340
+ The desired epsilon (another form of tolerance for shortest edge to remove). The default is 0.01. (This is set to a larger number as it was found to work better)
339
341
  tolerance : float , optional
340
342
  The desired tolerance. The default is 0.0001.
341
343
  silent : bool , optional
@@ -361,34 +363,6 @@ class Wire():
361
363
  from topologicpy.Vector import Vector
362
364
  from topologicpy.Helper import Helper
363
365
 
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
391
-
392
366
  if not Topology.IsInstance(wire, "Wire"):
393
367
  if not silent:
394
368
  print("Wire.ByOffset - Error: The input wire parameter is not a valid wire. Returning None.")
@@ -519,19 +493,23 @@ class Wire():
519
493
  bisectors_list.append(Edge.ByVertices(v_a, v1))
520
494
 
521
495
 
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))
496
+ # wire_edges = []
497
+ # for i in range(len(final_vertices)-1):
498
+ # v1 = final_vertices[i]
499
+ # v2 = final_vertices[i+1]
500
+ # w_e = Edge.ByVertices(v1,v2)
501
+ # #w_e = Edge.SetLength(w_e, Edge.Length(w_e)+(2*epsilon), bothSides = True)
502
+ # wire_edges.append(w_e)
503
+ # if Wire.IsClosed(wire):
504
+ # v1 = final_vertices[-1]
505
+ # v2 = final_vertices[0]
506
+ # #w_e = Edge.SetLength(w_e, Edge.Length(w_e)+(2*epsilon), bothSides = True)
507
+ # wire_edges.append(w_e)
531
508
 
532
509
  return_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire))
510
+ #wire_edges = Topology.Edges(wire_edges)
511
+ wire_edges = [Edge.SetLength(w_e, Edge.Length(w_e)+(2*epsilon), bothSides=True) for w_e in Topology.Edges(return_wire)]
533
512
  return_wire_edges = Topology.Edges(return_wire)
534
- #wire_edges = Topology.Edges(return_wire)
535
513
  if transferDictionaries == True:
536
514
  if not len(wire_edges) == len(edge_dictionaries):
537
515
  if not silent:
@@ -553,7 +531,7 @@ class Wire():
553
531
  for edge in edges:
554
532
  d = Topology.Dictionary(edge)
555
533
  c = Topology.Centroid(edge)
556
- c = Topology.SetDictionary(c, d)
534
+ c = Topology.SetDictionary(c, d, silent=True)
557
535
  sel_edges.append(c)
558
536
  temp_return_wire = Topology.TransferDictionariesBySelectors(temp_return_wire, sel_vertices, tranVertices=True, numWorkers=numWorkers)
559
537
  temp_return_wire = Topology.TransferDictionariesBySelectors(temp_return_wire, sel_edges, tranEdges=True, numWorkers=numWorkers)
@@ -567,25 +545,31 @@ class Wire():
567
545
  if not Wire.IsManifold(return_wire) and bisectors == False:
568
546
  if not silent:
569
547
  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))
548
+ print("Wire.ByOffset - Warning: Pursuing a workaround, but it might take a longer to complete.")
549
+
550
+ #cycles = Wire.Cycles(return_wire, maxVertices = len(final_vertices))
551
+ temp_wire = Topology.SelfMerge(Cluster.ByTopologies(wire_edges))
552
+ cycles = Wire.Cycles(temp_wire, maxVertices = len(final_vertices))
572
553
  distances = []
573
554
  for cycle in cycles:
574
- #cycle_face = Face.ByWire(cycle)
575
555
  cycle_centroid = Topology.Centroid(cycle)
576
556
  distance = Vertex.Distance(origin, cycle_centroid)
577
557
  distances.append(distance)
578
558
  cycles = Helper.Sort(cycles, distances)
579
- return_cycle = Wire.Reverse(cycles[0])
559
+ # Get the top three or less
560
+ cycles = cycles[:min(3, len(cycles))]
561
+ areas = [Face.Area(Face.ByWire(cycle)) for cycle in cycles]
562
+ cycles = Helper.Sort(cycles, areas)
563
+ return_cycle = Wire.Reverse(cycles[-1])
564
+ return_cycle = Wire.Simplify(return_cycle, tolerance=epsilon)
565
+ return_cycle = Wire.RemoveCollinearEdges(return_cycle)
580
566
  sel_edges = []
581
567
  for temp_edge in wire_edges:
582
568
  x = Topology.Centroid(temp_edge)
583
569
  d = Topology.Dictionary(temp_edge)
584
- x = Topology.SetDictionary(x, d)
570
+ x = Topology.SetDictionary(x, d, silent=True)
585
571
  sel_edges.append(x)
586
- print("Transfering Vertex Dictionaries")
587
572
  return_cycle = Topology.TransferDictionariesBySelectors(return_cycle, Topology.Vertices(return_wire), tranVertices=True, tolerance=tolerance, numWorkers=numWorkers)
588
- print("Transfering Edge Dictionaries")
589
573
  return_cycle = Topology.TransferDictionariesBySelectors(return_cycle, sel_edges, tranEdges=True, tolerance=tolerance, numWorkers=numWorkers)
590
574
  return_wire = return_cycle
591
575
  return_wire = Topology.Unflatten(return_wire, direction=normal, origin=origin)
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.52'
1
+ __version__ = '0.7.54'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.52
3
+ Version: 0.7.54
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
@@ -9,7 +9,7 @@ topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
9
9
  topologicpy/Dictionary.py,sha256=X_WARSYtWtYIsEUKdLH-plZmGZ3pHz_FBFxxeHGHdrU,27065
10
10
  topologicpy/Edge.py,sha256=vhYHkobSLGSWV-oe2oJFFDobqFToDyb7s71yQ840AAA,65166
11
11
  topologicpy/EnergyModel.py,sha256=XcCP55VW5WHDIIKcURijmBOZEgNUDEn_V9h5EejkntA,53876
12
- topologicpy/Face.py,sha256=7GCYo4ATkMW1skiv4gXOVARM29A7Buim9lTQu57B22Y,115489
12
+ topologicpy/Face.py,sha256=YjU6TxxW2Mf5InumMvzXUXVVRdtjxyRGauRIhGXzkao,116411
13
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
@@ -18,18 +18,18 @@ topologicpy/Matrix.py,sha256=umgR7An919-wGInXJ1wpqnoQ2jCPdyMe2rcWTZ16upk,8079
18
18
  topologicpy/Neo4j.py,sha256=YvtF7RYUMATEZ8iHwFwK_MOxEDyARby2DTI2CCK6-cI,19694
19
19
  topologicpy/Plotly.py,sha256=Aaq6D9D7gov5OrfoKLs_j3LJfdkCC-Gh8GaU5n2UOGQ,106199
20
20
  topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
21
- topologicpy/PyG.py,sha256=3U59QObO56EBwrvaplGeLZhbTao0gJCYhWm3oTpjFAE,109505
21
+ topologicpy/PyG.py,sha256=LU9LCCzjxGPUM31qbaJXZsTvniTtgugxJY7y612t4A4,109757
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=ZhfTwA-qwgISDJftRVB1l5DdbfI4fMBJ0kNbH2WFQMs,419038
25
+ topologicpy/Topology.py,sha256=q-RMY4i0Ub7LmJOmh14hf4GoHJ2TF5YN4YtkhUN_z-s,419052
26
26
  topologicpy/Vector.py,sha256=WQQUbwrg7VKImtxuBUi2i-FRiPT77WlrzLP05gdXKM8,33079
27
27
  topologicpy/Vertex.py,sha256=bLY60YWoMsgCgHk7F7k9F93Sq2FJ6AzUcTfJ83NZfHA,71107
28
- topologicpy/Wire.py,sha256=POd3_jjSXsLV6OiH6PvGZvA3AS5OpesDI5Fahn59daI,158034
28
+ topologicpy/Wire.py,sha256=OoPb7SJl0VpZDZpGL0-VkYJ35zPANS7gHDt9tixOSxc,157629
29
29
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
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,,
30
+ topologicpy/version.py,sha256=QSD1X6KT5Pd5JrzAuS4UG70OK1cKLrNByM8LpoGYluI,23
31
+ topologicpy-0.7.54.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
32
+ topologicpy-0.7.54.dist-info/METADATA,sha256=TCoA8opbxCAdgeBy9D49fzOIFXzclFi8w6LDHLKU9RA,10918
33
+ topologicpy-0.7.54.dist-info/WHEEL,sha256=uCRv0ZEik_232NlR4YDw4Pv3Ajt5bKvMH13NUU7hFuI,91
34
+ topologicpy-0.7.54.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
35
+ topologicpy-0.7.54.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.0)
2
+ Generator: setuptools (74.1.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5