topologicpy 0.8.33__py3-none-any.whl → 0.8.36__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/BVH.py +4 -4
- topologicpy/CSG.py +5 -5
- topologicpy/Cell.py +17 -17
- topologicpy/CellComplex.py +3 -188
- topologicpy/Cluster.py +2 -2
- topologicpy/Dictionary.py +121 -2
- topologicpy/Edge.py +14 -14
- topologicpy/Face.py +31 -31
- topologicpy/Graph.py +105 -65
- topologicpy/Helper.py +56 -4
- topologicpy/Matrix.py +3 -3
- topologicpy/Neo4j.py +1 -1
- topologicpy/Plotly.py +29 -7
- topologicpy/ShapeGrammar.py +7 -7
- topologicpy/Shell.py +123 -96
- topologicpy/Topology.py +231 -46
- topologicpy/Vector.py +5 -5
- topologicpy/Vertex.py +6 -6
- topologicpy/Wire.py +21 -21
- topologicpy/version.py +1 -1
- {topologicpy-0.8.33.dist-info → topologicpy-0.8.36.dist-info}/METADATA +1 -1
- topologicpy-0.8.36.dist-info/RECORD +38 -0
- topologicpy-0.8.33.dist-info/RECORD +0 -38
- {topologicpy-0.8.33.dist-info → topologicpy-0.8.36.dist-info}/WHEEL +0 -0
- {topologicpy-0.8.33.dist-info → topologicpy-0.8.36.dist-info}/licenses/LICENSE +0 -0
- {topologicpy-0.8.33.dist-info → topologicpy-0.8.36.dist-info}/top_level.txt +0 -0
topologicpy/Topology.py
CHANGED
@@ -1079,7 +1079,7 @@ class Topology():
|
|
1079
1079
|
tolerance : float , optional
|
1080
1080
|
The desired tolerance. The default is 0.0001.
|
1081
1081
|
silent : bool , optional
|
1082
|
-
If set to True,
|
1082
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1083
1083
|
|
1084
1084
|
Returns
|
1085
1085
|
-------
|
@@ -1226,7 +1226,7 @@ class Topology():
|
|
1226
1226
|
tolerance : float , optional
|
1227
1227
|
The desired tolerance. The default is 0.0001.
|
1228
1228
|
silent : bool , optional
|
1229
|
-
If set to True,
|
1229
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1230
1230
|
|
1231
1231
|
Returns
|
1232
1232
|
-------
|
@@ -1442,7 +1442,7 @@ class Topology():
|
|
1442
1442
|
tolerance : float , optional
|
1443
1443
|
The desired tolerance. The default is 0.0001.
|
1444
1444
|
silent : bool , optional
|
1445
|
-
If set to True,
|
1445
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1446
1446
|
|
1447
1447
|
Returns
|
1448
1448
|
-------
|
@@ -1869,7 +1869,7 @@ class Topology():
|
|
1869
1869
|
tolerance : float , optional
|
1870
1870
|
The desired tolerance. The default is 0.0001.
|
1871
1871
|
silent : bool , optional
|
1872
|
-
If set to True,
|
1872
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1873
1873
|
|
1874
1874
|
Returns
|
1875
1875
|
-------
|
@@ -2093,7 +2093,7 @@ class Topology():
|
|
2093
2093
|
tolerance : float , optional
|
2094
2094
|
The desired tolerance. The default is 0.0001.
|
2095
2095
|
silent : bool , optional
|
2096
|
-
If set to True,
|
2096
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
2097
2097
|
|
2098
2098
|
Returns
|
2099
2099
|
-------
|
@@ -2153,7 +2153,7 @@ class Topology():
|
|
2153
2153
|
tolerance : float , optional
|
2154
2154
|
The desired tolerance. The default is 0.0001.
|
2155
2155
|
silent : bool , optional
|
2156
|
-
If set to True,
|
2156
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
2157
2157
|
Returns
|
2158
2158
|
-------
|
2159
2159
|
list
|
@@ -2623,7 +2623,7 @@ class Topology():
|
|
2623
2623
|
tolerance : float , optional
|
2624
2624
|
The desired tolerance. The default is 0.0001.
|
2625
2625
|
silent : bool , optional
|
2626
|
-
If set to True,
|
2626
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
2627
2627
|
|
2628
2628
|
Returns
|
2629
2629
|
-------
|
@@ -3079,7 +3079,7 @@ class Topology():
|
|
3079
3079
|
tolerance : float , optional
|
3080
3080
|
The desired tolerance. The default is 0.0001.
|
3081
3081
|
silent : bool , optional
|
3082
|
-
If set to True,
|
3082
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
3083
3083
|
|
3084
3084
|
Returns
|
3085
3085
|
-------
|
@@ -3313,7 +3313,7 @@ class Topology():
|
|
3313
3313
|
tolerance : float , optional
|
3314
3314
|
The desired tolerance. The default is 0.0001.
|
3315
3315
|
silent : bool , optional
|
3316
|
-
If set to True,
|
3316
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
3317
3317
|
|
3318
3318
|
Returns
|
3319
3319
|
-------
|
@@ -3551,7 +3551,7 @@ class Topology():
|
|
3551
3551
|
mantissa : int , optional
|
3552
3552
|
The desired length of the mantissa. The default is 6.
|
3553
3553
|
silent : bool , optional
|
3554
|
-
If set to True,
|
3554
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
3555
3555
|
|
3556
3556
|
Returns
|
3557
3557
|
-------
|
@@ -3718,7 +3718,7 @@ class Topology():
|
|
3718
3718
|
keys : str or list or comma-separated str input parameters
|
3719
3719
|
The key or keys in the topology's dictionary to use for clustering.
|
3720
3720
|
silent : bool , optional
|
3721
|
-
If set to True,
|
3721
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
3722
3722
|
|
3723
3723
|
|
3724
3724
|
Returns
|
@@ -4101,7 +4101,7 @@ class Topology():
|
|
4101
4101
|
tolerance : float , optional
|
4102
4102
|
The desired tolerance. The default is 0.0001.
|
4103
4103
|
silent : bool , optional
|
4104
|
-
If set to True,
|
4104
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
4105
4105
|
|
4106
4106
|
Returns
|
4107
4107
|
-------
|
@@ -5667,7 +5667,7 @@ class Topology():
|
|
5667
5667
|
mantissa : int , optional
|
5668
5668
|
The desired length of the mantissa. The default is 6.
|
5669
5669
|
silent : bool , optional
|
5670
|
-
If set to True,
|
5670
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
5671
5671
|
|
5672
5672
|
Returns
|
5673
5673
|
-------
|
@@ -5811,7 +5811,7 @@ class Topology():
|
|
5811
5811
|
tolerance : float , ptional
|
5812
5812
|
The desired tolerance. The default is 0.0001.
|
5813
5813
|
silent : bool , optional
|
5814
|
-
If set to True,
|
5814
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
5815
5815
|
|
5816
5816
|
Returns
|
5817
5817
|
-------
|
@@ -5878,7 +5878,7 @@ class Topology():
|
|
5878
5878
|
tolerance : float , ptional
|
5879
5879
|
The desired tolerance. The default is 0.0001.
|
5880
5880
|
silent : bool , optional
|
5881
|
-
If set to True,
|
5881
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
5882
5882
|
|
5883
5883
|
Returns
|
5884
5884
|
-------
|
@@ -6071,7 +6071,7 @@ class Topology():
|
|
6071
6071
|
tolerance : float , optional
|
6072
6072
|
The desired tolerance. The default is 0.0001.
|
6073
6073
|
silent : bool , optional
|
6074
|
-
If set to True,
|
6074
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
6075
6075
|
|
6076
6076
|
Returns
|
6077
6077
|
-------
|
@@ -6259,7 +6259,7 @@ class Topology():
|
|
6259
6259
|
tolerance : float , optional
|
6260
6260
|
The desired tolerance. The default is 0.0001.
|
6261
6261
|
silent : bool , optional
|
6262
|
-
If set to True,
|
6262
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
6263
6263
|
|
6264
6264
|
Returns
|
6265
6265
|
-------
|
@@ -6340,7 +6340,7 @@ class Topology():
|
|
6340
6340
|
tolerance : float , optional
|
6341
6341
|
The desired tolerance. The default is 0.0001.
|
6342
6342
|
silent : bool , optional
|
6343
|
-
If set to True,
|
6343
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
6344
6344
|
Returns
|
6345
6345
|
-------
|
6346
6346
|
list
|
@@ -6389,7 +6389,7 @@ class Topology():
|
|
6389
6389
|
tolerance : float , optional
|
6390
6390
|
The desired tolerance. The default is 0.0001.
|
6391
6391
|
silent : bool , optional
|
6392
|
-
If set to True,
|
6392
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
6393
6393
|
Returns
|
6394
6394
|
-------
|
6395
6395
|
list
|
@@ -6474,7 +6474,7 @@ class Topology():
|
|
6474
6474
|
tolerance : float , optional
|
6475
6475
|
The desired tolerance. The default is 0.0001.
|
6476
6476
|
silent : bool , optional
|
6477
|
-
If set to True,
|
6477
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
6478
6478
|
|
6479
6479
|
Returns
|
6480
6480
|
-------
|
@@ -6881,7 +6881,7 @@ class Topology():
|
|
6881
6881
|
mantissa : int , optional
|
6882
6882
|
The desired length of the mantissa. The default is 6.
|
6883
6883
|
silent : bool , optional
|
6884
|
-
If set to True,
|
6884
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
6885
6885
|
|
6886
6886
|
Returns
|
6887
6887
|
-------
|
@@ -6963,7 +6963,7 @@ class Topology():
|
|
6963
6963
|
tolerance : float , optional
|
6964
6964
|
The desired tolerance. The default is 0.0001.
|
6965
6965
|
silent : bool , optional
|
6966
|
-
If set to True,
|
6966
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
6967
6967
|
|
6968
6968
|
Returns
|
6969
6969
|
-------
|
@@ -7049,7 +7049,7 @@ class Topology():
|
|
7049
7049
|
tolerance : float , optional
|
7050
7050
|
The desired tolerance. The default is 0.0001.
|
7051
7051
|
silent : bool , optional
|
7052
|
-
If set to True,
|
7052
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
7053
7053
|
|
7054
7054
|
Returns
|
7055
7055
|
-------
|
@@ -7870,7 +7870,7 @@ class Topology():
|
|
7870
7870
|
dictionary : topologic_core.Dictionary
|
7871
7871
|
The input dictionary.
|
7872
7872
|
silent : bool , optional
|
7873
|
-
If set to True,
|
7873
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
7874
7874
|
|
7875
7875
|
Returns
|
7876
7876
|
-------
|
@@ -7897,13 +7897,6 @@ class Topology():
|
|
7897
7897
|
calframe = inspect.getouterframes(curframe, 2)
|
7898
7898
|
print('caller name:', calframe[1][3])
|
7899
7899
|
return topology
|
7900
|
-
# if len(dictionary.Keys()) < 1:
|
7901
|
-
# if not silent:
|
7902
|
-
# print("Topology.SetDictionary - Warning: the input dictionary parameter is empty. Returning original input.")
|
7903
|
-
# curframe = inspect.currentframe()
|
7904
|
-
# calframe = inspect.getouterframes(curframe, 2)
|
7905
|
-
# print('caller name:', calframe[1][3])
|
7906
|
-
# return topology
|
7907
7900
|
_ = topology.SetDictionary(dictionary)
|
7908
7901
|
return topology
|
7909
7902
|
|
@@ -8115,7 +8108,7 @@ class Topology():
|
|
8115
8108
|
tolerance : float , optional
|
8116
8109
|
The desired tolerance. The default is 0.0001.
|
8117
8110
|
silent : bool , optional
|
8118
|
-
If set to True,
|
8111
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
8119
8112
|
Returns
|
8120
8113
|
-------
|
8121
8114
|
list
|
@@ -8172,9 +8165,12 @@ class Topology():
|
|
8172
8165
|
|
8173
8166
|
showEdges=True,
|
8174
8167
|
edgeWidth=None,
|
8175
|
-
edgeWidthKey
|
8168
|
+
edgeWidthKey=None,
|
8176
8169
|
edgeColor=None,
|
8177
|
-
edgeColorKey
|
8170
|
+
edgeColorKey=None,
|
8171
|
+
edgeDash=False,
|
8172
|
+
edgeDashKey=None,
|
8173
|
+
|
8178
8174
|
edgeLabelKey=None,
|
8179
8175
|
showEdgeLabel = False,
|
8180
8176
|
edgeGroupKey=None,
|
@@ -8188,7 +8184,7 @@ class Topology():
|
|
8188
8184
|
faceOpacity=0.5,
|
8189
8185
|
faceOpacityKey=None,
|
8190
8186
|
faceColor="#FAFAFA",
|
8191
|
-
faceColorKey
|
8187
|
+
faceColorKey=None,
|
8192
8188
|
faceLabelKey=None,
|
8193
8189
|
faceGroupKey=None,
|
8194
8190
|
faceGroups=[],
|
@@ -8227,10 +8223,10 @@ class Topology():
|
|
8227
8223
|
cbUnits="",
|
8228
8224
|
colorScale="Viridis",
|
8229
8225
|
|
8230
|
-
sagitta
|
8231
|
-
absolute
|
8232
|
-
sides
|
8233
|
-
angle
|
8226
|
+
sagitta=0,
|
8227
|
+
absolute=False,
|
8228
|
+
sides=8,
|
8229
|
+
angle=0,
|
8234
8230
|
mantissa=6,
|
8235
8231
|
tolerance=0.0001,
|
8236
8232
|
silent=False):
|
@@ -8300,6 +8296,10 @@ class Topology():
|
|
8300
8296
|
The default is "black".
|
8301
8297
|
edgeColorKey : str , optional
|
8302
8298
|
The key under which to find the color of the edge. The default is None.
|
8299
|
+
edgeDash : bool , optional
|
8300
|
+
If set to True, the edges are drawn as dashed lines. The default is False.
|
8301
|
+
edgeDashKey : str , optional
|
8302
|
+
The key under which to find the boolean flag to draw edges as dashed lines. The default is None.
|
8303
8303
|
edgeWidthKey : str , optional
|
8304
8304
|
The key under which to find the width of the edge. The default is None.
|
8305
8305
|
edgeLabelKey : str , optional
|
@@ -8414,7 +8414,7 @@ class Topology():
|
|
8414
8414
|
tolerance : float , optional
|
8415
8415
|
The desired tolerance. The default is 0.0001.
|
8416
8416
|
silent : bool , optional
|
8417
|
-
If set to True,
|
8417
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
8418
8418
|
|
8419
8419
|
Returns
|
8420
8420
|
-------
|
@@ -8605,7 +8605,7 @@ class Topology():
|
|
8605
8605
|
tolerance : float , optional
|
8606
8606
|
The desired tolerance. The default is 0.0001.
|
8607
8607
|
silent : bool , optional
|
8608
|
-
If set to True,
|
8608
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
8609
8609
|
Returns
|
8610
8610
|
-------
|
8611
8611
|
list
|
@@ -8760,7 +8760,7 @@ class Topology():
|
|
8760
8760
|
tolerance : float , optional
|
8761
8761
|
The desired tolerance. The default is 0.0001.
|
8762
8762
|
silent : bool , optional
|
8763
|
-
If set to True,
|
8763
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
8764
8764
|
|
8765
8765
|
|
8766
8766
|
Returns
|
@@ -8861,6 +8861,177 @@ class Topology():
|
|
8861
8861
|
pass
|
8862
8862
|
return returnTopology
|
8863
8863
|
|
8864
|
+
@staticmethod
|
8865
|
+
def SubCombinations(topology,
|
8866
|
+
subTopologyType=None,
|
8867
|
+
minSize: int = 2,
|
8868
|
+
maxSize: int = None,
|
8869
|
+
maxCombinations: int = 100,
|
8870
|
+
timeLimit: int = 10,
|
8871
|
+
removeCoplanarFaces: bool = False,
|
8872
|
+
removeCollinearEdges: bool = False,
|
8873
|
+
tolerance: float = 0.001,
|
8874
|
+
silent: bool = False):
|
8875
|
+
"""
|
8876
|
+
Creates connected sub-combination topologies of the input topology. Warning: This is prone to combinatorial explosion.
|
8877
|
+
|
8878
|
+
Parameters
|
8879
|
+
----------
|
8880
|
+
topology : topologic_core.Topology
|
8881
|
+
The input topology. This cannot be vertex or edge.
|
8882
|
+
subTopologyType : str , optional except when topology is a Cluster
|
8883
|
+
The type of subTopology to include in the combinations.
|
8884
|
+
If the input is a Cluster, you must specify the subTopologyType.
|
8885
|
+
The options are (case insensitive):
|
8886
|
+
- "CellComplex"
|
8887
|
+
- "Shell"
|
8888
|
+
- "Wire"
|
8889
|
+
If set to None, it will be set according to the input topology type as follows:
|
8890
|
+
- "Cluster" -> User-defined
|
8891
|
+
- "CellComplex" -> "CellComplexes"
|
8892
|
+
- "Cell" -> "Shells"
|
8893
|
+
- "Shell" -> "Shells"
|
8894
|
+
- "Face" -> "Wires"
|
8895
|
+
- "Wire" -> "Wires"
|
8896
|
+
- "Edge" -> None
|
8897
|
+
- "Vertex" -> None
|
8898
|
+
- "Graph" -> "Graphs"
|
8899
|
+
minSize : int , optional
|
8900
|
+
The minimum number of subtopologies to include in a combination. This number cannot be less than 2. The default is 2.
|
8901
|
+
maxSize : int , optional
|
8902
|
+
The maximum number of faces to include in a combinations. This number cannot be less than the number of subtopologies minus 1. The default is None which means the maximum will be set to the number of subtopologies minus 1.
|
8903
|
+
maxCombinations : int , optional
|
8904
|
+
The maximum number of combinations to create. The default is 100.
|
8905
|
+
timeLimit : int , optional
|
8906
|
+
The time limit in seconds. The default is 10 seconds. Note that this time limit only applies to creating the combination indices and not the actual Shells.
|
8907
|
+
removeCoplanarFaces : bool , optional
|
8908
|
+
If set to True, coplanar faces are removed. Otherwise they are not. The default is False.
|
8909
|
+
removeCollinearEdges : bool , optional
|
8910
|
+
If set to True, collinear edges are removed. Otherwise they are not. The default is False.
|
8911
|
+
tolerance : float , optional
|
8912
|
+
The desired tolerance. The default is 0.0001.
|
8913
|
+
silent : bool , optional
|
8914
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
8915
|
+
|
8916
|
+
Returns
|
8917
|
+
-------
|
8918
|
+
list
|
8919
|
+
The list of created sub-combinations.
|
8920
|
+
|
8921
|
+
"""
|
8922
|
+
from topologicpy.Cluster import Cluster
|
8923
|
+
from topologicpy.Graph import Graph
|
8924
|
+
from topologicpy.Topology import Topology
|
8925
|
+
from topologicpy.Dictionary import Dictionary
|
8926
|
+
from topologicpy.Helper import Helper
|
8927
|
+
import random
|
8928
|
+
import time
|
8929
|
+
|
8930
|
+
if Topology.IsInstance(topology, "cluster") and subTopologyType is None:
|
8931
|
+
if not silent:
|
8932
|
+
print("Topology.SubCombinations - Error: The topology input parameter is a cluster but the subTopologyType is not specified. Returning None.")
|
8933
|
+
return None
|
8934
|
+
|
8935
|
+
if Topology.IsInstance(topology, "vertex") or Topology.IsInstance(topology, "edge"):
|
8936
|
+
if not silent:
|
8937
|
+
print("Topology.SubCombinations - Error: The topology input parameter cannot be a vertex or an edge. Returning None.")
|
8938
|
+
return None
|
8939
|
+
|
8940
|
+
mapping = {
|
8941
|
+
"cellcomplex": "cell",
|
8942
|
+
"cell": "face",
|
8943
|
+
"shell": "face",
|
8944
|
+
"face": "edge",
|
8945
|
+
"wire": "edge",
|
8946
|
+
"graph": "vertex"
|
8947
|
+
}
|
8948
|
+
|
8949
|
+
type_string = Topology.TypeAsString(topology).lower()
|
8950
|
+
if type_string not in mapping:
|
8951
|
+
if not silent:
|
8952
|
+
print(f"Topology.SubCombinations - Error: The input topology type ({type_string}) is not supported. Returning None.")
|
8953
|
+
return None
|
8954
|
+
|
8955
|
+
if subTopologyType is None:
|
8956
|
+
subTopologyType = mapping[type_string]
|
8957
|
+
subTopologyType = subTopologyType.lower()
|
8958
|
+
|
8959
|
+
if subTopologyType not in ["cell", "face", "edge", "vertex"]:
|
8960
|
+
if not silent:
|
8961
|
+
print(f"Topology.SubCombinations - Error: Unknown subTopologyType: {subTopologyType}. Returning None.")
|
8962
|
+
return None
|
8963
|
+
|
8964
|
+
if ((type_string in ["cell", "shell"]) and subTopologyType not in ["face", "edge"]) or \
|
8965
|
+
((type_string in ["wire", "face"]) and subTopologyType != "edge"):
|
8966
|
+
if not silent:
|
8967
|
+
print(f"Topology.SubCombinations - Error: The subTopology type {subTopologyType} is not appropriate for topology of type {type_string}. Returning None.")
|
8968
|
+
return None
|
8969
|
+
|
8970
|
+
all_subtopologies = Topology.SubTopologies(topology, subTopologyType=subTopologyType, silent=silent)
|
8971
|
+
num_subtopologies = len(all_subtopologies)
|
8972
|
+
if num_subtopologies < 2:
|
8973
|
+
if not silent:
|
8974
|
+
print("Topology.SubCombinations - Warning: Not enough subtopologies found. Returning empty list.")
|
8975
|
+
return []
|
8976
|
+
|
8977
|
+
indices = list(range(num_subtopologies))
|
8978
|
+
minSize = max(2, minSize)
|
8979
|
+
maxSize = num_subtopologies - 1 if maxSize is None else min(maxSize, num_subtopologies - 1)
|
8980
|
+
|
8981
|
+
subt_label_key = "__index__"
|
8982
|
+
all_subtopologies = [Topology.SetDictionary(subt, Dictionary.ByKeyValue(subt_label_key, i)) for i, subt in enumerate(all_subtopologies)]
|
8983
|
+
|
8984
|
+
group_sizes = list(range(minSize, maxSize + 1))
|
8985
|
+
num_sizes = len(group_sizes)
|
8986
|
+
per_size_combinations = maxCombinations // num_sizes
|
8987
|
+
per_size_time = timeLimit / num_sizes
|
8988
|
+
|
8989
|
+
adjacency = Dictionary.AdjacencyDictionary(topology, subTopologyType=subTopologyType, labelKey=subt_label_key, weightKey=None, includeWeights=False)
|
8990
|
+
|
8991
|
+
results = []
|
8992
|
+
seen_groups = set()
|
8993
|
+
|
8994
|
+
for group_size in reversed(group_sizes):
|
8995
|
+
size_start_time = time.time()
|
8996
|
+
remaining = per_size_combinations
|
8997
|
+
tries = 0
|
8998
|
+
max_tries = per_size_combinations * 10
|
8999
|
+
|
9000
|
+
while remaining > 0 and (time.time() - size_start_time) < per_size_time and tries < max_tries:
|
9001
|
+
random.shuffle(indices)
|
9002
|
+
for seed in indices:
|
9003
|
+
if (time.time() - size_start_time) > per_size_time:
|
9004
|
+
break
|
9005
|
+
group = Helper.Grow(seed, group_size, adjacency, visited_global=seen_groups)
|
9006
|
+
if group:
|
9007
|
+
key = tuple(sorted(group))
|
9008
|
+
if key not in seen_groups:
|
9009
|
+
tries += 1
|
9010
|
+
seen_groups.add(key)
|
9011
|
+
results.append(group)
|
9012
|
+
remaining -= 1
|
9013
|
+
if remaining <= 0 or tries >= max_tries:
|
9014
|
+
break
|
9015
|
+
|
9016
|
+
return_combinations = []
|
9017
|
+
for result in reversed(results):
|
9018
|
+
subtopologies = [all_subtopologies[i] for i in result]
|
9019
|
+
# Special case for graphs
|
9020
|
+
if Topology.IsInstance(topology, "Graph"):
|
9021
|
+
edges = Graph.Edges(topology, vertices = subtopologies)
|
9022
|
+
combination = Graph.ByVerticesEdges(subtopologies, edges)
|
9023
|
+
else:
|
9024
|
+
combination = Topology.SelfMerge(Cluster.ByTopologies(subtopologies), tolerance=tolerance)
|
9025
|
+
if removeCollinearEdges:
|
9026
|
+
if Topology.IsInstance(combination, "face") or Topology.IsInstance(combination, "wire"):
|
9027
|
+
combination = Topology.RemoveCollinearEdges(combination, tolerance=tolerance)
|
9028
|
+
if removeCoplanarFaces:
|
9029
|
+
if Topology.IsInstance(combination, "cellcomplex") or Topology.IsInstance(combination, "cell") or Topology.IsInstance(combination, "shell"):
|
9030
|
+
combination = Topology.RemoveCoplanarFaces(combination, tolerance=tolerance)
|
9031
|
+
return_combinations.append(combination)
|
9032
|
+
|
9033
|
+
return return_combinations
|
9034
|
+
|
8864
9035
|
@staticmethod
|
8865
9036
|
def Taper(topology, origin=None, ratioRange: list = [0, 1], triangulate: bool = False, mantissa: int = 6, tolerance: float = 0.0001):
|
8866
9037
|
"""
|
@@ -9188,7 +9359,7 @@ class Topology():
|
|
9188
9359
|
return Topology.SubTopologies(topology=topology, subTopologyType="cluster")
|
9189
9360
|
|
9190
9361
|
@staticmethod
|
9191
|
-
def SubTopologies(topology, subTopologyType="vertex"):
|
9362
|
+
def SubTopologies(topology, subTopologyType="vertex", silent: bool = False):
|
9192
9363
|
"""
|
9193
9364
|
Returns the subtopologies of the input topology as specified by the subTopologyType input string.
|
9194
9365
|
|
@@ -9198,7 +9369,8 @@ class Topology():
|
|
9198
9369
|
The input topology.
|
9199
9370
|
subTopologyType : str , optional
|
9200
9371
|
The requested subtopology type. This can be one of "vertex", "edge", "wire", "face", "shell", "cell", "cellcomplex", "cluster". It is case insensitive. The default is "vertex".
|
9201
|
-
|
9372
|
+
silent : bool , optional
|
9373
|
+
If set to True, no warnings or errors will be printed. The default is False.
|
9202
9374
|
Returns
|
9203
9375
|
-------
|
9204
9376
|
list
|
@@ -9206,15 +9378,28 @@ class Topology():
|
|
9206
9378
|
|
9207
9379
|
"""
|
9208
9380
|
from topologicpy.Face import Face
|
9381
|
+
from topologicpy.Graph import Graph
|
9209
9382
|
|
9210
|
-
if not Topology.IsInstance(topology, "Topology"):
|
9211
|
-
|
9383
|
+
if not Topology.IsInstance(topology, "Topology") and not Topology.IsInstance(topology, "Graph"):
|
9384
|
+
if not silent:
|
9385
|
+
print("Topology.SubTopologies - Error: the input topology parameter is not a valid topology. Returning None.")
|
9212
9386
|
return None
|
9213
9387
|
if Topology.TypeAsString(topology).lower() == subTopologyType.lower():
|
9214
9388
|
return [topology]
|
9215
9389
|
|
9216
9390
|
subTopologies = []
|
9217
9391
|
|
9392
|
+
# Special case for Graphs
|
9393
|
+
if Topology.IsInstance(topology, "graph"):
|
9394
|
+
if subTopologyType.lower() == "vertex":
|
9395
|
+
return Graph.Vertices(topology)
|
9396
|
+
elif subTopologyType.lower() == "edge":
|
9397
|
+
return Graph.Edges(topology)
|
9398
|
+
else:
|
9399
|
+
if not silent:
|
9400
|
+
print(f"Topology.SubTopologies - Error: the input subTopologyType parameter {subTopologyType} is not a valid subTopology of Graphs. Returning None.")
|
9401
|
+
return None
|
9402
|
+
|
9218
9403
|
# Spcecial case for faces to return vertices in CW/CCW order.
|
9219
9404
|
if Topology.IsInstance(topology, "face") and (subTopologyType.lower() == "vertex" or subTopologyType.lower() == "edge"):
|
9220
9405
|
wires = Face.Wires(topology)
|
topologicpy/Vector.py
CHANGED
@@ -372,7 +372,7 @@ class Vector(list):
|
|
372
372
|
tolerance : float , optional
|
373
373
|
The desired tolerance. The default is 0.0001.
|
374
374
|
silent : bool , optional
|
375
|
-
If set to True,
|
375
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
376
376
|
|
377
377
|
Returns
|
378
378
|
-------
|
@@ -420,7 +420,7 @@ class Vector(list):
|
|
420
420
|
tolerance : float , optional
|
421
421
|
The desired tolerance. The default is 0.0001.
|
422
422
|
silent : bool , optional
|
423
|
-
If set to True,
|
423
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
424
424
|
|
425
425
|
Returns
|
426
426
|
-------
|
@@ -530,7 +530,7 @@ class Vector(list):
|
|
530
530
|
mantissa : int , optional
|
531
531
|
The desired length of the mantissa. The default is 6.
|
532
532
|
silent : bool , optional
|
533
|
-
If set to True,
|
533
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
534
534
|
|
535
535
|
Returns
|
536
536
|
-------
|
@@ -580,7 +580,7 @@ class Vector(list):
|
|
580
580
|
tolerance : float, optional
|
581
581
|
the desired tolerance. The default is 0.0001.
|
582
582
|
silent : bool , optional
|
583
|
-
If set to True,
|
583
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
584
584
|
|
585
585
|
Returns
|
586
586
|
-------
|
@@ -627,7 +627,7 @@ class Vector(list):
|
|
627
627
|
tolerance : float, optional
|
628
628
|
the desired tolerance. The default is 0.0001.
|
629
629
|
silent : bool , optional
|
630
|
-
If set to True,
|
630
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
631
631
|
|
632
632
|
Returns
|
633
633
|
-------
|
topologicpy/Vertex.py
CHANGED
@@ -60,7 +60,7 @@ class Vertex():
|
|
60
60
|
mantissa : int , optional
|
61
61
|
The desired length of the mantissa. The default is 6.
|
62
62
|
silent : bool , optional
|
63
|
-
If set to True,
|
63
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
64
64
|
|
65
65
|
Returns
|
66
66
|
-------
|
@@ -1116,7 +1116,7 @@ class Vertex():
|
|
1116
1116
|
tolerance : float , optional
|
1117
1117
|
The tolerance for computing if the input vertex is external to the input topology. The default is 0.0001.
|
1118
1118
|
silent : bool , optional
|
1119
|
-
If set to True,
|
1119
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1120
1120
|
|
1121
1121
|
Returns
|
1122
1122
|
-------
|
@@ -1150,7 +1150,7 @@ class Vertex():
|
|
1150
1150
|
tolerance : float , optional
|
1151
1151
|
The tolerance for computing if the input vertex is internal to the input topology. The default is 0.0001.
|
1152
1152
|
silent : bool , optional
|
1153
|
-
If set to True,
|
1153
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1154
1154
|
|
1155
1155
|
Returns
|
1156
1156
|
-------
|
@@ -1265,7 +1265,7 @@ class Vertex():
|
|
1265
1265
|
tolerance : float , optional
|
1266
1266
|
The tolerance for computing if the input vertex is peripheral to the input topology. The default is 0.0001.
|
1267
1267
|
silent : bool , optional
|
1268
|
-
If set to True,
|
1268
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1269
1269
|
|
1270
1270
|
Returns
|
1271
1271
|
-------
|
@@ -1830,7 +1830,7 @@ class Vertex():
|
|
1830
1830
|
minDistance : float , optional
|
1831
1831
|
The desired minimum distance. The default is 0.0001.
|
1832
1832
|
silent : bool , optional
|
1833
|
-
If set to True,
|
1833
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1834
1834
|
|
1835
1835
|
Returns
|
1836
1836
|
-------
|
@@ -1915,7 +1915,7 @@ class Vertex():
|
|
1915
1915
|
mantissa : int , optional
|
1916
1916
|
The desired length of the mantissa. The default is 6.
|
1917
1917
|
silent : bool , optional
|
1918
|
-
If set to True,
|
1918
|
+
If set to True, error and warning messages are suppressed. The default is False.
|
1919
1919
|
|
1920
1920
|
Returns
|
1921
1921
|
-------
|