topologicpy 0.8.41__py3-none-any.whl → 0.8.43__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/Cell.py +9 -6
- topologicpy/CellComplex.py +7 -3
- topologicpy/Dictionary.py +116 -41
- topologicpy/Edge.py +54 -22
- topologicpy/Face.py +37 -11
- topologicpy/Plotly.py +6 -5
- topologicpy/Topology.py +93 -20
- topologicpy/Wire.py +3 -28
- topologicpy/version.py +1 -1
- {topologicpy-0.8.41.dist-info → topologicpy-0.8.43.dist-info}/METADATA +1 -1
- {topologicpy-0.8.41.dist-info → topologicpy-0.8.43.dist-info}/RECORD +14 -14
- {topologicpy-0.8.41.dist-info → topologicpy-0.8.43.dist-info}/WHEEL +0 -0
- {topologicpy-0.8.41.dist-info → topologicpy-0.8.43.dist-info}/licenses/LICENSE +0 -0
- {topologicpy-0.8.41.dist-info → topologicpy-0.8.43.dist-info}/top_level.txt +0 -0
topologicpy/Cell.py
CHANGED
@@ -2762,7 +2762,7 @@ class Cell():
|
|
2762
2762
|
return prism
|
2763
2763
|
|
2764
2764
|
@staticmethod
|
2765
|
-
def RemoveCollinearEdges(cell, angTolerance: float = 0.1, tolerance: float = 0.0001):
|
2765
|
+
def RemoveCollinearEdges(cell, angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = False):
|
2766
2766
|
"""
|
2767
2767
|
Removes any collinear edges in the input cell.
|
2768
2768
|
|
@@ -2774,6 +2774,8 @@ class Cell():
|
|
2774
2774
|
The desired angular tolerance. The default is 0.1.
|
2775
2775
|
tolerance : float , optional
|
2776
2776
|
The desired tolerance. The default is 0.0001.
|
2777
|
+
silent : bool , optional
|
2778
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
2777
2779
|
|
2778
2780
|
Returns
|
2779
2781
|
-------
|
@@ -2786,15 +2788,16 @@ class Cell():
|
|
2786
2788
|
import inspect
|
2787
2789
|
|
2788
2790
|
if not Topology.IsInstance(cell, "Cell"):
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2791
|
+
if not silent:
|
2792
|
+
print("Cell.RemoveCollinearEdges - Error: The input cell parameter is not a valid cell. Returning None.")
|
2793
|
+
curframe = inspect.currentframe()
|
2794
|
+
calframe = inspect.getouterframes(curframe, 2)
|
2795
|
+
print('caller name:', calframe[1][3])
|
2793
2796
|
return None
|
2794
2797
|
faces = Cell.Faces(cell)
|
2795
2798
|
clean_faces = []
|
2796
2799
|
for face in faces:
|
2797
|
-
clean_faces.append(Face.RemoveCollinearEdges(face, angTolerance=angTolerance, tolerance=tolerance))
|
2800
|
+
clean_faces.append(Face.RemoveCollinearEdges(face, angTolerance=angTolerance, tolerance=tolerance, silent=silent))
|
2798
2801
|
return Cell.ByFaces(clean_faces, tolerance=tolerance)
|
2799
2802
|
|
2800
2803
|
@staticmethod
|
topologicpy/CellComplex.py
CHANGED
@@ -104,7 +104,7 @@ class CellComplex():
|
|
104
104
|
tolerance : float , optional
|
105
105
|
The desired tolerance. The default is 0.0001.
|
106
106
|
silent : bool , optional
|
107
|
-
|
107
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
108
108
|
|
109
109
|
Returns
|
110
110
|
-------
|
@@ -990,7 +990,7 @@ class CellComplex():
|
|
990
990
|
return None
|
991
991
|
|
992
992
|
@staticmethod
|
993
|
-
def RemoveCollinearEdges(cellComplex, angTolerance: float = 0.1, tolerance: float = 0.0001):
|
993
|
+
def RemoveCollinearEdges(cellComplex, angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = True):
|
994
994
|
"""
|
995
995
|
Removes any collinear edges in the input cellComplex.
|
996
996
|
|
@@ -1002,6 +1002,8 @@ class CellComplex():
|
|
1002
1002
|
The desired angular tolerance. The default is 0.1.
|
1003
1003
|
tolerance : float , optional
|
1004
1004
|
The desired tolerance. The default is 0.0001.
|
1005
|
+
silent : bool , optional
|
1006
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1005
1007
|
|
1006
1008
|
Returns
|
1007
1009
|
-------
|
@@ -1023,7 +1025,7 @@ class CellComplex():
|
|
1023
1025
|
cells = CellComplex.Cells(cellComplex)
|
1024
1026
|
clean_cells = []
|
1025
1027
|
for cell in cells:
|
1026
|
-
clean_cells.append(Cell.RemoveCollinearEdges(cell, angTolerance=angTolerance, tolerance=tolerance))
|
1028
|
+
clean_cells.append(Cell.RemoveCollinearEdges(cell, angTolerance=angTolerance, tolerance=tolerance, silent=silent))
|
1027
1029
|
return CellComplex.ByCells(clean_cells, tolerance=tolerance)
|
1028
1030
|
|
1029
1031
|
@staticmethod
|
@@ -1098,6 +1100,8 @@ class CellComplex():
|
|
1098
1100
|
The desired length of the mantissa. The default is 6.
|
1099
1101
|
tolerance : float , optional
|
1100
1102
|
The desired tolerance. The default is 0.0001.
|
1103
|
+
silent : bool , optional
|
1104
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1101
1105
|
|
1102
1106
|
Returns
|
1103
1107
|
-------
|
topologicpy/Dictionary.py
CHANGED
@@ -75,6 +75,7 @@ class Dictionary():
|
|
75
75
|
The adjacency dictionary.
|
76
76
|
"""
|
77
77
|
from topologicpy.Edge import Edge
|
78
|
+
from topologicpy.Face import Face
|
78
79
|
from topologicpy.Dictionary import Dictionary
|
79
80
|
from topologicpy.Topology import Topology
|
80
81
|
from topologicpy.Graph import Graph
|
@@ -116,7 +117,7 @@ class Dictionary():
|
|
116
117
|
if d == None:
|
117
118
|
d = Dictionary.ByKeyValue(labelKey, value)
|
118
119
|
else:
|
119
|
-
d = Dictionary.SetValueAtKey(d, labelKey, value)
|
120
|
+
d = Dictionary.SetValueAtKey(d, labelKey, value, silent=silent)
|
120
121
|
subtopology = Topology.SetDictionary(subtopology, d)
|
121
122
|
labels.append(value)
|
122
123
|
all_subtopologies = Helper.Sort(all_subtopologies, labels)
|
@@ -129,7 +130,7 @@ class Dictionary():
|
|
129
130
|
adjacent_topologies = Topology.AdjacentTopologies(subtopology, hostTopology=topology, topologyType=subTopologyType)
|
130
131
|
temp_list = []
|
131
132
|
for adj_topology in adjacent_topologies:
|
132
|
-
adj_label = Dictionary.ValueAtKey(Topology.Dictionary(adj_topology), labelKey)
|
133
|
+
adj_label = Dictionary.ValueAtKey(Topology.Dictionary(adj_topology), labelKey, silent=silent)
|
133
134
|
adj_index = labels.index(adj_label)
|
134
135
|
if includeWeights == True:
|
135
136
|
if weightKey == None:
|
@@ -141,7 +142,7 @@ class Dictionary():
|
|
141
142
|
elif "area" in weightKey.lower():
|
142
143
|
shared_topologies = Topology.SharedTopologies(subtopology, adj_topology)
|
143
144
|
faces = shared_topologies.get("faces", [])
|
144
|
-
weight = sum([
|
145
|
+
weight = sum([Face.Area(face, mantissa=mantissa) for face in faces])
|
145
146
|
else:
|
146
147
|
shared_topologies = Topology.SharedTopologies(subtopology, adj_topology)
|
147
148
|
vertices = shared_topologies.get("vertices", [])
|
@@ -166,7 +167,7 @@ class Dictionary():
|
|
166
167
|
return adjDict
|
167
168
|
|
168
169
|
@staticmethod
|
169
|
-
def ByKeyValue(key, value):
|
170
|
+
def ByKeyValue(key, value, silent: bool = False):
|
170
171
|
"""
|
171
172
|
Creates a Dictionary from the input key and the input value.
|
172
173
|
|
@@ -176,6 +177,8 @@ class Dictionary():
|
|
176
177
|
The string representing the key of the value in the dictionary.
|
177
178
|
value : int, float, str, or list
|
178
179
|
A value corresponding to the input key. A value can be an integer, a float, a string, or a list.
|
180
|
+
silent : bool , optional
|
181
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
179
182
|
|
180
183
|
Returns
|
181
184
|
-------
|
@@ -184,9 +187,10 @@ class Dictionary():
|
|
184
187
|
|
185
188
|
"""
|
186
189
|
if not isinstance(key, str):
|
187
|
-
|
190
|
+
if not silent:
|
191
|
+
print("Dictionary.ByKeyValue - Error: The input key is not a valid string. Returning None.")
|
188
192
|
return None
|
189
|
-
return Dictionary.ByKeysValues([key], [value])
|
193
|
+
return Dictionary.ByKeysValues([key], [value], silent=silent)
|
190
194
|
|
191
195
|
|
192
196
|
@staticmethod
|
@@ -234,7 +238,7 @@ class Dictionary():
|
|
234
238
|
return attr
|
235
239
|
|
236
240
|
@staticmethod
|
237
|
-
def ByKeysValues(keys, values):
|
241
|
+
def ByKeysValues(keys, values, silent: bool = False):
|
238
242
|
"""
|
239
243
|
Creates a Dictionary from the input list of keys and the input list of values.
|
240
244
|
|
@@ -244,6 +248,8 @@ class Dictionary():
|
|
244
248
|
A list of strings representing the keys of the dictionary.
|
245
249
|
values : list
|
246
250
|
A list of values corresponding to the list of keys. Values can be integers, floats, strings, or lists
|
251
|
+
silent : bool , optional
|
252
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
247
253
|
|
248
254
|
Returns
|
249
255
|
-------
|
@@ -253,13 +259,16 @@ class Dictionary():
|
|
253
259
|
"""
|
254
260
|
|
255
261
|
if not isinstance(keys, list):
|
256
|
-
|
262
|
+
if not silent:
|
263
|
+
print("Dictionary.ByKeysValues - Error: The input keys parameter is not a valid list. Returning None.")
|
257
264
|
return None
|
258
265
|
if not isinstance(values, list):
|
259
|
-
|
266
|
+
if not silent:
|
267
|
+
print("Dictionary.ByKeysValues - Error: The input values parameter is not a valid list. Returning None.")
|
260
268
|
return None
|
261
269
|
if len(keys) != len(values):
|
262
|
-
|
270
|
+
if not silent:
|
271
|
+
print("Dictionary.ByKeysValues - Error: The input keys and values parameters are not of equal length. Returning None.")
|
263
272
|
return None
|
264
273
|
stl_keys = []
|
265
274
|
stl_values = []
|
@@ -440,7 +449,7 @@ class Dictionary():
|
|
440
449
|
'''
|
441
450
|
|
442
451
|
@staticmethod
|
443
|
-
def ByPythonDictionary(pythonDictionary):
|
452
|
+
def ByPythonDictionary(pythonDictionary, silent: bool = False):
|
444
453
|
"""
|
445
454
|
Creates a dictionary equivalent to the input python dictionary.
|
446
455
|
|
@@ -448,6 +457,8 @@ class Dictionary():
|
|
448
457
|
----------
|
449
458
|
pythonDictionary : dict
|
450
459
|
The input python dictionary.
|
460
|
+
silent : bool , optional
|
461
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
451
462
|
|
452
463
|
Returns
|
453
464
|
-------
|
@@ -456,7 +467,8 @@ class Dictionary():
|
|
456
467
|
|
457
468
|
"""
|
458
469
|
if not isinstance(pythonDictionary, dict):
|
459
|
-
|
470
|
+
if not silent:
|
471
|
+
print("Dictionary.ByPythonDictionary - Error: The input dictionary parameter is not a valid python dictionary. Returning None.")
|
460
472
|
return None
|
461
473
|
keys = list(pythonDictionary.keys())
|
462
474
|
values = []
|
@@ -480,7 +492,8 @@ class Dictionary():
|
|
480
492
|
A copy of the input dictionary.
|
481
493
|
|
482
494
|
"""
|
483
|
-
|
495
|
+
from topologicpy.Topology import Topology
|
496
|
+
if not Topology.IsInstance(dictionary, "dictionary"):
|
484
497
|
if not silent:
|
485
498
|
print("Dictionary.Copy - Error: The input dictionary parameter is not a valid dictionary. Returning None.")
|
486
499
|
return None
|
@@ -580,7 +593,7 @@ class Dictionary():
|
|
580
593
|
return {"filteredDictionaries": filteredDictionaries, "otherDictionaries": otherDictionaries, "filteredIndices": filteredIndices, "otherIndices": otherIndices, "filteredElements": filteredElements, "otherElements": otherElements}
|
581
594
|
|
582
595
|
@staticmethod
|
583
|
-
def Keys(dictionary):
|
596
|
+
def Keys(dictionary, silent: bool = False):
|
584
597
|
"""
|
585
598
|
Returns the keys of the input dictionary.
|
586
599
|
|
@@ -588,6 +601,8 @@ class Dictionary():
|
|
588
601
|
----------
|
589
602
|
dictionary : topologic_core.Dictionary or dict
|
590
603
|
The input dictionary.
|
604
|
+
silent : bool , optional
|
605
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
591
606
|
|
592
607
|
Returns
|
593
608
|
-------
|
@@ -596,8 +611,14 @@ class Dictionary():
|
|
596
611
|
|
597
612
|
"""
|
598
613
|
from topologicpy.Topology import Topology
|
614
|
+
import inspect
|
615
|
+
|
599
616
|
if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
|
600
|
-
|
617
|
+
if not silent:
|
618
|
+
print("Dictionary.Keys - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
|
619
|
+
curframe = inspect.currentframe()
|
620
|
+
calframe = inspect.getouterframes(curframe, 2)
|
621
|
+
print('caller name:', calframe[1][3])
|
601
622
|
return None
|
602
623
|
if isinstance(dictionary, dict):
|
603
624
|
return list(dictionary.keys())
|
@@ -627,7 +648,7 @@ class Dictionary():
|
|
627
648
|
return returnList
|
628
649
|
|
629
650
|
@staticmethod
|
630
|
-
def PythonDictionary(dictionary):
|
651
|
+
def PythonDictionary(dictionary, silent: bool = False):
|
631
652
|
"""
|
632
653
|
Returns the input dictionary as a python dictionary
|
633
654
|
|
@@ -635,6 +656,8 @@ class Dictionary():
|
|
635
656
|
----------
|
636
657
|
dictionary : topologic_core.Dictionary
|
637
658
|
The input dictionary.
|
659
|
+
silent : bool , optional
|
660
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
638
661
|
|
639
662
|
Returns
|
640
663
|
-------
|
@@ -645,10 +668,12 @@ class Dictionary():
|
|
645
668
|
from topologicpy.Topology import Topology
|
646
669
|
|
647
670
|
if isinstance(dictionary, dict):
|
648
|
-
|
671
|
+
if not silent:
|
672
|
+
print("Dictionary.PythonDictionary - Warning: The input dictionary parameter is already a python dictionary. Returning that dictionary.")
|
649
673
|
return dictionary
|
650
674
|
if not Topology.IsInstance(dictionary, "Dictionary"):
|
651
|
-
|
675
|
+
if not silent:
|
676
|
+
print("Dictionary.PythonDictionary - Error: The input dictionary parameter is not a valid topologic dictionary. Returning None.")
|
652
677
|
return None
|
653
678
|
keys = dictionary.Keys()
|
654
679
|
pythonDict = {}
|
@@ -674,7 +699,7 @@ class Dictionary():
|
|
674
699
|
return pythonDict
|
675
700
|
|
676
701
|
@staticmethod
|
677
|
-
def RemoveKey(dictionary, key):
|
702
|
+
def RemoveKey(dictionary, key, silent: bool = False):
|
678
703
|
"""
|
679
704
|
Removes the key (and its associated value) from the input dictionary.
|
680
705
|
|
@@ -684,6 +709,8 @@ class Dictionary():
|
|
684
709
|
The input dictionary.
|
685
710
|
key : string
|
686
711
|
The input key.
|
712
|
+
silent : bool , optional
|
713
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
687
714
|
|
688
715
|
Returns
|
689
716
|
-------
|
@@ -713,10 +740,12 @@ class Dictionary():
|
|
713
740
|
return Dictionary.ByKeysValues(new_keys, new_values)
|
714
741
|
|
715
742
|
if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
|
716
|
-
|
743
|
+
if not silent:
|
744
|
+
print("Dictionary.RemoveKey - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
|
717
745
|
return None
|
718
746
|
if not isinstance(key, str):
|
719
|
-
|
747
|
+
if not silent:
|
748
|
+
print("Dictionary.RemoveKey - Error: The input key parameter is not a valid string. Returning None.")
|
720
749
|
return None
|
721
750
|
|
722
751
|
if isinstance(dictionary, dict):
|
@@ -727,7 +756,7 @@ class Dictionary():
|
|
727
756
|
return None
|
728
757
|
|
729
758
|
@staticmethod
|
730
|
-
def SetValueAtKey(dictionary, key, value):
|
759
|
+
def SetValueAtKey(dictionary, key, value, silent: bool = False):
|
731
760
|
"""
|
732
761
|
Creates a key/value pair in the input dictionary.
|
733
762
|
|
@@ -739,6 +768,8 @@ class Dictionary():
|
|
739
768
|
The input key.
|
740
769
|
value : int , float , string, or list
|
741
770
|
The value associated with the key.
|
771
|
+
silent : bool , optional
|
772
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
742
773
|
|
743
774
|
Returns
|
744
775
|
-------
|
@@ -768,10 +799,12 @@ class Dictionary():
|
|
768
799
|
return d
|
769
800
|
|
770
801
|
if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
|
771
|
-
|
802
|
+
if not silent:
|
803
|
+
print("Dictionary.SetValueAtKey - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
|
772
804
|
return None
|
773
805
|
if not isinstance(key, str):
|
774
|
-
|
806
|
+
if not silent:
|
807
|
+
print("Dictionary.SetValueAtKey - Error: The input key parameter is not a valid string. Returning None.")
|
775
808
|
return None
|
776
809
|
if value == None:
|
777
810
|
value = "__NONE__"
|
@@ -783,7 +816,7 @@ class Dictionary():
|
|
783
816
|
return None
|
784
817
|
|
785
818
|
@staticmethod
|
786
|
-
def SetValuesAtKeys(dictionary, keys, values):
|
819
|
+
def SetValuesAtKeys(dictionary, keys, values, silent: bool = False):
|
787
820
|
"""
|
788
821
|
Creates a key/value pair in the input dictionary.
|
789
822
|
|
@@ -793,6 +826,8 @@ class Dictionary():
|
|
793
826
|
A list of strings representing the keys of the dictionary.
|
794
827
|
values : list
|
795
828
|
A list of values corresponding to the list of keys. Values can be integers, floats, strings, or lists
|
829
|
+
silent : bool , optional
|
830
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
796
831
|
|
797
832
|
Returns
|
798
833
|
-------
|
@@ -802,17 +837,20 @@ class Dictionary():
|
|
802
837
|
"""
|
803
838
|
|
804
839
|
if not isinstance(keys, list):
|
805
|
-
|
840
|
+
if not silent:
|
841
|
+
print("Dictionary.SetValuesAtKeys - Error: The input keys parameter is not a valid list. Returning None.")
|
806
842
|
return None
|
807
843
|
if not isinstance(values, list):
|
808
|
-
|
844
|
+
if not silent:
|
845
|
+
print("Dictionary.SetValuesAtkeys - Error: The input values parameter is not a valid list. Returning None.")
|
809
846
|
return None
|
810
847
|
if len(keys) != len(values):
|
811
|
-
|
848
|
+
if not silent:
|
849
|
+
print("Dictionary.SetValuesAtKeys - Error: The input keys and values parameters are not of equal length. Returning None.")
|
812
850
|
return None
|
813
851
|
|
814
852
|
for i, key in enumerate(keys):
|
815
|
-
dictionary = Dictionary.SetValueAtKey(dictionary, key, values[i])
|
853
|
+
dictionary = Dictionary.SetValueAtKey(dictionary, key, values[i], silent=silent)
|
816
854
|
return dictionary
|
817
855
|
|
818
856
|
@staticmethod
|
@@ -930,18 +968,9 @@ class Dictionary():
|
|
930
968
|
elif isinstance(dictionary, dict):
|
931
969
|
return dictionary.get(key, defaultValue)
|
932
970
|
return defaultValue
|
933
|
-
|
934
|
-
# if isinstance(dictionary, dict):
|
935
|
-
# attr = dictionary[key]
|
936
|
-
# elif Topology.IsInstance(dictionary, "Dictionary"):
|
937
|
-
# attr = dictionary.ValueAtKey(key)
|
938
|
-
# else:
|
939
|
-
# return None
|
940
|
-
# return_value = Dictionary._ConvertAttribute(attr)
|
941
|
-
# return return_value
|
942
|
-
|
971
|
+
|
943
972
|
@staticmethod
|
944
|
-
def Values(dictionary):
|
973
|
+
def Values(dictionary, silent: bool = False):
|
945
974
|
"""
|
946
975
|
Returns the list of values in the input dictionary.
|
947
976
|
|
@@ -949,6 +978,8 @@ class Dictionary():
|
|
949
978
|
----------
|
950
979
|
dictionary : topologic_core.Dictionary or dict
|
951
980
|
The input dictionary.
|
981
|
+
silent : bool , optional
|
982
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
952
983
|
|
953
984
|
Returns
|
954
985
|
-------
|
@@ -959,7 +990,8 @@ class Dictionary():
|
|
959
990
|
from topologicpy.Topology import Topology
|
960
991
|
|
961
992
|
if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
|
962
|
-
|
993
|
+
if not silent:
|
994
|
+
print("Dictionary.Values - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
|
963
995
|
return None
|
964
996
|
keys = None
|
965
997
|
if isinstance(dictionary, dict):
|
@@ -981,5 +1013,48 @@ class Dictionary():
|
|
981
1013
|
returnList.append(attr)
|
982
1014
|
return returnList
|
983
1015
|
|
1016
|
+
@staticmethod
|
1017
|
+
def ValuesAtKeys(dictionary, keys, defaultValue=None, silent: bool = False):
|
1018
|
+
"""
|
1019
|
+
Returns the list of values of the input list of keys in the input dictionary.
|
1020
|
+
|
1021
|
+
Parameters
|
1022
|
+
----------
|
1023
|
+
dictionary : topologic_core.Dictionary or dict
|
1024
|
+
The input dictionary.
|
1025
|
+
keys : list
|
1026
|
+
The input list of keys.
|
1027
|
+
defaultValue : any , optional
|
1028
|
+
The default value to return if the key or value are not found. The default is None.
|
1029
|
+
silent : bool , optional
|
1030
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1031
|
+
|
1032
|
+
Returns
|
1033
|
+
-------
|
1034
|
+
list
|
1035
|
+
The list of values found at the input list of keys in the input dictionary.
|
1036
|
+
|
1037
|
+
"""
|
1038
|
+
from topologicpy.Topology import Topology
|
1039
|
+
|
1040
|
+
if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
|
1041
|
+
if not silent == True:
|
1042
|
+
print("Dictionary.ValuesAtKeys - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
|
1043
|
+
return None
|
1044
|
+
if not isinstance(keys, list):
|
1045
|
+
if not silent == True:
|
1046
|
+
print("Dictionary.ValuesAtKeys - Error: The input keys parameter is not a valid list. Returning None.")
|
1047
|
+
return None
|
1048
|
+
|
1049
|
+
local_keys = [k for k in keys if isinstance(k, str)]
|
1050
|
+
if len(local_keys) == 0:
|
1051
|
+
if not silent == True:
|
1052
|
+
print("Dictionary.ValuesAtKeys - Error: The input keys parameter does not contain valid key strings. Returning None.")
|
1053
|
+
return None
|
1054
|
+
if not len(local_keys) == len(keys):
|
1055
|
+
if not silent == True:
|
1056
|
+
print("Dictionary.ValuesAtKeys - Error: The input keys parameter contains invalid values. Returning None.")
|
1057
|
+
return None
|
1058
|
+
return [Dictionary.ValueAtKey(dictionary, key, defaultValue=defaultValue, silent=silent) for key in keys]
|
984
1059
|
|
985
1060
|
|
topologicpy/Edge.py
CHANGED
@@ -256,31 +256,63 @@ class Edge():
|
|
256
256
|
@staticmethod
|
257
257
|
def ByOffset2D(edge, offset: float = 1.0, tolerance: float = 0.0001):
|
258
258
|
"""
|
259
|
-
Creates
|
260
|
-
|
261
|
-
Parameters
|
262
|
-
----------
|
263
|
-
edge : topologic_core.Edge
|
264
|
-
The input edge.
|
265
|
-
offset : float , optional
|
266
|
-
The desired offset. The default is 1.
|
267
|
-
tolerance : float , optional
|
268
|
-
The desired tolerance. The default is 0.0001.
|
269
|
-
|
270
|
-
Returns
|
271
|
-
-------
|
272
|
-
topologic_core.Edge
|
273
|
-
An edge offset from the input edge.
|
274
|
-
|
259
|
+
Creates an edge offset from the input edge in the XY plane.
|
275
260
|
"""
|
276
261
|
from topologicpy.Topology import Topology
|
277
|
-
from topologicpy.
|
262
|
+
from topologicpy.Vertex import Vertex
|
263
|
+
from topologicpy.Edge import Edge
|
278
264
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
265
|
+
sv = Edge.StartVertex(edge)
|
266
|
+
ev = Edge.EndVertex(edge)
|
267
|
+
|
268
|
+
x1, y1, _ = Vertex.Coordinates(sv)
|
269
|
+
x2, y2, _ = Vertex.Coordinates(ev)
|
270
|
+
|
271
|
+
dx = x2 - x1
|
272
|
+
dy = y2 - y1
|
273
|
+
length = (dx**2 + dy**2)**0.5
|
274
|
+
if length < tolerance:
|
275
|
+
return None
|
276
|
+
|
277
|
+
# Perpendicular vector to the left
|
278
|
+
nx = -dy / length
|
279
|
+
ny = dx / length
|
280
|
+
|
281
|
+
ox = nx * offset
|
282
|
+
oy = ny * offset
|
283
|
+
|
284
|
+
new_sv = Vertex.ByCoordinates(x1 + ox, y1 + oy, 0)
|
285
|
+
new_ev = Vertex.ByCoordinates(x2 + ox, y2 + oy, 0)
|
286
|
+
|
287
|
+
return Edge.ByVertices(new_sv, new_ev)
|
288
|
+
# @staticmethod
|
289
|
+
# def ByOffset2D(edge, offset: float = 1.0, tolerance: float = 0.0001):
|
290
|
+
# """
|
291
|
+
# Creates and edge offset from the input edge. This method is intended for edges that are in the XY plane.
|
292
|
+
|
293
|
+
# Parameters
|
294
|
+
# ----------
|
295
|
+
# edge : topologic_core.Edge
|
296
|
+
# The input edge.
|
297
|
+
# offset : float , optional
|
298
|
+
# The desired offset. The default is 1.
|
299
|
+
# tolerance : float , optional
|
300
|
+
# The desired tolerance. The default is 0.0001.
|
301
|
+
|
302
|
+
# Returns
|
303
|
+
# -------
|
304
|
+
# topologic_core.Edge
|
305
|
+
# An edge offset from the input edge.
|
306
|
+
|
307
|
+
# """
|
308
|
+
# from topologicpy.Topology import Topology
|
309
|
+
# from topologicpy.Vector import Vector
|
310
|
+
|
311
|
+
# n = Edge.Normal(edge)
|
312
|
+
# n = Vector.Normalize(n)
|
313
|
+
# n = Vector.Multiply(n, offset, tolerance=tolerance)
|
314
|
+
# edge = Topology.Translate(edge, n[0], n[1], n[2])
|
315
|
+
# return edge
|
284
316
|
|
285
317
|
@staticmethod
|
286
318
|
def ByStartVertexEndVertex(vertexA, vertexB, tolerance: float = 0.0001, silent=False):
|
topologicpy/Face.py
CHANGED
@@ -827,7 +827,7 @@ class Face():
|
|
827
827
|
return Face.ByVertices(vertices, tolerance=tolerance)
|
828
828
|
|
829
829
|
@staticmethod
|
830
|
-
def ByWire(wire, tolerance: float = 0.0001, silent=False):
|
830
|
+
def ByWire(wire, tolerance: float = 0.0001, silent: bool = False):
|
831
831
|
"""
|
832
832
|
Creates a face from the input closed wire.
|
833
833
|
|
@@ -942,14 +942,21 @@ class Face():
|
|
942
942
|
"""
|
943
943
|
from topologicpy.Wire import Wire
|
944
944
|
from topologicpy.Topology import Topology
|
945
|
+
import inspect
|
945
946
|
|
946
947
|
if not Topology.IsInstance(externalBoundary, "Wire"):
|
947
948
|
if not silent:
|
948
949
|
print("Face.ByWires - Error: The input externalBoundary parameter is not a valid topologic wire. Returning None.")
|
950
|
+
curframe = inspect.currentframe()
|
951
|
+
calframe = inspect.getouterframes(curframe, 2)
|
952
|
+
print('caller name:', calframe[1][3])
|
949
953
|
return None
|
950
954
|
if not Wire.IsClosed(externalBoundary):
|
951
955
|
if not silent:
|
952
956
|
print("Face.ByWires - Error: The input externalBoundary parameter is not a closed topologic wire. Returning None.")
|
957
|
+
curframe = inspect.currentframe()
|
958
|
+
calframe = inspect.getouterframes(curframe, 2)
|
959
|
+
print('caller name:', calframe[1][3])
|
953
960
|
return None
|
954
961
|
ibList = [x for x in internalBoundaries if Topology.IsInstance(x, "Wire") and Wire.IsClosed(x)]
|
955
962
|
face = None
|
@@ -958,6 +965,9 @@ class Face():
|
|
958
965
|
except:
|
959
966
|
if not silent:
|
960
967
|
print("Face.ByWires - Error: The operation failed. Returning None.")
|
968
|
+
curframe = inspect.currentframe()
|
969
|
+
calframe = inspect.getouterframes(curframe, 2)
|
970
|
+
print('caller name:', calframe[1][3])
|
961
971
|
face = None
|
962
972
|
return face
|
963
973
|
|
@@ -3404,7 +3414,7 @@ class Face():
|
|
3404
3414
|
return None
|
3405
3415
|
eb = Wire.RemoveCollinearEdges(Face.Wire(face), angTolerance=angTolerance, tolerance=tolerance, silent=silent)
|
3406
3416
|
ib = [Wire.RemoveCollinearEdges(w, angTolerance=angTolerance, tolerance=tolerance, silent=silent) for w in Face.InternalBoundaries(face)]
|
3407
|
-
return Face.ByWires(eb, ib)
|
3417
|
+
return Face.ByWires(eb, ib, silent=silent)
|
3408
3418
|
|
3409
3419
|
@staticmethod
|
3410
3420
|
def RHS(origin= None, width: float = 1.0, length: float = 1.0, thickness: float = 0.25, outerFillet: float = 0.0, innerFillet: float = 0.0, sides: int = 16, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001, silent: bool = False):
|
@@ -3602,35 +3612,51 @@ class Face():
|
|
3602
3612
|
return Face.RHS(origin = origin, width = size, length = size, thickness = thickness, outerFillet = outerFillet, innerFillet = innerFillet, sides = sides, direction = direction, placement = placement, tolerance = tolerance, silent = silent)
|
3603
3613
|
|
3604
3614
|
@staticmethod
|
3605
|
-
def Simplify(face, tolerance=0.0001):
|
3615
|
+
def Simplify(face, method='douglas-peucker', tolerance=0.0001, silent=False):
|
3606
3616
|
"""
|
3607
|
-
Simplifies the input
|
3608
|
-
Part of this code was contributed by gaoxipeng. See https://github.com/wassimj/topologicpy/issues/35
|
3617
|
+
Simplifies the input wire edges based on the selected algorithm: Douglas-Peucker or Visvalingam–Whyatt.
|
3609
3618
|
|
3610
3619
|
Parameters
|
3611
3620
|
----------
|
3612
3621
|
face : topologic_core.Face
|
3613
3622
|
The input face.
|
3623
|
+
method : str, optional
|
3624
|
+
The simplification method to use: 'douglas-peucker' or 'visvalingam-whyatt' or 'reumann-witkam'.
|
3625
|
+
The default is 'douglas-peucker'.
|
3614
3626
|
tolerance : float , optional
|
3615
|
-
The desired tolerance.
|
3616
|
-
|
3627
|
+
The desired tolerance.
|
3628
|
+
If using the douglas-peucker method, edge lengths shorter than this amount will be removed.
|
3629
|
+
If using the visvalingam-whyatt method, triangulare areas less than is amount will be removed.
|
3630
|
+
If using the Reumann-Witkam method, the tolerance specifies the maximum perpendicular distance allowed
|
3631
|
+
between any point and the current line segment; points falling within this distance are discarded.
|
3632
|
+
The default is 0.0001.
|
3633
|
+
silent : bool , optional
|
3634
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
3635
|
+
|
3617
3636
|
Returns
|
3618
3637
|
-------
|
3619
3638
|
topologic_core.Face
|
3620
3639
|
The simplified face.
|
3640
|
+
|
3621
3641
|
"""
|
3622
3642
|
from topologicpy.Wire import Wire
|
3623
3643
|
from topologicpy.Topology import Topology
|
3624
3644
|
|
3625
3645
|
if not Topology.IsInstance(face, "Face"):
|
3626
|
-
|
3646
|
+
if not silent:
|
3647
|
+
print("Face.Simplify - Error: The input face parameter is not a valid face. Returning None.")
|
3627
3648
|
return None
|
3628
3649
|
|
3629
3650
|
eb = Face.ExternalBoundary(face)
|
3630
|
-
eb = Wire.Simplify(eb, tolerance=tolerance)
|
3651
|
+
eb = Wire.Simplify(eb, method=method, tolerance=tolerance, silent=silent)
|
3631
3652
|
ibList = Face.InternalBoundaries(face)
|
3632
|
-
ibList = [Wire.Simplify(ib) for ib in ibList]
|
3633
|
-
|
3653
|
+
ibList = [Wire.Simplify(ib, method=method, tolerance=tolerance, silent=silent) for ib in ibList]
|
3654
|
+
return_face = Face.ByWires(eb, ibList, tolerance=tolerance, silent=silent)
|
3655
|
+
if not Topology.IsInstance(return_face, "Face"):
|
3656
|
+
if not silent:
|
3657
|
+
print("Face.Simplify - Error: Could not simplify the face. Returning the original input face.")
|
3658
|
+
return face
|
3659
|
+
return return_face
|
3634
3660
|
|
3635
3661
|
@staticmethod
|
3636
3662
|
def Skeleton(face, boundary: bool = True, tolerance: float = 0.001):
|
topologicpy/Plotly.py
CHANGED
@@ -743,15 +743,16 @@ class Plotly:
|
|
743
743
|
labels = []
|
744
744
|
for j, elements_cluster in enumerate(elements_clusters):
|
745
745
|
d_color = color
|
746
|
+
d_arrowSize = arrowSize
|
747
|
+
d_dash = dash
|
746
748
|
d = dict_clusters[j][0] # All dicitonaries have same values in dictionaries, so take first one.
|
747
749
|
if d:
|
748
750
|
if not colorKey == None:
|
749
|
-
d_color = Dictionary.ValueAtKey(d, key=colorKey
|
750
|
-
d_color = Color.AnyToHex(d_color)
|
751
|
+
d_color = Color.AnyToHex(Dictionary.ValueAtKey(d, key=colorKey, default=color))
|
751
752
|
if not dashKey == None:
|
752
|
-
d_dash = Dictionary.ValueAtKey(d, key=dashKey
|
753
|
+
d_dash = Dictionary.ValueAtKey(d, key=dashKey, default=dash)
|
753
754
|
if not arrowSizeKey == None:
|
754
|
-
d_arrowSize = Dictionary.ValueAtKey(d, key=arrowSizeKey
|
755
|
+
d_arrowSize = Dictionary.ValueAtKey(d, key=arrowSizeKey, default=arrowSize)
|
755
756
|
if not labelKey == None:
|
756
757
|
labels.append(str(Dictionary.ValueAtKey(d, labelKey, "")))
|
757
758
|
if not widthKey == None:
|
@@ -787,7 +788,7 @@ class Plotly:
|
|
787
788
|
marker_width = width[0]*0.25
|
788
789
|
else:
|
789
790
|
marker_width = width*0.25
|
790
|
-
if
|
791
|
+
if d_dash:
|
791
792
|
dot = "dot"
|
792
793
|
else:
|
793
794
|
dot = "solid"
|
topologicpy/Topology.py
CHANGED
@@ -941,7 +941,64 @@ class Topology():
|
|
941
941
|
return Cluster.ByTopologies(return_list)
|
942
942
|
else:
|
943
943
|
return None
|
944
|
+
|
945
|
+
|
946
|
+
@staticmethod
|
947
|
+
def Inherit(targets, sources, keys: list = None, tolerance: float = 0.0001, silent: bool = False):
|
948
|
+
"""
|
949
|
+
Transfers dictionary information from topologiesB to topologiesA based on co-location of internal vertices.
|
950
|
+
|
951
|
+
Parameters
|
952
|
+
----------
|
953
|
+
targets : list of topologic_core.Topology
|
954
|
+
The list of target topologies that will inherit the dictionaries.
|
955
|
+
sources : list of topologic_core. Topology
|
956
|
+
The list of source topologies from which to inherit dictionary information.
|
957
|
+
tolerance : float , optional
|
958
|
+
The desired tolerance. The default is 0.0001.
|
959
|
+
silent : bool , optional
|
960
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
944
961
|
|
962
|
+
Returns
|
963
|
+
-------
|
964
|
+
list
|
965
|
+
The list of target topologies with the dictionary information inherited from the list of source topologies.
|
966
|
+
|
967
|
+
"""
|
968
|
+
from topologicpy.Topology import Topology
|
969
|
+
from topologicpy.Vertex import Vertex
|
970
|
+
from topologicpy.Dictionary import Dictionary
|
971
|
+
|
972
|
+
topologies_a = [a for a in targets if Topology.IsInstance(a, "Topology")]
|
973
|
+
if len(topologies_a) == 0:
|
974
|
+
if not silent:
|
975
|
+
print("Topology.Inherit - Error: The list of targets does not contain any valid topologies. Returning None.")
|
976
|
+
return None
|
977
|
+
topologies_b = [b for b in sources if Topology.IsInstance(b, "Topology")]
|
978
|
+
if len(topologies_b) == 0:
|
979
|
+
if not silent:
|
980
|
+
print("Topology.Inherit - Error: The list of sources does not contain any valid topologies. Returning None.")
|
981
|
+
return None
|
982
|
+
for i, top_a in enumerate(topologies_a):
|
983
|
+
iv = Topology.InternalVertex(top_a, tolerance=tolerance, silent=silent)
|
984
|
+
d_a = Topology.Dictionary(top_a, silent=silent)
|
985
|
+
found = False
|
986
|
+
for top_b in topologies_b:
|
987
|
+
if Vertex.IsInternal(iv, top_b, tolerance=tolerance, silent=silent):
|
988
|
+
d_b = Topology.Dictionary(top_b)
|
989
|
+
if isinstance(keys, list):
|
990
|
+
values = Dictionary.ValuesAtKeys(d_b, keys, silent=silent)
|
991
|
+
d_c = Dictionary.SetValuesAtKeys(d_a, keys, values, silent=silent)
|
992
|
+
else:
|
993
|
+
d_c = Dictionary.SetValuesAtKeys(d_a, Dictionary.Keys(d_b, silent=silent), Dictionary.Values(d_b, silent=silent))
|
994
|
+
top_a = Topology.SetDictionary(top_a, d_c, silent=silent)
|
995
|
+
found = True
|
996
|
+
break
|
997
|
+
if found == False:
|
998
|
+
if not silent:
|
999
|
+
print("Topology.Inherit - Warning: Could not find a source for target number: "+str(i+1)+". Consider increasing the tolerance value.")
|
1000
|
+
return targets
|
1001
|
+
|
945
1002
|
@staticmethod
|
946
1003
|
def Intersect(topologyA, topologyB, tranDict=False, tolerance=0.0001):
|
947
1004
|
"""
|
@@ -4144,7 +4201,7 @@ class Topology():
|
|
4144
4201
|
return round(max_distance, mantissa)
|
4145
4202
|
|
4146
4203
|
@staticmethod
|
4147
|
-
def Dictionary(topology):
|
4204
|
+
def Dictionary(topology, silent: bool = False):
|
4148
4205
|
"""
|
4149
4206
|
Returns the dictionary of the input topology
|
4150
4207
|
|
@@ -4152,6 +4209,8 @@ class Topology():
|
|
4152
4209
|
----------
|
4153
4210
|
topology : topologic_core.Topology
|
4154
4211
|
The input topology.
|
4212
|
+
silent : bool , optional
|
4213
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
4155
4214
|
|
4156
4215
|
Returns
|
4157
4216
|
-------
|
@@ -4160,12 +4219,13 @@ class Topology():
|
|
4160
4219
|
|
4161
4220
|
"""
|
4162
4221
|
if not Topology.IsInstance(topology, "Topology") and not Topology.IsInstance(topology, "Graph"):
|
4163
|
-
|
4222
|
+
if not silent:
|
4223
|
+
print("Topology.Dictionary - Error: the input topology parameter is not a valid topology. Returning None.")
|
4164
4224
|
return None
|
4165
4225
|
return topology.GetDictionary()
|
4166
4226
|
|
4167
4227
|
@staticmethod
|
4168
|
-
def Dimensionality(topology):
|
4228
|
+
def Dimensionality(topology, silent: bool = False):
|
4169
4229
|
"""
|
4170
4230
|
Returns the dimensionality of the input topology
|
4171
4231
|
|
@@ -4173,6 +4233,8 @@ class Topology():
|
|
4173
4233
|
----------
|
4174
4234
|
topology : topologic_core.Topology
|
4175
4235
|
The input topology.
|
4236
|
+
silent : bool , optional
|
4237
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
4176
4238
|
|
4177
4239
|
Returns
|
4178
4240
|
-------
|
@@ -4181,12 +4243,13 @@ class Topology():
|
|
4181
4243
|
|
4182
4244
|
"""
|
4183
4245
|
if not Topology.IsInstance(topology, "Topology"):
|
4184
|
-
|
4246
|
+
if not silent:
|
4247
|
+
print("Topology.Dimensionality - Error: the input topology parameter is not a valid topology. Returning None.")
|
4185
4248
|
return None
|
4186
4249
|
return topology.Dimensionality()
|
4187
4250
|
|
4188
4251
|
@staticmethod
|
4189
|
-
def Divide(topologyA, topologyB, transferDictionary=False, addNestingDepth=False):
|
4252
|
+
def Divide(topologyA, topologyB, transferDictionary=False, addNestingDepth=False, silent: bool = False):
|
4190
4253
|
"""
|
4191
4254
|
Divides the input topology by the input tool and places the results in the contents of the input topology.
|
4192
4255
|
|
@@ -4200,6 +4263,8 @@ class Topology():
|
|
4200
4263
|
If set to True the dictionary of the input topology is transferred to the divided topologies.
|
4201
4264
|
addNestingDepth : bool , optional
|
4202
4265
|
If set to True the nesting depth of the division is added to the dictionaries of the divided topologies.
|
4266
|
+
silent : bool , optional
|
4267
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
4203
4268
|
|
4204
4269
|
Returns
|
4205
4270
|
-------
|
@@ -4210,13 +4275,15 @@ class Topology():
|
|
4210
4275
|
from topologicpy.Dictionary import Dictionary
|
4211
4276
|
|
4212
4277
|
if not Topology.IsInstance(topologyA, "Topology"):
|
4213
|
-
|
4278
|
+
if not silent:
|
4279
|
+
print("Topology.Divide - Error: the input topologyA parameter is not a valid topology. Returning None.")
|
4214
4280
|
return None
|
4215
4281
|
if not Topology.IsInstance(topologyB, "Topology"):
|
4216
|
-
|
4282
|
+
if not silent:
|
4283
|
+
print("Topology.Divide - Error: the input topologyB parameter is not a valid topology. Returning None.")
|
4217
4284
|
return None
|
4218
4285
|
try:
|
4219
|
-
_ = topologyA.Divide(topologyB, False) # Don't transfer dictionaries just yet
|
4286
|
+
_ = topologyA.Divide(topologyB, False) # Don't transfer dictionaries just yet # Hook to Core
|
4220
4287
|
except:
|
4221
4288
|
raise Exception("TopologyDivide - Error: Divide operation failed.")
|
4222
4289
|
nestingDepth = "1"
|
@@ -4251,7 +4318,7 @@ class Topology():
|
|
4251
4318
|
_ = Topology.SetDictionary(topologyA, parentDictionary)
|
4252
4319
|
values[keys.index("nesting_depth")] = nestingDepth+"_"+str(i+1)
|
4253
4320
|
d = Dictionary.ByKeysValues(keys, values)
|
4254
|
-
_ = contents[i].SetDictionary(d)
|
4321
|
+
_ = contents[i].SetDictionary(d) # Hook to Core
|
4255
4322
|
if addNestingDepth and not transferDictionary:
|
4256
4323
|
parentDictionary = Topology.Dictionary(topologyA)
|
4257
4324
|
if parentDictionary != None:
|
@@ -4275,7 +4342,7 @@ class Topology():
|
|
4275
4342
|
return topologyA
|
4276
4343
|
|
4277
4344
|
@staticmethod
|
4278
|
-
def Explode(topology, origin=None, scale: float = 1.25, typeFilter: str = None, axes: str = "xyz", transferDictionaries: bool = False, mantissa: int = 6, tolerance: float = 0.0001):
|
4345
|
+
def Explode(topology, origin=None, scale: float = 1.25, typeFilter: str = None, axes: str = "xyz", transferDictionaries: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False):
|
4279
4346
|
"""
|
4280
4347
|
Explodes the input topology. See https://en.wikipedia.org/wiki/Exploded-view_drawing.
|
4281
4348
|
|
@@ -4297,6 +4364,8 @@ class Topology():
|
|
4297
4364
|
The desired length of the mantissa. The default is 6.
|
4298
4365
|
tolerance : float , optional
|
4299
4366
|
The desired tolerance. The default is 0.0001.
|
4367
|
+
silent : bool , optional
|
4368
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
4300
4369
|
|
4301
4370
|
Returns
|
4302
4371
|
-------
|
@@ -4348,17 +4417,20 @@ class Topology():
|
|
4348
4417
|
return typeFilter
|
4349
4418
|
|
4350
4419
|
if not Topology.IsInstance(topology, "Topology"):
|
4351
|
-
|
4420
|
+
if not silent:
|
4421
|
+
print("Topology.Explode - Error: the input topology parameter is not a valid topology. Returning None.")
|
4352
4422
|
return None
|
4353
4423
|
if not Topology.IsInstance(origin, "Vertex"):
|
4354
4424
|
origin = Topology.CenterOfMass(topology)
|
4355
4425
|
if not typeFilter:
|
4356
4426
|
typeFilter = getTypeFilter(topology)
|
4357
4427
|
if not isinstance(typeFilter, str):
|
4358
|
-
|
4428
|
+
if not silent:
|
4429
|
+
print("Topology.Explode - Error: the input typeFilter parameter is not a valid string. Returning None.")
|
4359
4430
|
return None
|
4360
4431
|
if not isinstance(axes, str):
|
4361
|
-
|
4432
|
+
if not silent:
|
4433
|
+
print("Topology.Explode - Error: the input axes parameter is not a valid string. Returning None.")
|
4362
4434
|
return None
|
4363
4435
|
if Topology.IsInstance(topology, "Topology"):
|
4364
4436
|
# Hack to fix a weird bug that seems to be a problem with OCCT memory handling.
|
@@ -4368,7 +4440,8 @@ class Topology():
|
|
4368
4440
|
y_flag = "y" in axes
|
4369
4441
|
z_flag = "z" in axes
|
4370
4442
|
if not x_flag and not y_flag and not z_flag:
|
4371
|
-
|
4443
|
+
if not silent:
|
4444
|
+
print("Topology.Explode - Error: the input axes parameter is not a valid string. Returning None.")
|
4372
4445
|
return None
|
4373
4446
|
|
4374
4447
|
topologies = []
|
@@ -4405,7 +4478,7 @@ class Topology():
|
|
4405
4478
|
if transferDictionaries == True:
|
4406
4479
|
newTopology = Topology.SetDictionary(newTopology, Topology.Dictionary(aTopology))
|
4407
4480
|
newTopologies.append(newTopology)
|
4408
|
-
return Cluster.ByTopologies(newTopologies)
|
4481
|
+
return Cluster.ByTopologies(newTopologies, silent=silent)
|
4409
4482
|
|
4410
4483
|
@staticmethod
|
4411
4484
|
def ExportToBIM(topologies, path : str, overwrite: bool = False, version: str = "1.0.0",
|
@@ -6992,16 +7065,16 @@ class Topology():
|
|
6992
7065
|
return_topology = Wire.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance, silent=silent)
|
6993
7066
|
return return_topology
|
6994
7067
|
elif Topology.IsInstance(topology, "Face"):
|
6995
|
-
return_topology = Face.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
|
7068
|
+
return_topology = Face.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance, silent=silent)
|
6996
7069
|
return return_topology
|
6997
7070
|
elif Topology.IsInstance(topology, "Shell"):
|
6998
|
-
return_topology = Shell.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
|
7071
|
+
return_topology = Shell.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance, silent=silent)
|
6999
7072
|
return return_topology
|
7000
7073
|
elif Topology.IsInstance(topology, "Cell"):
|
7001
|
-
return_topology = Cell.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
|
7074
|
+
return_topology = Cell.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance, silent=silent)
|
7002
7075
|
return return_topology
|
7003
7076
|
elif Topology.IsInstance(topology, "CellComplex"):
|
7004
|
-
return_topology = CellComplex.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
|
7077
|
+
return_topology = CellComplex.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance, silent=silent)
|
7005
7078
|
return return_topology
|
7006
7079
|
elif Topology.IsInstance(topology, "Cluster"):
|
7007
7080
|
topologies = []
|
@@ -7009,7 +7082,7 @@ class Topology():
|
|
7009
7082
|
topologies += Cluster.FreeEdges(topology)
|
7010
7083
|
faces = Topology.Faces(topology)
|
7011
7084
|
for face in faces:
|
7012
|
-
topologies.append(Face.RemoveCollinearEdges(face, angTolerance=angTolerance, tolerance=tolerance))
|
7085
|
+
topologies.append(Face.RemoveCollinearEdges(face, angTolerance=angTolerance, tolerance=tolerance, silent=silent))
|
7013
7086
|
return_topology = Topology.SelfMerge(Cluster.ByTopologies(topologies), tolerance=tolerance)
|
7014
7087
|
return return_topology
|
7015
7088
|
|
topologicpy/Wire.py
CHANGED
@@ -465,15 +465,13 @@ class Wire():
|
|
465
465
|
from topologicpy.Cluster import Cluster
|
466
466
|
from topologicpy.Topology import Topology
|
467
467
|
from topologicpy.Vector import Vector
|
468
|
-
from topologicpy.Helper import Helper
|
468
|
+
from topologicpy.Helper import Helper
|
469
469
|
|
470
470
|
if not Topology.IsInstance(wire, "Wire"):
|
471
471
|
if not silent:
|
472
472
|
print("Wire.ByOffset - Error: The input wire parameter is not a valid wire. Returning None.")
|
473
473
|
return None
|
474
474
|
|
475
|
-
#temp_face = Face.ByWire(wire)
|
476
|
-
#original_area = Face.Area(temp_face)
|
477
475
|
if reverse == True:
|
478
476
|
fac = -1
|
479
477
|
else:
|
@@ -481,13 +479,10 @@ class Wire():
|
|
481
479
|
origin = Topology.Centroid(wire)
|
482
480
|
temp_vertices = [Topology.Vertices(wire)[0], Topology.Vertices(wire)[1], Topology.Centroid(wire)]
|
483
481
|
temp_face = Face.ByWire(Wire.ByVertices(temp_vertices, close=True, tolerance=tolerance), silent=silent)
|
484
|
-
temp_normal = Face.Normal(temp_face)
|
485
|
-
flat_wire = Topology.Flatten(wire, direction=temp_normal, origin=origin)
|
486
482
|
normal = Face.Normal(temp_face)
|
487
483
|
flat_wire = Topology.Flatten(wire, direction=normal, origin=origin)
|
488
484
|
original_edges = Topology.Edges(wire)
|
489
485
|
edges = Topology.Edges(flat_wire)
|
490
|
-
original_edges = Topology.Edges(wire)
|
491
486
|
offsets = []
|
492
487
|
offset_edges = []
|
493
488
|
final_vertices = []
|
@@ -495,9 +490,7 @@ class Wire():
|
|
495
490
|
edge_dictionaries = []
|
496
491
|
for i, edge in enumerate(edges):
|
497
492
|
d = Topology.Dictionary(original_edges[i])
|
498
|
-
d_offset = Dictionary.ValueAtKey(d, offsetKey)
|
499
|
-
if d_offset == None:
|
500
|
-
d_offset = offset
|
493
|
+
d_offset = Dictionary.ValueAtKey(d, key=offsetKey, defaultValue=offset)
|
501
494
|
d_offset = d_offset*fac
|
502
495
|
offsets.append(d_offset)
|
503
496
|
offset_edge = Edge.ByOffset2D(edge, d_offset)
|
@@ -595,23 +588,7 @@ class Wire():
|
|
595
588
|
v1 = Topology.SetDictionary(v1, Topology.Dictionary(v_a), silent=True)
|
596
589
|
if bisectors == True:
|
597
590
|
bisectors_list.append(Edge.ByVertices(v_a, v1))
|
598
|
-
|
599
|
-
|
600
|
-
# wire_edges = []
|
601
|
-
# for i in range(len(final_vertices)-1):
|
602
|
-
# v1 = final_vertices[i]
|
603
|
-
# v2 = final_vertices[i+1]
|
604
|
-
# w_e = Edge.ByVertices(v1,v2)
|
605
|
-
# #w_e = Edge.SetLength(w_e, Edge.Length(w_e)+(2*epsilon), bothSides = True)
|
606
|
-
# wire_edges.append(w_e)
|
607
|
-
# if Wire.IsClosed(wire):
|
608
|
-
# v1 = final_vertices[-1]
|
609
|
-
# v2 = final_vertices[0]
|
610
|
-
# #w_e = Edge.SetLength(w_e, Edge.Length(w_e)+(2*epsilon), bothSides = True)
|
611
|
-
# wire_edges.append(w_e)
|
612
|
-
|
613
591
|
return_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire), tolerance=tolerance, silent=silent)
|
614
|
-
#wire_edges = Topology.Edges(wire_edges)
|
615
592
|
wire_edges = [Edge.SetLength(w_e, Edge.Length(w_e)+(2*epsilon), bothSides=True) for w_e in Topology.Edges(return_wire)]
|
616
593
|
return_wire_edges = Topology.Edges(return_wire)
|
617
594
|
if transferDictionaries == True:
|
@@ -651,7 +628,6 @@ class Wire():
|
|
651
628
|
print("Wire.ByOffset - Warning: The resulting wire is non-manifold, please check your offsets.")
|
652
629
|
print("Wire.ByOffset - Warning: Pursuing a workaround, but it might take longer to complete.")
|
653
630
|
|
654
|
-
#cycles = Wire.Cycles(return_wire, maxVertices = len(final_vertices))
|
655
631
|
temp_wire = Topology.SelfMerge(Cluster.ByTopologies(wire_edges))
|
656
632
|
cycles = Wire.Cycles(temp_wire, maxVertices = len(final_vertices))
|
657
633
|
if len(cycles) > 0:
|
@@ -679,7 +655,6 @@ class Wire():
|
|
679
655
|
return_cycle = Topology.TransferDictionariesBySelectors(return_cycle, Topology.Vertices(return_wire), tranVertices=True, tolerance=tolerance, numWorkers=numWorkers)
|
680
656
|
return_cycle = Topology.TransferDictionariesBySelectors(return_cycle, sel_edges, tranEdges=True, tolerance=tolerance, numWorkers=numWorkers)
|
681
657
|
return_wire = return_cycle
|
682
|
-
|
683
658
|
return_wire = Topology.Unflatten(return_wire, direction=normal, origin=origin)
|
684
659
|
if transferDictionaries == True:
|
685
660
|
return_wire = Topology.SetDictionary(return_wire, Topology.Dictionary(wire), silent=True)
|
@@ -3728,7 +3703,7 @@ class Wire():
|
|
3728
3703
|
return None
|
3729
3704
|
|
3730
3705
|
new_wire = cleanup(wire)
|
3731
|
-
wires = Wire.Split(new_wire) if not Wire.IsManifold(new_wire) else [new_wire]
|
3706
|
+
wires = Wire.Split(new_wire) if not Wire.IsManifold(new_wire, silent=silent) else [new_wire]
|
3732
3707
|
|
3733
3708
|
processed_wires = [remove_collinear_vertices(w) for w in wires]
|
3734
3709
|
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.8.
|
1
|
+
__version__ = '0.8.43'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.43
|
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
|
@@ -2,37 +2,37 @@ topologicpy/ANN.py,sha256=DrNAhNHp-jSvsPc1fb7KVPU46cYmejAvghhknOM430Y,47932
|
|
2
2
|
topologicpy/Aperture.py,sha256=wNn5miB_IrGCBYuQ18HXQYRva20dUC3id4AJCulL7to,2723
|
3
3
|
topologicpy/BVH.py,sha256=Iwp_8VDG8ETE4330k7ifWxdI4jmWmv9h8e8IIIZZFGY,13043
|
4
4
|
topologicpy/CSG.py,sha256=uDkOSmc8m1V_k7T3UCerODhOSyYNO4FRDzoOqt0kEt8,15590
|
5
|
-
topologicpy/Cell.py,sha256=
|
6
|
-
topologicpy/CellComplex.py,sha256=
|
5
|
+
topologicpy/Cell.py,sha256=M4Xv4gabSgtKYYA-Wh0lgYEbRNRVF9zr4DYejOXJc-4,176278
|
6
|
+
topologicpy/CellComplex.py,sha256=c2B3mF1c3iwOfT-V0JWt9qNcFdd6DPR0aBOE2UnZTn4,61165
|
7
7
|
topologicpy/Cluster.py,sha256=wvfMAx6aPrSAt5nQ4--KnqD4EK9MGjch6Dg985WF7JQ,58748
|
8
8
|
topologicpy/Color.py,sha256=FcR0-__giyGQqvgiOrG8GkA65arHbiS33Si-QbUADPI,23362
|
9
9
|
topologicpy/Context.py,sha256=G3CwMvN8Jw2rnQRwB-n4MaQq_wLS0vPimbXKwsdMJ80,3055
|
10
10
|
topologicpy/DGL.py,sha256=HQXy9iDnrvWGDxaBfe5pRbweQ2zLBvAf6UdjfhKkQYI,139041
|
11
|
-
topologicpy/Dictionary.py,sha256=
|
12
|
-
topologicpy/Edge.py,sha256=
|
11
|
+
topologicpy/Dictionary.py,sha256=sPskW5bopbDzLz6MGKm8lN_OeyeAgsqdLvwwNcG0J3g,44690
|
12
|
+
topologicpy/Edge.py,sha256=dLoAPuRKbjVg_dzloTgjRnQyv_05U9nfrtLO3tqyuys,74167
|
13
13
|
topologicpy/EnergyModel.py,sha256=Pyb28gDDwhzlQIH0xqAygqS0P3SJxWyyV7OWS_AAfRs,53856
|
14
|
-
topologicpy/Face.py,sha256=
|
14
|
+
topologicpy/Face.py,sha256=pN1fssyDLYWf1vU0NOBRx69DaUL958wRSxT-7VBCuCg,203184
|
15
15
|
topologicpy/Graph.py,sha256=GykBbB8KKcy2oPV2Dsnz_vkyWGgczxLi0puVx5NJUYU,648088
|
16
16
|
topologicpy/Grid.py,sha256=EbI2NcYhQDpD5mItd7A1Lpr8Puuf87vZPWuoh7_gChQ,18483
|
17
17
|
topologicpy/Helper.py,sha256=qEsE4yaboEGW94q9lFCff0I_JwwTTQnDAFXw006yHaQ,31203
|
18
18
|
topologicpy/Honeybee.py,sha256=yctkwfdupKnp7bAOjP1Z4YaYpRrWoMEb4gz9Z5zaWwE,21751
|
19
19
|
topologicpy/Matrix.py,sha256=LqVckk2qTwKwEo79eyNsOrHVSHdO82JCREcfy6WIk4I,22716
|
20
20
|
topologicpy/Neo4j.py,sha256=ELKmON7R16j1kQD8xRHDGGCvzjIM2HGHNekdaXDUw6w,22371
|
21
|
-
topologicpy/Plotly.py,sha256=
|
21
|
+
topologicpy/Plotly.py,sha256=SqoQOFqchfDY52_mTGyBOqE_OPEfBI48YI3OyuJ7JQw,123758
|
22
22
|
topologicpy/Polyskel.py,sha256=oVfM4lqSMPTjnkHfsRU9VI8Blt6Vf0LVPkD9ebz7Wmw,27082
|
23
23
|
topologicpy/PyG.py,sha256=zvV6jtnol_aFiN6JRoMpYwBVfOU2aFs9gdWSdEo6mtU,109757
|
24
24
|
topologicpy/ShapeGrammar.py,sha256=UVb8VPwVKd6V3zDTNzpBecQPgYo1EjSsS10XJ8k5YcI,23364
|
25
25
|
topologicpy/Shell.py,sha256=fx0WTndC8blkvWe38nKsJsI_AmklOA0qsjU0gbZp4b4,90501
|
26
26
|
topologicpy/Speckle.py,sha256=-eiTqJugd7pHiHpD3pDUcDO6CGhVyPV14HFRzaqEoaw,18187
|
27
27
|
topologicpy/Sun.py,sha256=_VBBAUIDhvpkp72JBZlv7k9qx9jYubm3yM56UZ1Nc6c,36837
|
28
|
-
topologicpy/Topology.py,sha256=
|
28
|
+
topologicpy/Topology.py,sha256=tl5VTJIG3lZfIZ88nN9-tzE571gc8FxFqDF4t_Yuekw,471333
|
29
29
|
topologicpy/Vector.py,sha256=X12eqskn28bdB7sLY1EZhq3noPYzPbNEgHPb4a959ss,42302
|
30
30
|
topologicpy/Vertex.py,sha256=RlGQnxQSb_kAus3tJgXd-v-Ptubtt09PQPA9IMwfXmI,84835
|
31
|
-
topologicpy/Wire.py,sha256=
|
31
|
+
topologicpy/Wire.py,sha256=sJE8qwqYOomvN3snMWmj2P2-Sq25ul_OQ95YFz6DFUw,230553
|
32
32
|
topologicpy/__init__.py,sha256=RMftibjgAnHB1vdL-muo71RwMS4972JCxHuRHOlU428,928
|
33
|
-
topologicpy/version.py,sha256=
|
34
|
-
topologicpy-0.8.
|
35
|
-
topologicpy-0.8.
|
36
|
-
topologicpy-0.8.
|
37
|
-
topologicpy-0.8.
|
38
|
-
topologicpy-0.8.
|
33
|
+
topologicpy/version.py,sha256=hF3_b4wm6P2C7FhxNisjLlDWfDYZXkMWBDfjYGulhT4,23
|
34
|
+
topologicpy-0.8.43.dist-info/licenses/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
|
35
|
+
topologicpy-0.8.43.dist-info/METADATA,sha256=5dzgC4p5xWYC7uU9VOqvU-PT1fTDCOqSl_5uGk97oZQ,10535
|
36
|
+
topologicpy-0.8.43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
37
|
+
topologicpy-0.8.43.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
38
|
+
topologicpy-0.8.43.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|