topologicpy 0.7.50__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/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,14 +407,16 @@ 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)
412
+ original_edges = Topology.Edges(wire)
376
413
  offsets = []
377
414
  offset_edges = []
378
415
  final_vertices = []
379
416
  bisectors_list = []
380
417
  edge_dictionaries = []
381
- for edge in edges:
382
- d = Topology.Dictionary(edge)
418
+ for i, edge in enumerate(edges):
419
+ d = Topology.Dictionary(original_edges[i])
383
420
  d_offset = Dictionary.ValueAtKey(d, offsetKey)
384
421
  if d_offset == None:
385
422
  d_offset = offset
@@ -406,7 +443,7 @@ class Wire():
406
443
  if bisectors == True:
407
444
  bisectors_list.append(Edge.ByVertices(v_a, v1))
408
445
  if transferDictionaries == True:
409
- v1 = Topology.SetDictionary(v1, Topology.Dictionary(v_a))
446
+ v1 = Topology.SetDictionary(v1, Topology.Dictionary(v_a), silent=True)
410
447
  edge_dictionaries.append(Topology.Dictionary(edges[i]))
411
448
  final_vertices.append(v1)
412
449
  else:
@@ -463,15 +500,15 @@ class Wire():
463
500
  v1_2 = Topology.TranslateByDirectionDistance(Edge.StartVertex(o_edge_a),
464
501
  direction = Edge.Direction(o_edge_a),
465
502
  distance = d_stepOffsetB)
503
+ if transferDictionaries == True:
504
+ v1_1 = Topology.SetDictionary(v1_1, Topology.Dictionary(v_a), silent=True)
505
+ v1_2 = Topology.SetDictionary(v1_2, Topology.Dictionary(v_a), silent=True)
506
+ edge_dictionaries.append(Topology.Dictionary(v_a))
507
+ edge_dictionaries.append(Topology.Dictionary(edges[i]))
466
508
  bisectors_list.append(Edge.ByVertices(v_a, v1_1))
467
509
  bisectors_list.append(Edge.ByVertices(v_a, v1_2))
468
510
  final_vertices.append(v1_1)
469
511
  final_vertices.append(v1_2)
470
- if transferDictionaries == True:
471
- v1_1 = Topology.SetDictionary(v1_1, Topology.Dictionary(v_a))
472
- v1_2 = Topology.SetDictionary(v1_2, Topology.Dictionary(v_a))
473
- edge_dictionaries.append(Topology.Dictionary(v_a))
474
- edge_dictionaries.append(Topology.Dictionary(edges[i]))
475
512
  v_a = Edge.EndVertex(edges[-1])
476
513
  if Wire.IsClosed(wire) == False:
477
514
  v1 = Edge.EndVertex(offset_edges[-1])
@@ -481,21 +518,33 @@ class Wire():
481
518
  if bisectors == True:
482
519
  bisectors_list.append(Edge.ByVertices(v_a, v1))
483
520
 
484
-
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
+
485
532
  return_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire))
486
- wire_edges = Topology.Edges(return_wire)
533
+ return_wire_edges = Topology.Edges(return_wire)
534
+ #wire_edges = Topology.Edges(return_wire)
487
535
  if transferDictionaries == True:
488
- for i, wire_edge in enumerate(wire_edges):
489
- wire_edge = Topology.SetDictionary(wire_edge, edge_dictionaries[i], silent=True)
490
- if not Topology.IsInstance(return_wire, "Wire"):
491
- if not silent:
492
- print("Wire.ByOffset - Warning: The resulting wire is not well-formed, please check your offsets.")
493
- else:
494
- if not Wire.IsManifold(return_wire) and bisectors == False:
536
+ if not len(wire_edges) == len(edge_dictionaries):
495
537
  if not silent:
496
- print("Wire.ByOffset - Warning: The resulting wire is non-manifold, please check your offsets.")
538
+ print("Length of Wire Edges:", len(wire_edges))
539
+ print("Length of Edge Dictionaries:", len(edge_dictionaries))
540
+ print("Wire.ByOffset - Warning: The resulting wire is not well-formed, offsets may not be applied correctly. Please check your offsets.")
541
+ for i, wire_edge in enumerate(wire_edges):
542
+ if len(edge_dictionaries) > 0:
543
+ temp_dictionary = edge_dictionaries[min(i,len(edge_dictionaries)-1)]
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)
497
546
  if bisectors == True:
498
- 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))
499
548
  if transferDictionaries == True:
500
549
  sel_vertices = Topology.Vertices(return_wire)
501
550
  sel_vertices += Topology.Vertices(flat_wire)
@@ -506,9 +555,39 @@ class Wire():
506
555
  c = Topology.Centroid(edge)
507
556
  c = Topology.SetDictionary(c, d)
508
557
  sel_edges.append(c)
509
- temp_return_wire = Topology.TransferDictionariesBySelectors(temp_return_wire, sel_vertices, tranVertices=True)
510
- 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
+
511
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
512
591
  return_wire = Topology.Unflatten(return_wire, direction=normal, origin=origin)
513
592
  if transferDictionaries == True:
514
593
  return_wire = Topology.SetDictionary(return_wire, Topology.Dictionary(wire), silent=True)
@@ -738,7 +817,7 @@ class Wire():
738
817
  if not(([i1, i2] in g_edges) or ([i2, i1] in g_edges)):
739
818
  g_edges.append([i1, i2])
740
819
  used.append(end)
741
- new_wire = Topology.ByGeometry(vertices=g_vertices, edges=g_edges, faces=[], outputMode="wire")
820
+ new_wire = Topology.SelfMerge(Topology.ByGeometry(vertices=g_vertices, edges=g_edges, faces=[]))
742
821
  return new_wire
743
822
 
744
823
  @staticmethod
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.50'
1
+ __version__ = '0.7.52'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.50
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
@@ -3,33 +3,33 @@ topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
3
3
  topologicpy/Cell.py,sha256=uZ1gNVlfVtpi6sNgyfazP_nqe7mPjarE7MYzf8KoEI4,107930
4
4
  topologicpy/CellComplex.py,sha256=x474N-lo1krpdIGrWRAFRdDup5a_1V-mLORTS6ZGZ7M,48227
5
5
  topologicpy/Cluster.py,sha256=TZXuxzdaUr6OHSWnjWpjCOMlVj6YHBH8aUVbDVsncVA,54999
6
- topologicpy/Color.py,sha256=UlmRcCSOhqcM_OyMWz4t3Kr75KcgXDhz3uctAJ2n7Ic,18031
6
+ topologicpy/Color.py,sha256=FrxX2yILqWvYrqD8kBaknfMfOR_phJOmhvTvFc07bY4,18065
7
7
  topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
8
8
  topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
9
- topologicpy/Dictionary.py,sha256=KqJ29YyE23Y3Xc6XmKLSCZXRfBvm-OEOxlMZ4dt-rfM,27094
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=pn0LGusTPKLrHEMhY94_Bs3rc4wUpIyEqyW9q-ftdG0,115379
13
- topologicpy/Graph.py,sha256=1dtcE342b6d7cTiMbtUWWOud6Vu0vHaf4HP2eG_-iqg,402544
12
+ topologicpy/Face.py,sha256=7GCYo4ATkMW1skiv4gXOVARM29A7Buim9lTQu57B22Y,115489
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=o0JWE51lViK-UJUpIpf2Yusk_vTX5hfNMyFXFinKSRg,106048
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=NONehbPs2Z0J-BaQXRUChCZfTzJSzVngkhojKSxSij8,382087
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=9EJE0Iq3nGz5X7Suy6xxjmuOpfV49By6WH98UAL_7m4,153532
28
+ topologicpy/Wire.py,sha256=POd3_jjSXsLV6OiH6PvGZvA3AS5OpesDI5Fahn59daI,158034
29
29
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
30
- topologicpy/version.py,sha256=gEkNhj8f1k7FiRl8ltgMlJxkt4i1ODTsl0_a2BsR4wI,23
31
- topologicpy-0.7.50.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
32
- topologicpy-0.7.50.dist-info/METADATA,sha256=bQrEvJSs5DBgeaLDmx_HZPF_Qz_rZCXSLa3YUuOa33s,10918
33
- topologicpy-0.7.50.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
34
- topologicpy-0.7.50.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
35
- topologicpy-0.7.50.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