topologicpy 0.6.3__py3-none-any.whl → 0.7.0__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/Aperture.py +12 -13
- topologicpy/Cell.py +234 -210
- topologicpy/CellComplex.py +130 -118
- topologicpy/Cluster.py +108 -91
- topologicpy/Context.py +11 -7
- topologicpy/DGL.py +1 -1
- topologicpy/Dictionary.py +55 -65
- topologicpy/Edge.py +185 -148
- topologicpy/EnergyModel.py +23 -24
- topologicpy/Face.py +512 -313
- topologicpy/Graph.py +437 -349
- topologicpy/Grid.py +40 -43
- topologicpy/Honeybee.py +1 -1
- topologicpy/Matrix.py +28 -27
- topologicpy/Neo4j.py +5 -5
- topologicpy/Plotly.py +135 -51
- topologicpy/Shell.py +160 -145
- topologicpy/Sun.py +17 -13
- topologicpy/Topology.py +533 -765
- topologicpy/Vector.py +4 -3
- topologicpy/Vertex.py +145 -126
- topologicpy/Wire.py +542 -325
- topologicpy/version.py +1 -1
- {topologicpy-0.6.3.dist-info → topologicpy-0.7.0.dist-info}/METADATA +1 -1
- topologicpy-0.7.0.dist-info/RECORD +33 -0
- topologicpy-0.6.3.dist-info/RECORD +0 -33
- {topologicpy-0.6.3.dist-info → topologicpy-0.7.0.dist-info}/LICENSE +0 -0
- {topologicpy-0.6.3.dist-info → topologicpy-0.7.0.dist-info}/WHEEL +0 -0
- {topologicpy-0.6.3.dist-info → topologicpy-0.7.0.dist-info}/top_level.txt +0 -0
topologicpy/Topology.py
CHANGED
@@ -15,8 +15,6 @@
|
|
15
15
|
# this program. If not, see <https://www.gnu.org/licenses/>.
|
16
16
|
|
17
17
|
import topologic_core as topologic
|
18
|
-
from topologicpy.Aperture import Aperture
|
19
|
-
from topologicpy.Dictionary import Dictionary
|
20
18
|
import warnings
|
21
19
|
import uuid
|
22
20
|
import json
|
@@ -128,6 +126,7 @@ class WorkerProcess(Process):
|
|
128
126
|
|
129
127
|
def run(self):
|
130
128
|
from topologicpy.Vertex import Vertex
|
129
|
+
from topologicpy.Dictionary import Dictionary
|
131
130
|
for sink_item in self.sinks:
|
132
131
|
sink = Topology.ByBREPString(sink_item.sink_str)
|
133
132
|
sinkKeys = []
|
@@ -136,7 +135,7 @@ class WorkerProcess(Process):
|
|
136
135
|
for j, source_str in enumerate(self.sources):
|
137
136
|
source = Topology.ByBREPString(source_str)
|
138
137
|
flag = False
|
139
|
-
if
|
138
|
+
if Topology.IsInstance(source, "Vertex"):
|
140
139
|
flag = Vertex.IsInternal(source, sink, self.tolerance)
|
141
140
|
else:
|
142
141
|
flag = Vertex.IsInternal(iv, source, self.tolerance)
|
@@ -205,7 +204,7 @@ class Topology():
|
|
205
204
|
|
206
205
|
Parameters
|
207
206
|
----------
|
208
|
-
topology :
|
207
|
+
topology : topologic_core.Topology
|
209
208
|
The input topology.
|
210
209
|
apertures : list
|
211
210
|
The input list of apertures.
|
@@ -218,7 +217,7 @@ class Topology():
|
|
218
217
|
|
219
218
|
Returns
|
220
219
|
-------
|
221
|
-
|
220
|
+
topologic_core.Topology
|
222
221
|
The input topology with the apertures added to it.
|
223
222
|
|
224
223
|
"""
|
@@ -244,7 +243,7 @@ class Topology():
|
|
244
243
|
ap = ap + 1
|
245
244
|
return None
|
246
245
|
|
247
|
-
if not
|
246
|
+
if not Topology.IsInstance(topology, "Topology"):
|
248
247
|
print("Topology.AddApertures - Error: The input topology parameter is not a valid topology. Returning None.")
|
249
248
|
return None
|
250
249
|
if not apertures:
|
@@ -252,7 +251,7 @@ class Topology():
|
|
252
251
|
if not isinstance(apertures, list):
|
253
252
|
print("Topology.AddApertures - Error: the input apertures parameter is not a list. Returning None.")
|
254
253
|
return None
|
255
|
-
apertures = [x for x in apertures if
|
254
|
+
apertures = [x for x in apertures if Topology.IsInstance(x , "Topology")]
|
256
255
|
if len(apertures) < 1:
|
257
256
|
return topology
|
258
257
|
if not subTopologyType:
|
@@ -274,10 +273,10 @@ class Topology():
|
|
274
273
|
|
275
274
|
Parameters
|
276
275
|
----------
|
277
|
-
topology :
|
276
|
+
topology : topologic_core.Topology
|
278
277
|
The input topology.
|
279
|
-
|
280
|
-
The input list of contents (of type
|
278
|
+
contents : list or topologic_core.Topology
|
279
|
+
The input list of contents (of type topologic_core.Topology). A single topology is also accepted as input.
|
281
280
|
subTopologyType : string , optional
|
282
281
|
The subtopology type to which to add the contents. This can be "cellcomplex", "cell", "shell", "face", "wire", "edge", or "vertex". It is case insensitive. If set to None, the contents will be added to the input topology. The default is None.
|
283
282
|
tolerance : float , optional
|
@@ -285,11 +284,11 @@ class Topology():
|
|
285
284
|
|
286
285
|
Returns
|
287
286
|
-------
|
288
|
-
|
287
|
+
topologic_core.Topology
|
289
288
|
The input topology with the contents added to it.
|
290
289
|
|
291
290
|
"""
|
292
|
-
if not
|
291
|
+
if not Topology.IsInstance(topology, "Topology"):
|
293
292
|
print("Topology.AddContent - Error: the input topology parameter is not a valid topology. Returning None.")
|
294
293
|
return None
|
295
294
|
if not contents:
|
@@ -299,7 +298,7 @@ class Topology():
|
|
299
298
|
if not isinstance(contents, list):
|
300
299
|
print("Topology.AddContent - Error: the input contents parameter is not a list. Returning None.")
|
301
300
|
return None
|
302
|
-
contents = [x for x in contents if
|
301
|
+
contents = [x for x in contents if Topology.IsInstance(x, "Topology")]
|
303
302
|
if len(contents) < 1:
|
304
303
|
return topology
|
305
304
|
if not subTopologyType:
|
@@ -307,22 +306,10 @@ class Topology():
|
|
307
306
|
if not subTopologyType.lower() in ["self", "cellcomplex", "cell", "shell", "face", "wire", "edge", "vertex"]:
|
308
307
|
print("Topology.AddContent - Error: the input subtopology type parameter is not a recognized type. Returning None.")
|
309
308
|
return None
|
310
|
-
if subTopologyType.lower() == "
|
311
|
-
t = topologic.Vertex.Type()
|
312
|
-
elif subTopologyType.lower() == "edge":
|
313
|
-
t = topologic.Edge.Type()
|
314
|
-
elif subTopologyType.lower() == "wire":
|
315
|
-
t = topologic.Wire.Type()
|
316
|
-
elif subTopologyType.lower() == "face":
|
317
|
-
t = topologic.Face.Type()
|
318
|
-
elif subTopologyType.lower() == "shell":
|
319
|
-
t = topologic.Shell.Type()
|
320
|
-
elif subTopologyType.lower() == "cell":
|
321
|
-
t = topologic.Cell.Type()
|
322
|
-
elif subTopologyType.lower() == "cellcomplex":
|
323
|
-
t = topologic.CellComplex.Type()
|
324
|
-
else:
|
309
|
+
if subTopologyType.lower() == "self":
|
325
310
|
t = 0
|
311
|
+
else:
|
312
|
+
t = Topology.TypeID(subTopologyType)
|
326
313
|
return topology.AddContents(contents, t)
|
327
314
|
|
328
315
|
@staticmethod
|
@@ -332,23 +319,23 @@ class Topology():
|
|
332
319
|
|
333
320
|
Parameters
|
334
321
|
----------
|
335
|
-
topology :
|
322
|
+
topology : topologic_core.Topology
|
336
323
|
The input topology.
|
337
|
-
dictionary :
|
324
|
+
dictionary : topologic_core.Dictionary
|
338
325
|
The input dictionary.
|
339
326
|
|
340
327
|
Returns
|
341
328
|
-------
|
342
|
-
|
329
|
+
topologic_core.Topology
|
343
330
|
The input topology with the input dictionary added to it.
|
344
331
|
|
345
332
|
"""
|
346
333
|
|
347
334
|
from topologicpy.Dictionary import Dictionary
|
348
|
-
if not
|
335
|
+
if not Topology.IsInstance(topology, "Topology"):
|
349
336
|
print("Topology.AddDictionary - Error: the input topology parameter is not a valid topology. Returning None.")
|
350
337
|
return None
|
351
|
-
if not
|
338
|
+
if not Topology.IsInstance(dictionary, "Dictionary"):
|
352
339
|
print("Topology.AddDictionary - Error: the input dictionary parameter is not a dictionary. Returning None.")
|
353
340
|
return None
|
354
341
|
tDict = Topology.Dictionary(topology)
|
@@ -367,9 +354,9 @@ class Topology():
|
|
367
354
|
|
368
355
|
Parameters
|
369
356
|
----------
|
370
|
-
topology :
|
357
|
+
topology : topologic_core.Topology
|
371
358
|
The input topology.
|
372
|
-
hostTopology :
|
359
|
+
hostTopology : topologic_core.Topology
|
373
360
|
The host topology in which to search.
|
374
361
|
topologyType : str
|
375
362
|
The type of topology for which to search. This can be one of "vertex", "edge", "wire", "face", "shell", "cell", "cellcomplex". It is case-insensitive. If it is set to None, the type will be set to the same type as the input topology. The default is None.
|
@@ -380,10 +367,10 @@ class Topology():
|
|
380
367
|
The list of adjacent topologies.
|
381
368
|
|
382
369
|
"""
|
383
|
-
if not
|
370
|
+
if not Topology.IsInstance(topology, "Topology"):
|
384
371
|
print("Topology.AdjacentTopologies - Error: the input topology parameter is not a valid topology. Returning None.")
|
385
372
|
return None
|
386
|
-
if not
|
373
|
+
if not Topology.IsInstance(hostTopology, "Topology"):
|
387
374
|
print("Topology.AdjacentTopologies - Error: the input hostTopology parameter is not a valid topology. Returning None.")
|
388
375
|
return None
|
389
376
|
if not topologyType:
|
@@ -396,7 +383,7 @@ class Topology():
|
|
396
383
|
return None
|
397
384
|
adjacentTopologies = []
|
398
385
|
error = False
|
399
|
-
if
|
386
|
+
if Topology.IsInstance(topology, "Vertex"):
|
400
387
|
if topologyType.lower() == "vertex":
|
401
388
|
try:
|
402
389
|
_ = topology.AdjacentVertices(hostTopology, adjacentTopologies)
|
@@ -453,7 +440,7 @@ class Topology():
|
|
453
440
|
_ = topology.CellComplexes(hostTopology, adjacentTopologies)
|
454
441
|
except:
|
455
442
|
error = True
|
456
|
-
elif
|
443
|
+
elif Topology.IsInstance(topology, "Edge"):
|
457
444
|
if topologyType.lower() == "vertex":
|
458
445
|
try:
|
459
446
|
_ = topology.Vertices(hostTopology, adjacentTopologies)
|
@@ -504,7 +491,7 @@ class Topology():
|
|
504
491
|
_ = topology.CellComplexes(hostTopology, adjacentTopologies)
|
505
492
|
except:
|
506
493
|
error = True
|
507
|
-
elif
|
494
|
+
elif Topology.IsInstance(topology, "Wire"):
|
508
495
|
if topologyType.lower() == "vertex":
|
509
496
|
try:
|
510
497
|
_ = topologic.WireUtility.AdjacentVertices(topology, adjacentTopologies)
|
@@ -561,7 +548,7 @@ class Topology():
|
|
561
548
|
_ = topology.CellComplexes(hostTopology, adjacentTopologies)
|
562
549
|
except:
|
563
550
|
error = True
|
564
|
-
elif
|
551
|
+
elif Topology.IsInstance(topology, "Face"):
|
565
552
|
if topologyType.lower() == "vertex":
|
566
553
|
try:
|
567
554
|
_ = topologic.FaceUtility.AdjacentVertices(topology, adjacentTopologies)
|
@@ -612,7 +599,7 @@ class Topology():
|
|
612
599
|
_ = topology.CellComplexes(hostTopology, adjacentTopologies)
|
613
600
|
except:
|
614
601
|
error = True
|
615
|
-
elif
|
602
|
+
elif Topology.IsInstance(topology, "Shell"):
|
616
603
|
if topologyType.lower() == "vertex":
|
617
604
|
try:
|
618
605
|
_ = topologic.ShellUtility.AdjacentVertices(topology, adjacentTopologies)
|
@@ -669,7 +656,7 @@ class Topology():
|
|
669
656
|
_ = topology.CellComplexes(hostTopology, adjacentTopologies)
|
670
657
|
except:
|
671
658
|
error = True
|
672
|
-
elif
|
659
|
+
elif Topology.IsInstance(topology, "Cell"):
|
673
660
|
if topologyType.lower() == "vertex":
|
674
661
|
try:
|
675
662
|
_ = topologic.CellUtility.AdjacentVertices(topology, adjacentTopologies)
|
@@ -726,7 +713,7 @@ class Topology():
|
|
726
713
|
_ = topology.CellComplexes(hostTopology, adjacentTopologies)
|
727
714
|
except:
|
728
715
|
error = True
|
729
|
-
elif
|
716
|
+
elif Topology.IsInstance(topology, "CellComplex"):
|
730
717
|
if topologyType.lower() == "vertex":
|
731
718
|
try:
|
732
719
|
_ = topology.Vertices(hostTopology, adjacentTopologies)
|
@@ -759,7 +746,7 @@ class Topology():
|
|
759
746
|
error = True
|
760
747
|
elif topologyType.lower() == "cellcomplex":
|
761
748
|
raise Exception("Topology.AdjacentTopologies - Error: Cannot search for adjacent topologies of a CellComplex")
|
762
|
-
elif
|
749
|
+
elif Topology.IsInstance(topology, "Cluster"):
|
763
750
|
raise Exception("Topology.AdjacentTopologies - Error: Cannot search for adjacent topologies of a Cluster")
|
764
751
|
if error:
|
765
752
|
raise Exception("Topology.AdjacentTopologies - Error: Failure in search for adjacent topologies of type "+topologyType)
|
@@ -772,7 +759,7 @@ class Topology():
|
|
772
759
|
|
773
760
|
Parameters
|
774
761
|
----------
|
775
|
-
topology :
|
762
|
+
topology : topologic_core.Topology
|
776
763
|
The input topology.
|
777
764
|
|
778
765
|
Returns
|
@@ -781,7 +768,7 @@ class Topology():
|
|
781
768
|
The analysis string.
|
782
769
|
|
783
770
|
"""
|
784
|
-
if not
|
771
|
+
if not Topology.IsInstance(topology, "Topology"):
|
785
772
|
print("Topology.Analyze - Error: the input topology parameter is not a valid topology. Returning None.")
|
786
773
|
return None
|
787
774
|
return topologic.Topology.Analyze(topology)
|
@@ -793,7 +780,7 @@ class Topology():
|
|
793
780
|
|
794
781
|
Parameters
|
795
782
|
----------
|
796
|
-
topology :
|
783
|
+
topology : topologic_core.Topology
|
797
784
|
The input topology.
|
798
785
|
subTopologyType : string , optional
|
799
786
|
The subtopology type from which to retrieve the apertures. This can be "cell", "face", "edge", or "vertex" or "all". It is case insensitive. If set to "all", then all apertures will be returned. If set to None, the apertures will be retrieved only from the input topology. The default is None.
|
@@ -804,7 +791,7 @@ class Topology():
|
|
804
791
|
The list of apertures belonging to the input topology.
|
805
792
|
|
806
793
|
"""
|
807
|
-
if not
|
794
|
+
if not Topology.IsInstance(topology, "Topology"):
|
808
795
|
print("Topology.Apertures - Error: the input topology parameter is not a valid topology. Returning None.")
|
809
796
|
return None
|
810
797
|
|
@@ -841,7 +828,7 @@ class Topology():
|
|
841
828
|
|
842
829
|
Parameters
|
843
830
|
----------
|
844
|
-
topology :
|
831
|
+
topology : topologic_core.Topology
|
845
832
|
The input topology.
|
846
833
|
subTopologyType : string , optional
|
847
834
|
The subtopology type from which to retrieve the apertures. This can be "cell", "face", "edge", or "vertex" or "all". It is case insensitive. If set to "all", then all apertures will be returned. If set to None, the apertures will be retrieved only from the input topology. The default is None.
|
@@ -853,7 +840,7 @@ class Topology():
|
|
853
840
|
|
854
841
|
"""
|
855
842
|
from topologicpy.Aperture import Aperture
|
856
|
-
if not
|
843
|
+
if not Topology.IsInstance(topology, "Topology"):
|
857
844
|
print("Topology.ApertureTopologies - Error: the input topology parameter is not a valid topology. Returning None.")
|
858
845
|
return None
|
859
846
|
apertures = Topology.Apertures(topology=topology, subTopologyType=subTopologyType)
|
@@ -884,281 +871,40 @@ class Topology():
|
|
884
871
|
See Topology.Boolean().
|
885
872
|
|
886
873
|
"""
|
874
|
+
|
875
|
+
if topologyA == None:
|
876
|
+
return None
|
877
|
+
if topologyB == None:
|
878
|
+
return None
|
879
|
+
|
887
880
|
from topologicpy.Vertex import Vertex
|
888
|
-
from topologicpy.Cluster import Cluster
|
889
881
|
# Sort the two topologies by their type from lower to higher so comparison can be eased.
|
890
882
|
if Topology.Type(topologyB) < Topology.Type(topologyA):
|
891
883
|
temp = topologyA
|
892
884
|
topologyA = topologyB
|
893
885
|
topologyB = temp
|
886
|
+
|
887
|
+
if Topology.IsInstance(topologyB, "CellComplex") or Topology.IsInstance(topologyB, "Cluster"):
|
888
|
+
merge = Topology.Merge(topologyA, topologyB)
|
889
|
+
symdif = Topology.SymDif(topologyA, topologyB)
|
890
|
+
return Topology.Difference(merge, symdif)
|
891
|
+
else:
|
894
892
|
# Vertex:
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
elif Topology.Type(topologyB) < 256:
|
904
|
-
if Vertex.IsInternal(topologyA, topologyB):
|
905
|
-
return topologyA
|
893
|
+
if Topology.IsInstance(topologyA, "Vertex"):
|
894
|
+
# Vertex:
|
895
|
+
if Topology.IsInstance(topologyB, "Vertex"):
|
896
|
+
if Vertex.Distance(topologyA, topologyB) < tolerance:
|
897
|
+
return topologyA
|
898
|
+
else:
|
899
|
+
return None
|
900
|
+
# Edge/Wire/Face/Shell/Cell:
|
906
901
|
else:
|
907
|
-
|
908
|
-
# Cluster:
|
909
|
-
elif isinstance(topologyB, topologic.Cluster):
|
910
|
-
free_topologies = Cluster.FreeTopologies(topologyB)
|
911
|
-
for f_t in free_topologies:
|
912
|
-
if not Topology.Intersect(topologyA, f_t) == None:
|
902
|
+
if Vertex.IsInternal(topologyA, topologyB):
|
913
903
|
return topologyA
|
914
|
-
|
915
|
-
|
916
|
-
elif isinstance(topologyA, topologic.Edge):
|
917
|
-
if isinstance(topologyB, topologic.Wire):
|
918
|
-
vertices = Topology.Vertices(topologyB)
|
919
|
-
edges = Topology.Edges(topologyB)
|
920
|
-
intersections = [topologyA.Intersect(x) for x in vertices]
|
921
|
-
intersections += [topologyA.Intersect(x) for x in edges]
|
922
|
-
intersections = [x for x in intersections if not x == None]
|
923
|
-
if len(intersections) == 0:
|
924
|
-
return None
|
925
|
-
elif isinstance(topologyB, topologic.Shell):
|
926
|
-
vertices = Topology.Vertices(topologyB)
|
927
|
-
edges = Topology.Edges(topologyB)
|
928
|
-
faces = Topology.Faces(topologyB)
|
929
|
-
intersections = [topologyA.Intersect(x) for x in vertices]
|
930
|
-
intersections += [topologyA.Intersect(x) for x in edges]
|
931
|
-
intersections += [topologyA.Intersect(x) for x in faces]
|
932
|
-
intersections = [x for x in intersections if not x == None]
|
933
|
-
if len(intersections) == 0:
|
934
|
-
return None
|
935
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
936
|
-
elif isinstance(topologyB, topologic.CellComplex):
|
937
|
-
vertices = Topology.Vertices(topologyB)
|
938
|
-
edges = Topology.Edges(topologyB)
|
939
|
-
faces = Topology.Faces(topologyB)
|
940
|
-
cells = Topology.Cells(topologyB)
|
941
|
-
intersections = [topologyA.Intersect(x) for x in vertices]
|
942
|
-
intersections += [topologyA.Intersect(x) for x in edges]
|
943
|
-
intersections += [topologyA.Intersect(x) for x in faces]
|
944
|
-
intersections += [topologyA.Intersect(x) for x in cells]
|
945
|
-
intersections = [x for x in intersections if not x == None]
|
946
|
-
if len(intersections) == 0:
|
947
|
-
return None
|
948
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
949
|
-
elif isinstance(topologyB, topologic.Cluster):
|
950
|
-
free_topologies = Cluster.FreeTopologies(topologyB)
|
951
|
-
intersections = []
|
952
|
-
for f_t in free_topologies:
|
953
|
-
intersections.append(Topology.Intersect(topologyA, f_t))
|
954
|
-
intersections = [x for x in intersections if not x == None]
|
955
|
-
if len(intersections) == 0:
|
956
|
-
return None
|
957
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
904
|
+
else:
|
905
|
+
return None
|
958
906
|
else:
|
959
907
|
return topologyA.Intersect(topologyB)
|
960
|
-
# Wire:
|
961
|
-
elif isinstance(topologyA, topologic.Wire):
|
962
|
-
if isinstance(topologyB, topologic.Face):
|
963
|
-
edges = Topology.Edges(topologyA)
|
964
|
-
intersections = []
|
965
|
-
for edge in edges:
|
966
|
-
intersections.append(Topology.Intersect(edge, topologyB))
|
967
|
-
intersections = [x for x in intersections if not x == None]
|
968
|
-
if len(intersections) == 0:
|
969
|
-
return None
|
970
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
971
|
-
elif isinstance(topologyB, topologic.Wire):
|
972
|
-
edges_a = Topology.Edges(topologyA)
|
973
|
-
intersections = []
|
974
|
-
for edge_a in edges_a:
|
975
|
-
vertices = Topology.Vertices(topologyB)
|
976
|
-
edges = Topology.Edges(topologyB)
|
977
|
-
intersections += [edge_a.Intersect(x) for x in vertices]
|
978
|
-
intersections += [edge_a.Intersect(x) for x in edges]
|
979
|
-
intersections = [x for x in intersections if not x == None]
|
980
|
-
if len(intersections) == 0:
|
981
|
-
return None
|
982
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
983
|
-
elif isinstance(topologyB, topologic.Shell):
|
984
|
-
edges_a = Topology.Edges(topologyA)
|
985
|
-
intersections = []
|
986
|
-
for edge_a in edges_a:
|
987
|
-
vertices = Topology.Vertices(topologyB)
|
988
|
-
edges = Topology.Edges(topologyB)
|
989
|
-
faces = Topology.Faces(topologyB)
|
990
|
-
intersections += [edge_a.Intersect(x) for x in vertices]
|
991
|
-
intersections += [edge_a.Intersect(x) for x in edges]
|
992
|
-
intersections += [edge_a.Intersect(x) for x in faces]
|
993
|
-
intersections = [x for x in intersections if not x == None]
|
994
|
-
if len(intersections) == 0:
|
995
|
-
return None
|
996
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
997
|
-
elif isinstance(topologyB, topologic.Cell):
|
998
|
-
edges = Topology.Edges(topologyA)
|
999
|
-
intersections = []
|
1000
|
-
for edge in edges:
|
1001
|
-
intersections.append(Topology.Intersect(edge, topologyB))
|
1002
|
-
intersections = [x for x in intersections if not x == None]
|
1003
|
-
if len(intersections) == 0:
|
1004
|
-
return None
|
1005
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1006
|
-
elif isinstance(topologyB, topologic.CellComplex):
|
1007
|
-
edges = Topology.Edges(topologyA)
|
1008
|
-
intersections = []
|
1009
|
-
for edge in edges:
|
1010
|
-
intersections.append(Topology.Intersect(edge, topologyB))
|
1011
|
-
intersections = [x for x in intersections if not x == None]
|
1012
|
-
if len(intersections) == 0:
|
1013
|
-
return None
|
1014
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1015
|
-
elif isinstance(topologyB, topologic.Cluster):
|
1016
|
-
free_topologies = Cluster.FreeTopologies(topologyB)
|
1017
|
-
intersections = []
|
1018
|
-
for f_t in free_topologies:
|
1019
|
-
intersections.append(Topology.Intersect(topologyA, f_t))
|
1020
|
-
intersections = [x for x in intersections if not x == None]
|
1021
|
-
if len(intersections) == 0:
|
1022
|
-
return None
|
1023
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1024
|
-
# Face:
|
1025
|
-
elif isinstance(topologyA, topologic.Face):
|
1026
|
-
if isinstance(topologyB, topologic.Face):
|
1027
|
-
return Topology.SelfMerge(topologyA.Intersect(topologyB), tolerance=tolerance)
|
1028
|
-
elif isinstance(topologyB, topologic.Shell):
|
1029
|
-
intersections = []
|
1030
|
-
faces = Topology.Faces(topologyB)
|
1031
|
-
for face in faces:
|
1032
|
-
inter = Topology.Intersect(topologyA, face)
|
1033
|
-
if isinstance(inter, topologic.Cluster):
|
1034
|
-
inter = Topology.SelfMerge(inter, tolerance=tolerance)
|
1035
|
-
intersections.append(inter)
|
1036
|
-
intersections = [x for x in intersections if not x == None]
|
1037
|
-
if len(intersections) == 0:
|
1038
|
-
return None
|
1039
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1040
|
-
elif isinstance(topologyB, topologic.Cell):
|
1041
|
-
diff1 = Topology.Difference(topologyA, topologyB)
|
1042
|
-
if diff1 == None:
|
1043
|
-
return topologyA
|
1044
|
-
else:
|
1045
|
-
return Topology.Difference(topologyA, diff1)
|
1046
|
-
elif isinstance(topologyB, topologic.CellComplex):
|
1047
|
-
cells = Topology.Cells(topologyB)
|
1048
|
-
intersections = []
|
1049
|
-
for cell in cells:
|
1050
|
-
intersections.append(Topology.Intersect(topologyA, cell))
|
1051
|
-
intersections = [x for x in intersections if not x == None]
|
1052
|
-
if len(intersections) == 0:
|
1053
|
-
return None
|
1054
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1055
|
-
elif isinstance(topologyB, topologic.Cluster):
|
1056
|
-
free_topologies = Cluster.FreeTopologies(topologyB)
|
1057
|
-
intersections = []
|
1058
|
-
for f_t in free_topologies:
|
1059
|
-
intersections.append(Topology.Intersect(topologyA, f_t))
|
1060
|
-
intersections = [x for x in intersections if not x == None]
|
1061
|
-
if len(intersections) == 0:
|
1062
|
-
return None
|
1063
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1064
|
-
else:
|
1065
|
-
return Topology.SelfMerge(topologyA.Intersect(topologyB), tolerance=tolerance)
|
1066
|
-
# Shell:
|
1067
|
-
elif isinstance(topologyA, topologic.Shell):
|
1068
|
-
if isinstance(topologyB, topologic.Shell) or isinstance(topologyB, topologic.Cell) or isinstance(topologyB, topologic.CellComplex):
|
1069
|
-
intersections = []
|
1070
|
-
faces = Topology.Faces(topologyA)
|
1071
|
-
for face in faces:
|
1072
|
-
inter = Topology.Intersect(face, topologyB)
|
1073
|
-
if isinstance(inter, topologic.Cluster):
|
1074
|
-
inter = Topology.SelfMerge(inter, tolerance=tolerance)
|
1075
|
-
intersections.append(inter)
|
1076
|
-
intersections = [x for x in intersections if not x == None]
|
1077
|
-
if len(intersections) == 0:
|
1078
|
-
return None
|
1079
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1080
|
-
elif isinstance(topologyB, topologic.Cluster):
|
1081
|
-
free_topologies = Cluster.FreeTopologies(topologyB)
|
1082
|
-
intersections = []
|
1083
|
-
for f_t in free_topologies:
|
1084
|
-
intersections.append(Topology.Intersect(topologyA, f_t))
|
1085
|
-
intersections = [x for x in intersections if not x == None]
|
1086
|
-
if len(intersections) == 0:
|
1087
|
-
return None
|
1088
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1089
|
-
# Cell:
|
1090
|
-
elif isinstance(topologyA, topologic.Cell):
|
1091
|
-
if isinstance(topologyB, topologic.Cell) or isinstance(topologyB, topologic.CellComplex):
|
1092
|
-
vertices = Topology.Vertices(topologyA)
|
1093
|
-
edges = Topology.Edges(topologyA)
|
1094
|
-
faces = Topology.Faces(topologyA)
|
1095
|
-
subs = vertices + edges + faces
|
1096
|
-
if isinstance(topologyB, topologic.Topology):
|
1097
|
-
diff1 = Topology.Difference(topologyA,topologyB)
|
1098
|
-
else:
|
1099
|
-
diff1 = topologyA
|
1100
|
-
if isinstance(diff1, topologic.Topology):
|
1101
|
-
diff2 = Topology.Difference(topologyA, diff1)
|
1102
|
-
else:
|
1103
|
-
diff2 = topologyA
|
1104
|
-
intersections = []
|
1105
|
-
if not diff2 == None:
|
1106
|
-
intersections.append(diff2)
|
1107
|
-
for i, sub in enumerate(subs):
|
1108
|
-
inter = Topology.Intersect(sub, topologyB)
|
1109
|
-
if isinstance(inter, topologic.Cluster):
|
1110
|
-
inter = Topology.SelfMerge(inter, tolerance=tolerance)
|
1111
|
-
intersections.append(inter)
|
1112
|
-
intersections = [x for x in intersections if not x == None]
|
1113
|
-
if len(intersections) == 0:
|
1114
|
-
return None
|
1115
|
-
return Topology.SelfMerge(Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance), tolerance=tolerance) # Hack to return proper topology type
|
1116
|
-
elif isinstance(topologyB, topologic.Cluster):
|
1117
|
-
free_topologies = Cluster.FreeTopologies(topologyB)
|
1118
|
-
intersections = []
|
1119
|
-
for f_t in free_topologies:
|
1120
|
-
intersections.append(Topology.Intersect(topologyA, f_t))
|
1121
|
-
intersections = [x for x in intersections if not x == None]
|
1122
|
-
if len(intersections) == 0:
|
1123
|
-
return None
|
1124
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1125
|
-
# CellComplex:
|
1126
|
-
elif isinstance(topologyA, topologic.CellComplex):
|
1127
|
-
if isinstance(topologyB, topologic.CellComplex):
|
1128
|
-
intersections = []
|
1129
|
-
cells_a = Topology.Cells(topologyA)
|
1130
|
-
cells_b = Topology.Cells(topologyB)
|
1131
|
-
for cell_a in cells_a:
|
1132
|
-
for cell_b in cells_b:
|
1133
|
-
intersections.append(Topology.Intersect(cell_a, cell_b))
|
1134
|
-
intersections = [x for x in intersections if not x == None]
|
1135
|
-
if len(intersections) == 0:
|
1136
|
-
return None
|
1137
|
-
return Topology.SelfMerge(Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance), tolerance=tolerance) # Hack to return proper topology type
|
1138
|
-
elif isinstance(topologyB, topologic.Cluster):
|
1139
|
-
free_topologies = Cluster.FreeTopologies(topologyB)
|
1140
|
-
intersections = []
|
1141
|
-
for f_t in free_topologies:
|
1142
|
-
intersections.append(Topology.Intersect(topologyA, f_t))
|
1143
|
-
intersections = [x for x in intersections if not x == None]
|
1144
|
-
if len(intersections) == 0:
|
1145
|
-
return None
|
1146
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1147
|
-
# Cluster:
|
1148
|
-
elif isinstance(topologyA, topologic.Cluster):
|
1149
|
-
if isinstance(topologyB, topologic.Cluster):
|
1150
|
-
free_topologies_a = Cluster.FreeTopologies(topologyA)
|
1151
|
-
free_topologies_b = Cluster.FreeTopologies(topologyB)
|
1152
|
-
intersections = []
|
1153
|
-
for f_t_a in free_topologies_a:
|
1154
|
-
for f_t_b in free_topologies_b:
|
1155
|
-
intersections.append(Topology.Intersect(f_t_a, f_t_b))
|
1156
|
-
intersections = [x for x in intersections if not x == None]
|
1157
|
-
if len(intersections) == 0:
|
1158
|
-
return None
|
1159
|
-
return Topology.SelfMerge(Cluster.ByTopologies(intersections), tolerance=tolerance)
|
1160
|
-
else:
|
1161
|
-
return topologyA.Intersect(topologyB)
|
1162
908
|
|
1163
909
|
@staticmethod
|
1164
910
|
def SymmetricDifference(topologyA, topologyB, tranDict=False, tolerance=0.0001):
|
@@ -1231,9 +977,9 @@ class Topology():
|
|
1231
977
|
|
1232
978
|
Parameters
|
1233
979
|
----------
|
1234
|
-
topologyA :
|
980
|
+
topologyA : topologic_core.Topology
|
1235
981
|
The first input topology.
|
1236
|
-
topologyB :
|
982
|
+
topologyB : topologic_core.Topology
|
1237
983
|
The second input topology.
|
1238
984
|
operation : str , optional
|
1239
985
|
The boolean operation. This can be one of "union", "difference", "intersect", "symdif", "merge", "slice", "impose", "imprint". It is case insensitive. The default is "union".
|
@@ -1244,20 +990,16 @@ class Topology():
|
|
1244
990
|
|
1245
991
|
Returns
|
1246
992
|
-------
|
1247
|
-
|
993
|
+
topologic_core.Topology
|
1248
994
|
the resultant topology.
|
1249
995
|
|
1250
996
|
"""
|
1251
997
|
from topologicpy.Dictionary import Dictionary
|
1252
|
-
|
1253
|
-
if not isinstance(topologyA, topologic.Topology):
|
998
|
+
if not Topology.IsInstance(topologyA, "Topology"):
|
1254
999
|
print("Topology.Boolean - Error: the input topologyA parameter is not a valid topology. Returning None.")
|
1255
1000
|
return None
|
1256
|
-
if not
|
1001
|
+
if not Topology.IsInstance(topologyB, "Topology"):
|
1257
1002
|
print("Topology.Boolean - Error: the input topologyB parameter is not a valid topology. Returning None.")
|
1258
|
-
print("TopologyA:", topologyA)
|
1259
|
-
print("TopologyB:", topologyB)
|
1260
|
-
Topology.Show(topologyA, renderer="offline")
|
1261
1003
|
return None
|
1262
1004
|
if not isinstance(operation, str):
|
1263
1005
|
print("Topology.Boolean - Error: the input operation parameter is not a valid string. Returning None.")
|
@@ -1269,30 +1011,32 @@ class Topology():
|
|
1269
1011
|
print("Topology.Boolean - Error: the input tranDict parameter is not a valid boolean. Returning None.")
|
1270
1012
|
return None
|
1271
1013
|
topologyC = None
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
print("Topology.Boolean - Error: the boolean operation failed. Returning None.")
|
1014
|
+
#topologyC = Topology.Intersect(topologyA, topologyB)
|
1015
|
+
#try:
|
1016
|
+
if operation.lower() == "union":
|
1017
|
+
topologyC = topologyA.Union(topologyB, False)
|
1018
|
+
elif operation.lower() == "difference":
|
1019
|
+
topologyC = topologyA.Difference(topologyB, False)
|
1020
|
+
elif operation.lower() == "intersect": #Intersect in Topologic (Core) is faulty. This is a workaround.
|
1021
|
+
#topologyC = topologyA.Intersect(topologyB, False)
|
1022
|
+
|
1023
|
+
topologyC = Topology.Intersect(topologyA, topologyB)
|
1024
|
+
elif operation.lower() == "symdif":
|
1025
|
+
topologyC = topologyA.XOR(topologyB, False)
|
1026
|
+
elif operation.lower() == "merge":
|
1027
|
+
topologyC = topologyA.Merge(topologyB, False)
|
1028
|
+
elif operation.lower() == "slice":
|
1029
|
+
topologyC = topologyA.Slice(topologyB, False)
|
1030
|
+
elif operation.lower() == "impose":
|
1031
|
+
topologyC = topologyA.Impose(topologyB, False)
|
1032
|
+
elif operation.lower() == "imprint":
|
1033
|
+
topologyC = topologyA.Imprint(topologyB, False)
|
1034
|
+
else:
|
1035
|
+
print("1. Topology.Boolean - Error: the boolean operation failed. Returning None.")
|
1295
1036
|
return None
|
1037
|
+
#except:
|
1038
|
+
#print("2. Topology.Boolean - Error: the boolean operation failed. Returning None.")
|
1039
|
+
#return None
|
1296
1040
|
if tranDict == True:
|
1297
1041
|
sourceVertices = []
|
1298
1042
|
sourceEdges = []
|
@@ -1306,62 +1050,62 @@ class Topology():
|
|
1306
1050
|
hidimB = Topology.HighestType(topologyB)
|
1307
1051
|
hidimC = Topology.HighestType(topologyC)
|
1308
1052
|
|
1309
|
-
if
|
1053
|
+
if Topology.Type(topologyA) == Topology.TypeID("Vertex"):
|
1310
1054
|
sourceVertices += [topologyA]
|
1311
|
-
elif hidimA >=
|
1055
|
+
elif hidimA >= Topology.TypeID("Vertex"):
|
1312
1056
|
sourceVertices += Topology.Vertices(topologyA)
|
1313
|
-
if
|
1057
|
+
if Topology.Type(topologyB) == Topology.TypeID("Vertex"):
|
1314
1058
|
sourceVertices += [topologyB]
|
1315
|
-
elif hidimB >=
|
1059
|
+
elif hidimB >= Topology.TypeID("Vertex"):
|
1316
1060
|
sourceVertices += Topology.Vertices(topologyB)
|
1317
|
-
if
|
1061
|
+
if Topology.Type(topologyC) == Topology.TypeID("Vertex"):
|
1318
1062
|
sinkVertices = [topologyC]
|
1319
|
-
elif hidimC >=
|
1063
|
+
elif hidimC >= Topology.TypeID("Vertex"):
|
1320
1064
|
sinkVertices = Topology.Vertices(topologyC)
|
1321
1065
|
if len(sourceVertices) > 0 and len(sinkVertices) > 0:
|
1322
1066
|
_ = Topology.TransferDictionaries(sourceVertices, sinkVertices, tolerance=tolerance)
|
1323
1067
|
|
1324
|
-
if
|
1068
|
+
if Topology.Type(topologyA) == Topology.TypeID("Edge"):
|
1325
1069
|
sourceEdges += [topologyA]
|
1326
|
-
elif hidimA >=
|
1070
|
+
elif hidimA >= Topology.TypeID("Edge"):
|
1327
1071
|
sourceEdges += Topology.Edges(topologyA)
|
1328
|
-
if
|
1072
|
+
if Topology.Type(topologyB) == Topology.TypeID("Edge"):
|
1329
1073
|
sourceEdges += [topologyB]
|
1330
|
-
elif hidimB >=
|
1074
|
+
elif hidimB >= Topology.TypeID("Edge"):
|
1331
1075
|
sourceEdges += Topology.Edges(topologyB)
|
1332
|
-
if
|
1076
|
+
if Topology.Type(topologyC) == Topology.TypeID("Edge"):
|
1333
1077
|
sinkEdges = [topologyC]
|
1334
|
-
elif hidimC >=
|
1078
|
+
elif hidimC >= Topology.TypeID("Edge"):
|
1335
1079
|
sinkEdges = Topology.Edges(topologyC)
|
1336
1080
|
if len(sourceEdges) > 0 and len(sinkEdges) > 0:
|
1337
1081
|
_ = Topology.TransferDictionaries(sourceEdges, sinkEdges, tolerance=tolerance)
|
1338
1082
|
|
1339
|
-
if
|
1083
|
+
if Topology.Type(topologyA) == Topology.TypeID("Face"):
|
1340
1084
|
sourceFaces += [topologyA]
|
1341
|
-
elif hidimA >=
|
1085
|
+
elif hidimA >= Topology.TypeID("Face"):
|
1342
1086
|
sourceFaces += Topology.Faces(topologyA)
|
1343
|
-
if
|
1087
|
+
if Topology.Type(topologyB) == Topology.TypeID("Face"):
|
1344
1088
|
sourceFaces += [topologyB]
|
1345
|
-
elif hidimB >=
|
1089
|
+
elif hidimB >= Topology.TypeID("Face"):
|
1346
1090
|
sourceFaces += Topology.Faces(topologyB)
|
1347
|
-
if
|
1091
|
+
if Topology.Type(topologyC) == Topology.TypeID("Face"):
|
1348
1092
|
sinkFaces += [topologyC]
|
1349
|
-
elif hidimC >=
|
1093
|
+
elif hidimC >= Topology.TypeID("Face"):
|
1350
1094
|
sinkFaces += Topology.Faces(topologyC)
|
1351
1095
|
if len(sourceFaces) > 0 and len(sinkFaces) > 0:
|
1352
1096
|
_ = Topology.TransferDictionaries(sourceFaces, sinkFaces, tolerance=tolerance)
|
1353
1097
|
|
1354
|
-
if
|
1098
|
+
if Topology.Type(topologyA) == Topology.TypeID("Cell"):
|
1355
1099
|
sourceCells += [topologyA]
|
1356
|
-
elif hidimA >=
|
1100
|
+
elif hidimA >= Topology.TypeID("Cell"):
|
1357
1101
|
sourceCells += Topology.Cells(topologyA)
|
1358
|
-
if
|
1102
|
+
if Topology.Type(topologyB) == Topology.TypeID("Cell"):
|
1359
1103
|
sourceCells += [topologyB]
|
1360
|
-
elif hidimB >=
|
1104
|
+
elif hidimB >= Topology.TypeID("Cell"):
|
1361
1105
|
sourceCells += Topology.Cells(topologyB)
|
1362
|
-
if
|
1106
|
+
if Topology.Type(topologyC) == Topology.TypeID("Cell"):
|
1363
1107
|
sinkCells = [topologyC]
|
1364
|
-
elif hidimC >=
|
1108
|
+
elif hidimC >= Topology.TypeID("Cell"):
|
1365
1109
|
sinkCells = Topology.Cells(topologyC)
|
1366
1110
|
if len(sourceCells) > 0 and len(sinkCells) > 0:
|
1367
1111
|
_ = Topology.TransferDictionaries(sourceCells, sinkCells, tolerance=tolerance)
|
@@ -1375,7 +1119,7 @@ class Topology():
|
|
1375
1119
|
|
1376
1120
|
Parameters
|
1377
1121
|
----------
|
1378
|
-
topology :
|
1122
|
+
topology : topologic_core.Topology
|
1379
1123
|
The input topology.
|
1380
1124
|
optimize : int , optional
|
1381
1125
|
If set to an integer from 1 (low optimization) to 10 (high optimization), the method will attempt to optimize the bounding box so that it reduces its surface area. The default is 0 which will result in an axis-aligned bounding box. The default is 0.
|
@@ -1386,10 +1130,11 @@ class Topology():
|
|
1386
1130
|
|
1387
1131
|
Returns
|
1388
1132
|
-------
|
1389
|
-
|
1133
|
+
topologic_core.Cell or topologic_core.Face
|
1390
1134
|
The bounding box of the input topology.
|
1391
1135
|
|
1392
1136
|
"""
|
1137
|
+
from topologicpy.Vertex import Vertex
|
1393
1138
|
from topologicpy.Wire import Wire
|
1394
1139
|
from topologicpy.Face import Face
|
1395
1140
|
from topologicpy.Cell import Cell
|
@@ -1413,7 +1158,7 @@ class Topology():
|
|
1413
1158
|
maxZ = max(z)
|
1414
1159
|
return [minX, minY, minZ, maxX, maxY, maxZ]
|
1415
1160
|
|
1416
|
-
if not
|
1161
|
+
if not Topology.IsInstance(topology, "Topology"):
|
1417
1162
|
print("Topology.BoundingBox - Error: the input topology parameter is not a valid topology. Returning None.")
|
1418
1163
|
return None
|
1419
1164
|
if not isinstance(axes, str):
|
@@ -1512,10 +1257,10 @@ class Topology():
|
|
1512
1257
|
best_bb = boundingBox
|
1513
1258
|
|
1514
1259
|
minX, minY, minZ, maxX, maxY, maxZ = best_bb
|
1515
|
-
vb1 =
|
1516
|
-
vb2 =
|
1517
|
-
vb3 =
|
1518
|
-
vb4 =
|
1260
|
+
vb1 = Vertex.ByCoordinates(minX, minY, minZ)
|
1261
|
+
vb2 = Vertex.ByCoordinates(maxX, minY, minZ)
|
1262
|
+
vb3 = Vertex.ByCoordinates(maxX, maxY, minZ)
|
1263
|
+
vb4 = Vertex.ByCoordinates(minX, maxY, minZ)
|
1519
1264
|
|
1520
1265
|
baseWire = Wire.ByVertices([vb1, vb2, vb3, vb4], close=True)
|
1521
1266
|
baseFace = Face.ByWire(baseWire, tolerance=tolerance)
|
@@ -1537,7 +1282,7 @@ class Topology():
|
|
1537
1282
|
|
1538
1283
|
Parameters
|
1539
1284
|
----------
|
1540
|
-
topology :
|
1285
|
+
topology : topologic_core.Topology
|
1541
1286
|
The input topology.
|
1542
1287
|
version : int , optional
|
1543
1288
|
The desired BRep version number. The default is 3.
|
@@ -1548,7 +1293,7 @@ class Topology():
|
|
1548
1293
|
The BREP string.
|
1549
1294
|
|
1550
1295
|
"""
|
1551
|
-
if not
|
1296
|
+
if not Topology.IsInstance(topology, "Topology"):
|
1552
1297
|
print("Topology.BREPString - Error: the input topology parameter is not a valid topology. Returning None.")
|
1553
1298
|
return None
|
1554
1299
|
st = None
|
@@ -1589,7 +1334,7 @@ class Topology():
|
|
1589
1334
|
|
1590
1335
|
Returns
|
1591
1336
|
-------
|
1592
|
-
topology :
|
1337
|
+
topology : topologic_core.Topology
|
1593
1338
|
The created topology. The topology will have a dictionary embedded in it that records the input attributes (color, id, lengthUnit, name, type)
|
1594
1339
|
|
1595
1340
|
"""
|
@@ -1611,7 +1356,7 @@ class Topology():
|
|
1611
1356
|
return None
|
1612
1357
|
if outputMode.lower() == "shell":
|
1613
1358
|
output = Shell.ByFaces(faces, tolerance=tolerance) # This can return a list
|
1614
|
-
if
|
1359
|
+
if Topology.IsInstance(output, "Shell"):
|
1615
1360
|
return output
|
1616
1361
|
else:
|
1617
1362
|
return None
|
@@ -1627,7 +1372,7 @@ class Topology():
|
|
1627
1372
|
output = Cluster.ByTopologies(edges)
|
1628
1373
|
if outputMode.lower() == "wire":
|
1629
1374
|
output = Topology.SelfMerge(output, tolerance=tolerance)
|
1630
|
-
if
|
1375
|
+
if Topology.IsInstance(output, "Wire"):
|
1631
1376
|
return output
|
1632
1377
|
else:
|
1633
1378
|
return None
|
@@ -1683,7 +1428,7 @@ class Topology():
|
|
1683
1428
|
faceWire = Wire.ByEdges(faceEdges, tolerance=tolerance)
|
1684
1429
|
try:
|
1685
1430
|
topFace = Face.ByWire(faceWire, tolerance=tolerance, silent=True)
|
1686
|
-
if
|
1431
|
+
if Topology.IsInstance(topFace, "Face"):
|
1687
1432
|
topFaces.append(topFace)
|
1688
1433
|
elif isinstance(topFace, list):
|
1689
1434
|
topFaces += topFace
|
@@ -1742,7 +1487,7 @@ class Topology():
|
|
1742
1487
|
|
1743
1488
|
Returns
|
1744
1489
|
-------
|
1745
|
-
|
1490
|
+
topologic_core.Topology
|
1746
1491
|
The imported topology.
|
1747
1492
|
|
1748
1493
|
"""
|
@@ -1767,7 +1512,7 @@ class Topology():
|
|
1767
1512
|
|
1768
1513
|
Returns
|
1769
1514
|
-------
|
1770
|
-
|
1515
|
+
topologic_core.Topology
|
1771
1516
|
The imported topology.
|
1772
1517
|
|
1773
1518
|
"""
|
@@ -1895,6 +1640,7 @@ class Topology():
|
|
1895
1640
|
The created list of topologies.
|
1896
1641
|
|
1897
1642
|
"""
|
1643
|
+
import ifcopenshell
|
1898
1644
|
|
1899
1645
|
if not path:
|
1900
1646
|
print("Topology.ByIFCPath - Error: the input path parameter is not a valid path. Returning None.")
|
@@ -1996,6 +1742,7 @@ class Topology():
|
|
1996
1742
|
from topologicpy.Cluster import Cluster
|
1997
1743
|
from topologicpy.Aperture import Aperture
|
1998
1744
|
from topologicpy.Helper import Helper
|
1745
|
+
from topologicpy.Topology import Topology
|
1999
1746
|
from tqdm.auto import tqdm
|
2000
1747
|
import time
|
2001
1748
|
|
@@ -2124,12 +1871,12 @@ class Topology():
|
|
2124
1871
|
def buildFace(json_item, j_wires, j_edges, j_vertices, uuidKey="uuid", tolerance=0.0001):
|
2125
1872
|
face_wires = json_item['wires']
|
2126
1873
|
external_boundary = buildWire(find_json_item(j_wires, uuidKey, face_wires[0]), j_edges, j_vertices, uuidKey=uuidKey, tolerance=tolerance)
|
2127
|
-
if not
|
1874
|
+
if not Topology.IsInstance(external_boundary, "Wire"):
|
2128
1875
|
print("Topology.ByJSONString - ERROR: Something went wrong with original external boundary. Returning None.")
|
2129
1876
|
return None
|
2130
1877
|
if not Topology.IsPlanar(external_boundary, tolerance=tolerance):
|
2131
1878
|
temp_boundary = Wire.Planarize(external_boundary, tolerance=tolerance)
|
2132
|
-
if temp_boundary == None or not
|
1879
|
+
if temp_boundary == None or not Topology.IsInstance(temp_boundary, "Wire"):
|
2133
1880
|
print("Topology.ByJSONString - Error: Something went wrong with external boundary. Returning None.")
|
2134
1881
|
return None
|
2135
1882
|
else:
|
@@ -2141,7 +1888,7 @@ class Topology():
|
|
2141
1888
|
ib = buildWire(find_json_item(j_wires, uuidKey, j_w),j_edges, j_vertices, uuidKey=uuidKey)
|
2142
1889
|
if not Topology.IsPlanar(external_boundary):
|
2143
1890
|
ib = Wire.Planarize(ib)
|
2144
|
-
if not
|
1891
|
+
if not Topology.IsInstance(ib, "Wire"):
|
2145
1892
|
print("Topology.ByJSONString - ERROR: Something went wrong with original internal boundary. Returning None.")
|
2146
1893
|
return None
|
2147
1894
|
if not Wire.IsClosed(ib):
|
@@ -2149,7 +1896,7 @@ class Topology():
|
|
2149
1896
|
internal_boundaries.append(ib)
|
2150
1897
|
|
2151
1898
|
f = Face.ByWires(external_boundary, internal_boundaries, tolerance=tolerance)
|
2152
|
-
if not
|
1899
|
+
if not Topology.IsInstance(f, "Face"):
|
2153
1900
|
print("Topology.ByJSONString - Error: Could not build a face. Returning None.", f, "Ex Bound:", external_boundary)
|
2154
1901
|
return None
|
2155
1902
|
area = Face.Area(f)
|
@@ -2178,7 +1925,7 @@ class Topology():
|
|
2178
1925
|
faces.append(buildFace(find_json_item(j_faces, uuidKey, j_f), j_wires, j_edges, j_vertices, uuidKey=uuidKey))
|
2179
1926
|
faces = Helper.Flatten(faces)
|
2180
1927
|
s = Shell.ByFaces(faces, tolerance=tolerance) # This can return a list
|
2181
|
-
if not
|
1928
|
+
if not Topology.IsInstance(s, "Shell"):
|
2182
1929
|
print("Topology.ByJSONString - Error: Could not build a shell. Returning None.")
|
2183
1930
|
return None
|
2184
1931
|
d = json_item['dictionary']
|
@@ -2598,12 +2345,12 @@ class Topology():
|
|
2598
2345
|
|
2599
2346
|
Parameters
|
2600
2347
|
----------
|
2601
|
-
occtShape :
|
2348
|
+
occtShape : topologic_core.TopoDS_Shape
|
2602
2349
|
The inoput OCCT Shape.
|
2603
2350
|
|
2604
2351
|
Returns
|
2605
2352
|
-------
|
2606
|
-
|
2353
|
+
topologic_core.Topology
|
2607
2354
|
The created topology.
|
2608
2355
|
|
2609
2356
|
"""
|
@@ -2621,7 +2368,7 @@ class Topology():
|
|
2621
2368
|
|
2622
2369
|
Returns
|
2623
2370
|
-------
|
2624
|
-
|
2371
|
+
topologic_core.Topology
|
2625
2372
|
The created topology.
|
2626
2373
|
|
2627
2374
|
"""
|
@@ -2642,7 +2389,7 @@ class Topology():
|
|
2642
2389
|
Imports the topology from an XYZ file path. This is a very experimental method. While variants of the format exist, topologicpy reads XYZ files that conform to the following:
|
2643
2390
|
An XYZ file can be made out of one or more frames. Each frame will be stored in a sepatate topologic cluster.
|
2644
2391
|
First line: total number of vertices in the frame. This must be an integer. No other words or characters are allowed on this line.
|
2645
|
-
Second line: frame label. This is free text and will be stored in the dictionary of each frame (
|
2392
|
+
Second line: frame label. This is free text and will be stored in the dictionary of each frame (topologic_core.Cluster)
|
2646
2393
|
All other lines: vertex_label, x, y, and z coordinates, separated by spaces, tabs, or commas. The vertex label must be one word with no spaces. It is stored in the dictionary of each vertex.
|
2647
2394
|
|
2648
2395
|
Example:
|
@@ -2675,7 +2422,7 @@ class Topology():
|
|
2675
2422
|
Returns
|
2676
2423
|
-------
|
2677
2424
|
list
|
2678
|
-
The list of frames (
|
2425
|
+
The list of frames (topologic_core.Cluster).
|
2679
2426
|
|
2680
2427
|
"""
|
2681
2428
|
from topologicpy.Vertex import Vertex
|
@@ -2724,7 +2471,7 @@ class Topology():
|
|
2724
2471
|
Imports the topology from an XYZ file path. This is a very experimental method. While variants of the format exist, topologicpy reads XYZ files that conform to the following:
|
2725
2472
|
An XYZ file can be made out of one or more frames. Each frame will be stored in a sepatate topologic cluster.
|
2726
2473
|
First line: total number of vertices in the frame. This must be an integer. No other words or characters are allowed on this line.
|
2727
|
-
Second line: frame label. This is free text and will be stored in the dictionary of each frame (
|
2474
|
+
Second line: frame label. This is free text and will be stored in the dictionary of each frame (topologic_core.Cluster)
|
2728
2475
|
All other lines: vertex_label, x, y, and z coordinates, separated by spaces, tabs, or commas. The vertex label must be one word with no spaces. It is stored in the dictionary of each vertex.
|
2729
2476
|
|
2730
2477
|
Example:
|
@@ -2757,7 +2504,7 @@ class Topology():
|
|
2757
2504
|
Returns
|
2758
2505
|
-------
|
2759
2506
|
list
|
2760
|
-
The list of frames (
|
2507
|
+
The list of frames (topologic_core.Cluster).
|
2761
2508
|
|
2762
2509
|
"""
|
2763
2510
|
if not path:
|
@@ -2777,16 +2524,16 @@ class Topology():
|
|
2777
2524
|
|
2778
2525
|
Parameters
|
2779
2526
|
----------
|
2780
|
-
topology :
|
2527
|
+
topology : topologic_core.Topology
|
2781
2528
|
The input topology.
|
2782
2529
|
|
2783
2530
|
Returns
|
2784
2531
|
-------
|
2785
|
-
|
2532
|
+
topologic_core.Vertex
|
2786
2533
|
The center of mass of the input topology.
|
2787
2534
|
|
2788
2535
|
"""
|
2789
|
-
if not
|
2536
|
+
if not Topology.IsInstance(topology, "Topology"):
|
2790
2537
|
print("Topology.CenterofMass - Error: the input topology parameter is not a valid topology. Returning None.")
|
2791
2538
|
return None
|
2792
2539
|
return topology.CenterOfMass()
|
@@ -2798,19 +2545,21 @@ class Topology():
|
|
2798
2545
|
|
2799
2546
|
Parameters
|
2800
2547
|
----------
|
2801
|
-
topology :
|
2548
|
+
topology : topologic_core.Topology
|
2802
2549
|
The input topology.
|
2803
2550
|
|
2804
2551
|
Returns
|
2805
2552
|
-------
|
2806
|
-
|
2553
|
+
topologic_core.Vertex
|
2807
2554
|
The centroid of the input topology.
|
2808
2555
|
|
2809
2556
|
"""
|
2810
|
-
|
2557
|
+
from topologicpy.Aperture import Aperture
|
2558
|
+
|
2559
|
+
if not Topology.IsInstance(topology, "Topology"):
|
2811
2560
|
print("Topology.Centroid - Error: the input topology parameter is not a valid topology. Returning None.")
|
2812
2561
|
return None
|
2813
|
-
if
|
2562
|
+
if Topology.IsInstance(topology, "Aperture"):
|
2814
2563
|
return Aperture.Topology(topology).Centroid()
|
2815
2564
|
return topology.Centroid()
|
2816
2565
|
|
@@ -2821,7 +2570,7 @@ class Topology():
|
|
2821
2570
|
|
2822
2571
|
Parameters
|
2823
2572
|
----------
|
2824
|
-
topology :
|
2573
|
+
topology : topologic_core.Topology
|
2825
2574
|
The input topology.
|
2826
2575
|
angTolerance : float , optional
|
2827
2576
|
The desired angular tolerance. The default is 0.1.
|
@@ -2882,7 +2631,7 @@ class Topology():
|
|
2882
2631
|
|
2883
2632
|
Parameters
|
2884
2633
|
----------
|
2885
|
-
topology :
|
2634
|
+
topology : topologic_core.Topology
|
2886
2635
|
The input topology.
|
2887
2636
|
angTolerance : float , optional
|
2888
2637
|
The desired angular tolerance. The default is 0.1.
|
@@ -2976,7 +2725,7 @@ class Topology():
|
|
2976
2725
|
matrix[i, :] = 0
|
2977
2726
|
matrix[:, i] = 0
|
2978
2727
|
return matrix
|
2979
|
-
if not
|
2728
|
+
if not Topology.IsInstance(topology, "Topology"):
|
2980
2729
|
print("Topology.ClusterFaces - Error: the input topology parameter is not a valid topology. Returning None.")
|
2981
2730
|
return None
|
2982
2731
|
faces = []
|
@@ -3003,7 +2752,7 @@ class Topology():
|
|
3003
2752
|
|
3004
2753
|
Parameters
|
3005
2754
|
----------
|
3006
|
-
topology :
|
2755
|
+
topology : topologic_core.Topology
|
3007
2756
|
The input topology.
|
3008
2757
|
|
3009
2758
|
Returns
|
@@ -3012,7 +2761,7 @@ class Topology():
|
|
3012
2761
|
The list of contents of the input topology.
|
3013
2762
|
|
3014
2763
|
"""
|
3015
|
-
if not
|
2764
|
+
if not Topology.IsInstance(topology, "Topology"):
|
3016
2765
|
print("Topology.Contents - Error: the input topology parameter is not a valid topology. Returning None.")
|
3017
2766
|
return None
|
3018
2767
|
contents = []
|
@@ -3026,7 +2775,7 @@ class Topology():
|
|
3026
2775
|
|
3027
2776
|
Parameters
|
3028
2777
|
----------
|
3029
|
-
topology :
|
2778
|
+
topology : topologic_core.Topology
|
3030
2779
|
The input topology.
|
3031
2780
|
|
3032
2781
|
Returns
|
@@ -3035,7 +2784,7 @@ class Topology():
|
|
3035
2784
|
The list of contexts of the input topology.
|
3036
2785
|
|
3037
2786
|
"""
|
3038
|
-
if not
|
2787
|
+
if not Topology.IsInstance(topology, "Topology"):
|
3039
2788
|
print("Topology.Contexts - Error: the input topology parameter is not a valid topology. Returning None.")
|
3040
2789
|
return None
|
3041
2790
|
contexts = []
|
@@ -3049,14 +2798,14 @@ class Topology():
|
|
3049
2798
|
|
3050
2799
|
Parameters
|
3051
2800
|
----------
|
3052
|
-
topology :
|
2801
|
+
topology : topologic_core.Topology
|
3053
2802
|
The input Topology.
|
3054
2803
|
tolerance : float , optional
|
3055
2804
|
The desired tolerance. The default is 0.0001.
|
3056
2805
|
|
3057
2806
|
Returns
|
3058
2807
|
-------
|
3059
|
-
|
2808
|
+
topologic_core.Topology
|
3060
2809
|
The created convex hull of the input topology.
|
3061
2810
|
|
3062
2811
|
"""
|
@@ -3100,9 +2849,9 @@ class Topology():
|
|
3100
2849
|
return c
|
3101
2850
|
except:
|
3102
2851
|
returnTopology = Topology.SelfMerge(Cluster.ByTopologies(faces), tolerance=tolerance)
|
3103
|
-
if
|
2852
|
+
if Topology.Type(returnTopology) == Topology.TypeID("Shell"):
|
3104
2853
|
return Shell.ExternalBoundary(returnTopology, tolerance=tolerance)
|
3105
|
-
if not
|
2854
|
+
if not Topology.IsInstance(topology, "Topology"):
|
3106
2855
|
print("Topology.ConvexHull - Error: the input topology parameter is not a valid topology. Returning None.")
|
3107
2856
|
return None
|
3108
2857
|
returnObject = None
|
@@ -3119,19 +2868,19 @@ class Topology():
|
|
3119
2868
|
|
3120
2869
|
Parameters
|
3121
2870
|
----------
|
3122
|
-
topology :
|
2871
|
+
topology : topologic_core.Topology
|
3123
2872
|
The input topology.
|
3124
2873
|
deep : bool , optional
|
3125
2874
|
If set to True, a deep copy will be performed (this is slow). Othwerwise, it will not. The default is False
|
3126
2875
|
|
3127
2876
|
Returns
|
3128
2877
|
-------
|
3129
|
-
|
2878
|
+
topologic_core.Topology
|
3130
2879
|
A copy of the input topology.
|
3131
2880
|
|
3132
2881
|
"""
|
3133
2882
|
from topologicpy.Dictionary import Dictionary
|
3134
|
-
if not
|
2883
|
+
if not Topology.IsInstance(topology, "Topology"):
|
3135
2884
|
print("Topology.Copy - Error: the input topology parameter is not a valid topology. Returning None.")
|
3136
2885
|
return None
|
3137
2886
|
if deep:
|
@@ -3150,16 +2899,16 @@ class Topology():
|
|
3150
2899
|
|
3151
2900
|
Parameters
|
3152
2901
|
----------
|
3153
|
-
topology :
|
2902
|
+
topology : topologic_core.Topology
|
3154
2903
|
The input topology.
|
3155
2904
|
|
3156
2905
|
Returns
|
3157
2906
|
-------
|
3158
|
-
|
2907
|
+
topologic_core.Dictionary
|
3159
2908
|
The dictionary of the input topology.
|
3160
2909
|
|
3161
2910
|
"""
|
3162
|
-
if not
|
2911
|
+
if not Topology.IsInstance(topology, "Topology"):
|
3163
2912
|
print("Topology.Dictionary - Error: the input topology parameter is not a valid topology. Returning None.")
|
3164
2913
|
return None
|
3165
2914
|
return topology.GetDictionary()
|
@@ -3171,7 +2920,7 @@ class Topology():
|
|
3171
2920
|
|
3172
2921
|
Parameters
|
3173
2922
|
----------
|
3174
|
-
topology :
|
2923
|
+
topology : topologic_core.Topology
|
3175
2924
|
The input topology.
|
3176
2925
|
|
3177
2926
|
Returns
|
@@ -3180,7 +2929,7 @@ class Topology():
|
|
3180
2929
|
The dimensionality of the input topology.
|
3181
2930
|
|
3182
2931
|
"""
|
3183
|
-
if not
|
2932
|
+
if not Topology.IsInstance(topology, "Topology"):
|
3184
2933
|
print("Topology.Dimensionality - Error: the input topology parameter is not a valid topology. Returning None.")
|
3185
2934
|
return None
|
3186
2935
|
return topology.Dimensionality()
|
@@ -3192,9 +2941,9 @@ class Topology():
|
|
3192
2941
|
|
3193
2942
|
Parameters
|
3194
2943
|
----------
|
3195
|
-
topologyA :
|
2944
|
+
topologyA : topologic_core.Topology
|
3196
2945
|
The input topology to be divided.
|
3197
|
-
topologyB :
|
2946
|
+
topologyB : topologic_core.Topology
|
3198
2947
|
the tool used to divide the input topology.
|
3199
2948
|
transferDictionary : bool , optional
|
3200
2949
|
If set to True the dictionary of the input topology is transferred to the divided topologies.
|
@@ -3203,16 +2952,16 @@ class Topology():
|
|
3203
2952
|
|
3204
2953
|
Returns
|
3205
2954
|
-------
|
3206
|
-
|
2955
|
+
topologic_core.Topology
|
3207
2956
|
The input topology with the divided topologies added to it as contents.
|
3208
2957
|
|
3209
2958
|
"""
|
3210
2959
|
|
3211
2960
|
from topologicpy.Dictionary import Dictionary
|
3212
|
-
if not
|
2961
|
+
if not Topology.IsInstance(topologyA, "Topology"):
|
3213
2962
|
print("Topology.Divide - Error: the input topologyA parameter is not a valid topology. Returning None.")
|
3214
2963
|
return None
|
3215
|
-
if not
|
2964
|
+
if not Topology.IsInstance(topologyB, "Topology"):
|
3216
2965
|
print("Topology.Divide - Error: the input topologyB parameter is not a valid topology. Returning None.")
|
3217
2966
|
return None
|
3218
2967
|
try:
|
@@ -3281,9 +3030,9 @@ class Topology():
|
|
3281
3030
|
|
3282
3031
|
Parameters
|
3283
3032
|
----------
|
3284
|
-
topology :
|
3033
|
+
topology : topologic_core.Topology
|
3285
3034
|
The input topology.
|
3286
|
-
origin :
|
3035
|
+
origin : topologic_core.Vertex , optional
|
3287
3036
|
The origin of the explosion. If set to None, the centroid of the input topology will be used. The default is None.
|
3288
3037
|
scale : float , optional
|
3289
3038
|
The scale factor of the explosion. The default is 1.25.
|
@@ -3296,7 +3045,7 @@ class Topology():
|
|
3296
3045
|
|
3297
3046
|
Returns
|
3298
3047
|
-------
|
3299
|
-
|
3048
|
+
topologic_core.Cluster
|
3300
3049
|
The exploded topology.
|
3301
3050
|
|
3302
3051
|
"""
|
@@ -3322,30 +3071,30 @@ class Topology():
|
|
3322
3071
|
|
3323
3072
|
def getTypeFilter(topology):
|
3324
3073
|
typeFilter = "self"
|
3325
|
-
if
|
3074
|
+
if Topology.IsInstance(topology, "Vertex"):
|
3326
3075
|
typeFilter = "self"
|
3327
|
-
elif
|
3076
|
+
elif Topology.IsInstance(topology, "Edge"):
|
3328
3077
|
typeFilter = "vertex"
|
3329
|
-
elif
|
3078
|
+
elif Topology.IsInstance(topology, "Wire"):
|
3330
3079
|
typeFilter = "edge"
|
3331
|
-
elif
|
3080
|
+
elif Topology.IsInstance(topology, "Face"):
|
3332
3081
|
typeFilter = "edge"
|
3333
|
-
elif
|
3082
|
+
elif Topology.IsInstance(topology, "Shell"):
|
3334
3083
|
typeFilter = "face"
|
3335
|
-
elif
|
3084
|
+
elif Topology.IsInstance(topology, "Cell"):
|
3336
3085
|
typeFilter = "face"
|
3337
|
-
elif
|
3086
|
+
elif Topology.IsInstance(topology, "CellComplex"):
|
3338
3087
|
typeFilter = "cell"
|
3339
|
-
elif
|
3088
|
+
elif Topology.IsInstance(topology, "Cluster"):
|
3340
3089
|
typeFilter = processClusterTypeFilter(topology)
|
3341
|
-
elif
|
3090
|
+
elif Topology.IsInstance(topology, "Graph"):
|
3342
3091
|
typeFilter = "edge"
|
3343
3092
|
return typeFilter
|
3344
3093
|
|
3345
|
-
if not
|
3094
|
+
if not Topology.IsInstance(topology, "Topology"):
|
3346
3095
|
print("Topology.Explode - Error: the input topology parameter is not a valid topology. Returning None.")
|
3347
3096
|
return None
|
3348
|
-
if not
|
3097
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
3349
3098
|
origin = Topology.CenterOfMass(topology)
|
3350
3099
|
if not typeFilter:
|
3351
3100
|
typeFilter = getTypeFilter(topology)
|
@@ -3355,7 +3104,7 @@ class Topology():
|
|
3355
3104
|
if not isinstance(axes, str):
|
3356
3105
|
print("Topology.Explode - Error: the input axes parameter is not a valid string. Returning None.")
|
3357
3106
|
return None
|
3358
|
-
if
|
3107
|
+
if Topology.IsInstance(topology, "Topology"):
|
3359
3108
|
# Hack to fix a weird bug that seems to be a problem with OCCT memory handling.
|
3360
3109
|
topology = Topology.ByBREPString(Topology.BREPString(topology))
|
3361
3110
|
axes = axes.lower()
|
@@ -3368,7 +3117,7 @@ class Topology():
|
|
3368
3117
|
|
3369
3118
|
topologies = []
|
3370
3119
|
newTopologies = []
|
3371
|
-
if
|
3120
|
+
if Topology.IsInstance(topology, "Graph"):
|
3372
3121
|
topology = Graph.Topology(topology)
|
3373
3122
|
|
3374
3123
|
if typeFilter.lower() == "self":
|
@@ -3406,7 +3155,7 @@ class Topology():
|
|
3406
3155
|
|
3407
3156
|
Parameters
|
3408
3157
|
----------
|
3409
|
-
topology :
|
3158
|
+
topology : topologic_core.Topology
|
3410
3159
|
The input topology.
|
3411
3160
|
path : str
|
3412
3161
|
The input file path.
|
@@ -3422,7 +3171,7 @@ class Topology():
|
|
3422
3171
|
|
3423
3172
|
"""
|
3424
3173
|
from os.path import exists
|
3425
|
-
if not
|
3174
|
+
if not Topology.IsInstance(topology, "Topology"):
|
3426
3175
|
print("Topology.ExportToBREP - Error: the input topology parameter is not a valid topology. Returning None.")
|
3427
3176
|
return None
|
3428
3177
|
if not isinstance(path, str):
|
@@ -3561,7 +3310,7 @@ class Topology():
|
|
3561
3310
|
|
3562
3311
|
Parameters
|
3563
3312
|
----------
|
3564
|
-
topology :
|
3313
|
+
topology : topologic_core.Topology
|
3565
3314
|
The input topology
|
3566
3315
|
topologyType : str , optional
|
3567
3316
|
The desired output topology type. This must be one of "vertex", "edge", "wire", "face", "shell", "cell", "cellcomplex", "cluster". It is case insensitive. The default is "CellComplex"
|
@@ -3570,7 +3319,7 @@ class Topology():
|
|
3570
3319
|
|
3571
3320
|
Returns
|
3572
3321
|
-------
|
3573
|
-
|
3322
|
+
topologic_core.Topology
|
3574
3323
|
The output topology in the desired type.
|
3575
3324
|
|
3576
3325
|
"""
|
@@ -3721,7 +3470,7 @@ class Topology():
|
|
3721
3470
|
|
3722
3471
|
Parameters
|
3723
3472
|
----------
|
3724
|
-
topologies : list or
|
3473
|
+
topologies : list or topologic_core.Topology
|
3725
3474
|
The input list of topologies or a single topology.
|
3726
3475
|
mantissa : int , optional
|
3727
3476
|
The desired length of the mantissa. The default is 6.
|
@@ -3738,6 +3487,7 @@ class Topology():
|
|
3738
3487
|
from topologicpy.Face import Face
|
3739
3488
|
from topologicpy.Cell import Cell
|
3740
3489
|
from topologicpy.Dictionary import Dictionary
|
3490
|
+
from topologicpy.Aperture import Aperture
|
3741
3491
|
|
3742
3492
|
def getUUID(topology, uuidKey="uuid"):
|
3743
3493
|
d = Topology.Dictionary(topology)
|
@@ -3829,19 +3579,19 @@ class Topology():
|
|
3829
3579
|
|
3830
3580
|
def getApertureData(topology, topLevel="False", uuidKey="uuid"):
|
3831
3581
|
json_data = []
|
3832
|
-
if
|
3582
|
+
if Topology.IsInstance(topology, "Vertex"):
|
3833
3583
|
d = getVertex(topology, uuidKey=uuidKey)
|
3834
|
-
elif
|
3584
|
+
elif Topology.IsInstance(topology, "Edge"):
|
3835
3585
|
d = getEdge(topology, uuidKey=uuidKey)
|
3836
|
-
elif
|
3586
|
+
elif Topology.IsInstance(topology, "Wire"):
|
3837
3587
|
d = getWire(topology, uuidKey=uuidKey)
|
3838
|
-
elif
|
3588
|
+
elif Topology.IsInstance(topology, "Face"):
|
3839
3589
|
d = getFace(topology, uuidKey=uuidKey)
|
3840
|
-
elif
|
3590
|
+
elif Topology.IsInstance(topology, "Shell"):
|
3841
3591
|
d = getShell(topology, uuidKey=uuidKey)
|
3842
|
-
elif
|
3592
|
+
elif Topology.IsInstance(topology, "Cell"):
|
3843
3593
|
d = getCell(topology, uuidKey=uuidKey)
|
3844
|
-
elif
|
3594
|
+
elif Topology.IsInstance(topology, "CellComplex"):
|
3845
3595
|
d = getCellComplex(topology, uuidKey=uuidKey)
|
3846
3596
|
d['dictionary']['toplevel'] = topLevel
|
3847
3597
|
json_data += getSubTopologyData(topology, uuidKey=uuidKey)
|
@@ -3929,19 +3679,19 @@ class Topology():
|
|
3929
3679
|
|
3930
3680
|
def getJSONData(topology, topLevel=False, uuidKey="uuid"):
|
3931
3681
|
json_data = []
|
3932
|
-
if
|
3682
|
+
if Topology.IsInstance(topology, "Vertex"):
|
3933
3683
|
d = getVertex(topology, uuidKey=uuidKey)
|
3934
|
-
elif
|
3684
|
+
elif Topology.IsInstance(topology, "Edge"):
|
3935
3685
|
d = getEdge(topology, uuidKey=uuidKey)
|
3936
|
-
elif
|
3686
|
+
elif Topology.IsInstance(topology, "Wire"):
|
3937
3687
|
d = getWire(topology, uuidKey=uuidKey)
|
3938
|
-
elif
|
3688
|
+
elif Topology.IsInstance(topology, "Face"):
|
3939
3689
|
d = getFace(topology, uuidKey=uuidKey)
|
3940
|
-
elif
|
3690
|
+
elif Topology.IsInstance(topology, "Shell"):
|
3941
3691
|
d = getShell(topology, uuidKey=uuidKey)
|
3942
|
-
elif
|
3692
|
+
elif Topology.IsInstance(topology, "Cell"):
|
3943
3693
|
d = getCell(topology, uuidKey=uuidKey)
|
3944
|
-
elif
|
3694
|
+
elif Topology.IsInstance(topology, "CellComplex"):
|
3945
3695
|
d = getCellComplex(topology, uuidKey=uuidKey)
|
3946
3696
|
else:
|
3947
3697
|
print("Topology.JSONString - Error: Unknown topology type:", topology, ". Returning None.")
|
@@ -3958,7 +3708,7 @@ class Topology():
|
|
3958
3708
|
json_data = []
|
3959
3709
|
if not isinstance(topologies, list):
|
3960
3710
|
topologies = [topologies]
|
3961
|
-
topologies = [x for x in topologies if
|
3711
|
+
topologies = [x for x in topologies if Topology.IsInstance(x, "Topology")]
|
3962
3712
|
for topology in topologies:
|
3963
3713
|
json_data += getJSONData(topology, topLevel=True, uuidKey="uuid")
|
3964
3714
|
json_string = json.dumps(json_data, indent=4, sort_keys=False)
|
@@ -3971,7 +3721,7 @@ class Topology():
|
|
3971
3721
|
|
3972
3722
|
Parameters
|
3973
3723
|
----------
|
3974
|
-
topology :
|
3724
|
+
topology : topologic_core.Topology
|
3975
3725
|
The input topology.
|
3976
3726
|
transposeAxes : bool , optional
|
3977
3727
|
If set to True the Z and Y coordinates are transposed so that Y points "up"
|
@@ -4005,7 +3755,7 @@ class Topology():
|
|
4005
3755
|
from topologicpy.Vertex import Vertex
|
4006
3756
|
from topologicpy.Face import Face
|
4007
3757
|
|
4008
|
-
if not
|
3758
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4009
3759
|
print("Topology.ExportToOBJ - Error: the input topology parameter is not a valid topology. Returning None.")
|
4010
3760
|
return None
|
4011
3761
|
|
@@ -4040,7 +3790,7 @@ class Topology():
|
|
4040
3790
|
|
4041
3791
|
Parameters
|
4042
3792
|
----------
|
4043
|
-
topology :
|
3793
|
+
topology : topologic_core.Topology
|
4044
3794
|
The input topology.
|
4045
3795
|
path : str
|
4046
3796
|
The input file path.
|
@@ -4076,7 +3826,7 @@ class Topology():
|
|
4076
3826
|
"""
|
4077
3827
|
from os.path import exists
|
4078
3828
|
|
4079
|
-
if not
|
3829
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4080
3830
|
print("Topology.ExportToOBJ - Error: the input topology parameter is not a valid topology. Returning None.")
|
4081
3831
|
return None
|
4082
3832
|
if not overwrite and exists(path):
|
@@ -4183,23 +3933,23 @@ class Topology():
|
|
4183
3933
|
|
4184
3934
|
Parameters
|
4185
3935
|
----------
|
4186
|
-
topology :
|
3936
|
+
topology : topologic_core.Topology
|
4187
3937
|
The input topology.
|
4188
|
-
origin :
|
3938
|
+
origin : topologic_core.Vertex , optional
|
4189
3939
|
The input origin. If set to None, The object's centroid will be used to place the world origin. The default is None.
|
4190
3940
|
vector : list , optional
|
4191
3941
|
The input direction vector. The input topology will be rotated such that this vector is pointed in the positive Z axis.
|
4192
3942
|
|
4193
3943
|
Returns
|
4194
3944
|
-------
|
4195
|
-
|
3945
|
+
topologic_core.Topology
|
4196
3946
|
The flattened topology.
|
4197
3947
|
|
4198
3948
|
"""
|
4199
3949
|
from topologicpy.Vertex import Vertex
|
4200
3950
|
from topologicpy.Vector import Vector
|
4201
3951
|
|
4202
|
-
if not
|
3952
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4203
3953
|
print("Topology.Flatten - Error: the input topology parameter is not a valid topology. Returning None.")
|
4204
3954
|
return None
|
4205
3955
|
if origin == None:
|
@@ -4217,7 +3967,7 @@ class Topology():
|
|
4217
3967
|
|
4218
3968
|
Parameters
|
4219
3969
|
----------
|
4220
|
-
topology :
|
3970
|
+
topology : topologic_core.Topology
|
4221
3971
|
The input topology.
|
4222
3972
|
mantissa : int , optional
|
4223
3973
|
The desired length of the mantissa. The default is 6.
|
@@ -4265,7 +4015,7 @@ class Topology():
|
|
4265
4015
|
if topology == None:
|
4266
4016
|
return [None, None, None]
|
4267
4017
|
topVerts = []
|
4268
|
-
if
|
4018
|
+
if Topology.Type(topology) == Topology.TypeID("Vertex"): #input is a vertex, just add it and process it
|
4269
4019
|
topVerts.append(topology)
|
4270
4020
|
else:
|
4271
4021
|
_ = topology.Vertices(None, topVerts)
|
@@ -4275,9 +4025,9 @@ class Topology():
|
|
4275
4025
|
except:
|
4276
4026
|
vertices.append(Vertex.Coordinates(aVertex, mantissa=mantissa)) # Vertex not in list, add it.
|
4277
4027
|
topEdges = []
|
4278
|
-
if (
|
4028
|
+
if (Topology.Type(topology) == Topology.TypeID("Edge")): #Input is an Edge, just add it and process it
|
4279
4029
|
topEdges.append(topology)
|
4280
|
-
elif (
|
4030
|
+
elif (Topology.Type(topology) > Topology.TypeID("Vertex")):
|
4281
4031
|
_ = topology.Edges(None, topEdges)
|
4282
4032
|
for anEdge in topEdges:
|
4283
4033
|
e = []
|
@@ -4298,9 +4048,9 @@ class Topology():
|
|
4298
4048
|
if ([e[0], e[1]] not in edges) and ([e[1], e[0]] not in edges):
|
4299
4049
|
edges.append(e)
|
4300
4050
|
topFaces = []
|
4301
|
-
if (
|
4051
|
+
if (Topology.Type(topology) == Topology.TypeID("Face")): # Input is a Face, just add it and process it
|
4302
4052
|
topFaces.append(topology)
|
4303
|
-
elif (
|
4053
|
+
elif (Topology.Type(topology) > Topology.TypeID("Face")):
|
4304
4054
|
_ = topology.Faces(None, topFaces)
|
4305
4055
|
for aFace in topFaces:
|
4306
4056
|
ib = []
|
@@ -4341,7 +4091,7 @@ class Topology():
|
|
4341
4091
|
|
4342
4092
|
Parameters
|
4343
4093
|
----------
|
4344
|
-
topology :
|
4094
|
+
topology : topologic_core.Topology
|
4345
4095
|
The input topology.
|
4346
4096
|
|
4347
4097
|
Returns
|
@@ -4351,10 +4101,11 @@ class Topology():
|
|
4351
4101
|
|
4352
4102
|
"""
|
4353
4103
|
from topologicpy.Cluster import Cluster
|
4354
|
-
|
4104
|
+
|
4105
|
+
if (Topology.Type(topology) == Topology.TypeID("Cluster")):
|
4355
4106
|
return Cluster.HighestType(topology)
|
4356
4107
|
else:
|
4357
|
-
return
|
4108
|
+
return Topology.Type(topology)
|
4358
4109
|
|
4359
4110
|
@staticmethod
|
4360
4111
|
def InternalVertex(topology, tolerance: float = 0.0001):
|
@@ -4363,14 +4114,14 @@ class Topology():
|
|
4363
4114
|
|
4364
4115
|
Parameters
|
4365
4116
|
----------
|
4366
|
-
topology :
|
4117
|
+
topology : topologic_core.Topology
|
4367
4118
|
The input topology.
|
4368
4119
|
tolerance : float , ptional
|
4369
4120
|
The desired tolerance. The default is 0.0001.
|
4370
4121
|
|
4371
4122
|
Returns
|
4372
4123
|
-------
|
4373
|
-
|
4124
|
+
topologic_core.Vertex
|
4374
4125
|
A vertex guaranteed to be inside the input topology.
|
4375
4126
|
|
4376
4127
|
"""
|
@@ -4381,22 +4132,22 @@ class Topology():
|
|
4381
4132
|
from topologicpy.CellComplex import CellComplex
|
4382
4133
|
from topologicpy.Aperture import Aperture
|
4383
4134
|
|
4384
|
-
if not
|
4135
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4385
4136
|
print("Topology.InternalVertex - Error: the input topology parameter is not a valid topology. Returning None.")
|
4386
4137
|
return None
|
4387
4138
|
vst = None
|
4388
4139
|
top = Topology.Copy(topology)
|
4389
|
-
if
|
4140
|
+
if Topology.IsInstance(top, "CellComplex"): #CellComplex
|
4390
4141
|
tempCell = Topology.Cells(top)[0]
|
4391
4142
|
vst = Cell.InternalVertex(tempCell, tolerance=tolerance)
|
4392
|
-
elif
|
4143
|
+
elif Topology.IsInstance(top, "Cell"): #Cell
|
4393
4144
|
vst = Cell.InternalVertex(top, tolerance=tolerance)
|
4394
|
-
elif
|
4145
|
+
elif Topology.IsInstance(top, "Shell"): #Shell
|
4395
4146
|
tempFace = Topology.Faces(top)[0]
|
4396
4147
|
vst = Face.InternalVertex(tempFace, tolerance=tolerance)
|
4397
|
-
elif
|
4148
|
+
elif Topology.IsInstance(top, "Face"): #Face
|
4398
4149
|
vst = Face.InternalVertex(top, tolerance=tolerance)
|
4399
|
-
elif
|
4150
|
+
elif Topology.IsInstance(top, "Wire"): #Wire
|
4400
4151
|
if top.IsClosed():
|
4401
4152
|
internalBoundaries = []
|
4402
4153
|
try:
|
@@ -4407,11 +4158,11 @@ class Topology():
|
|
4407
4158
|
else:
|
4408
4159
|
tempEdge = Topology.Edges(top)[0]
|
4409
4160
|
vst = Edge.VertexByParameter(tempEdge, 0.5)
|
4410
|
-
elif
|
4161
|
+
elif Topology.IsInstance(top, "Edge"): #Edge
|
4411
4162
|
vst = Edge.VertexByParameter(top, 0.5)
|
4412
|
-
elif
|
4163
|
+
elif Topology.IsInstance(top, "Vertex"): #Vertex
|
4413
4164
|
vst = top
|
4414
|
-
elif
|
4165
|
+
elif Topology.IsInstance(topology, "Aperture"): #Aperture
|
4415
4166
|
vst = Face.InternalVertex(Aperture.Topology(top), tolerance)
|
4416
4167
|
else:
|
4417
4168
|
vst = Topology.Centroid(top)
|
@@ -4424,7 +4175,7 @@ class Topology():
|
|
4424
4175
|
|
4425
4176
|
Parameters
|
4426
4177
|
----------
|
4427
|
-
topology :
|
4178
|
+
topology : topologic_core.Topology
|
4428
4179
|
The input topology.
|
4429
4180
|
type : string
|
4430
4181
|
The topology type. This can be one of:
|
@@ -4485,7 +4236,7 @@ class Topology():
|
|
4485
4236
|
|
4486
4237
|
Parameters
|
4487
4238
|
----------
|
4488
|
-
topology :
|
4239
|
+
topology : topologic_core.Topology
|
4489
4240
|
The input topology.
|
4490
4241
|
tolerance : float , optional
|
4491
4242
|
The desired tolerance. The default is 0.0001.
|
@@ -4517,7 +4268,7 @@ class Topology():
|
|
4517
4268
|
d = (- a * v1.X() - b * v1.Y() - c * v1.Z())
|
4518
4269
|
return [a, b, c, d]
|
4519
4270
|
|
4520
|
-
if not
|
4271
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4521
4272
|
print("Topology.IsPlanar - Error: the input topology parameter is not a valid topology. Returning None.")
|
4522
4273
|
return None
|
4523
4274
|
vertices = Topology.Vertices(topology)
|
@@ -4540,9 +4291,9 @@ class Topology():
|
|
4540
4291
|
|
4541
4292
|
Parameters
|
4542
4293
|
----------
|
4543
|
-
topologyA :
|
4294
|
+
topologyA : topologic_core.Topology
|
4544
4295
|
The first input topology.
|
4545
|
-
topologyB :
|
4296
|
+
topologyB : topologic_core.Topology
|
4546
4297
|
The second input topology.
|
4547
4298
|
|
4548
4299
|
Returns
|
@@ -4551,10 +4302,10 @@ class Topology():
|
|
4551
4302
|
True of the input topologies are the same topology. False otherwise.
|
4552
4303
|
|
4553
4304
|
"""
|
4554
|
-
if not
|
4305
|
+
if not Topology.IsInstance(topologyA, "Topology"):
|
4555
4306
|
print("Topology.IsSame - Error: the input topologyA parameter is not a valid topology. Returning None.")
|
4556
4307
|
return None
|
4557
|
-
if not
|
4308
|
+
if not Topology.IsInstance(topologyB, "Topology"):
|
4558
4309
|
print("Topology.IsSame - Error: the input topologyB parameter is not a valid topology. Returning None.")
|
4559
4310
|
return None
|
4560
4311
|
return topologic.Topology.IsSame(topologyA, topologyB)
|
@@ -4573,7 +4324,7 @@ class Topology():
|
|
4573
4324
|
|
4574
4325
|
Returns
|
4575
4326
|
-------
|
4576
|
-
|
4327
|
+
topologic_core.Topology
|
4577
4328
|
The resulting merged Topology
|
4578
4329
|
|
4579
4330
|
"""
|
@@ -4584,7 +4335,7 @@ class Topology():
|
|
4584
4335
|
print("Topology.MergeAll - Error: the input topologies parameter is not a valid list. Returning None.")
|
4585
4336
|
return None
|
4586
4337
|
|
4587
|
-
topologyList = [t for t in topologies if
|
4338
|
+
topologyList = [t for t in topologies if Topology.IsInstance(t, "Topology")]
|
4588
4339
|
if len(topologyList) < 1:
|
4589
4340
|
print("Topology.MergeAll - Error: the input topologyList does not contain any valid topologies. Returning None.")
|
4590
4341
|
return None
|
@@ -4597,16 +4348,16 @@ class Topology():
|
|
4597
4348
|
|
4598
4349
|
Parameters
|
4599
4350
|
----------
|
4600
|
-
topology :
|
4351
|
+
topology : topologic_core.Topology
|
4601
4352
|
The input topology.
|
4602
4353
|
|
4603
4354
|
Returns
|
4604
4355
|
-------
|
4605
|
-
|
4356
|
+
topologic_core.TopoDS_Shape
|
4606
4357
|
The OCCT Shape.
|
4607
4358
|
|
4608
4359
|
"""
|
4609
|
-
if not
|
4360
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4610
4361
|
print("Topology.OCCTShape - Error: the input topology parameter is not a valid topology. Returning None.")
|
4611
4362
|
return None
|
4612
4363
|
return topology.GetOcctShape()
|
@@ -4618,9 +4369,9 @@ class Topology():
|
|
4618
4369
|
|
4619
4370
|
Parameters
|
4620
4371
|
----------
|
4621
|
-
topology :
|
4372
|
+
topology : topologic_core.Topology
|
4622
4373
|
The input topology.
|
4623
|
-
hostTopology :
|
4374
|
+
hostTopology : topologic_core.Topology
|
4624
4375
|
The input host topology to which the input topology belongs
|
4625
4376
|
|
4626
4377
|
Returns
|
@@ -4629,10 +4380,10 @@ class Topology():
|
|
4629
4380
|
The degree of the topology (the number of immediate super topologies that use the input topology).
|
4630
4381
|
|
4631
4382
|
"""
|
4632
|
-
if not
|
4383
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4633
4384
|
print("Topology.Degree - Error: the input topology parameter is not a valid topology. Returning None.")
|
4634
4385
|
return None
|
4635
|
-
if not
|
4386
|
+
if not Topology.IsInstance(hostTopology, "Topology"):
|
4636
4387
|
print("Topology.Degree - Error: the input hostTopology parameter is not a valid topology. Returning None.")
|
4637
4388
|
return None
|
4638
4389
|
|
@@ -4659,7 +4410,7 @@ class Topology():
|
|
4659
4410
|
|
4660
4411
|
Parameters
|
4661
4412
|
----------
|
4662
|
-
topology :
|
4413
|
+
topology : topologic_core.Topology
|
4663
4414
|
The input topology.
|
4664
4415
|
tolerance : float , optional
|
4665
4416
|
The desired tolerance. The default is 0.0001.
|
@@ -4669,7 +4420,7 @@ class Topology():
|
|
4669
4420
|
The list of nonplanar faces.
|
4670
4421
|
|
4671
4422
|
"""
|
4672
|
-
if not
|
4423
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4673
4424
|
print("Topology.NonPlanarFaces - Error: the input topology parameter is not a valid topology. Returning None.")
|
4674
4425
|
return None
|
4675
4426
|
faces = Topology.SubTopologies(topology, subTopologyType="face")
|
@@ -4682,7 +4433,7 @@ class Topology():
|
|
4682
4433
|
|
4683
4434
|
Parameters
|
4684
4435
|
----------
|
4685
|
-
topology :
|
4436
|
+
topology : topologic_core.Topology
|
4686
4437
|
The input topology.
|
4687
4438
|
|
4688
4439
|
Returns
|
@@ -4692,7 +4443,7 @@ class Topology():
|
|
4692
4443
|
|
4693
4444
|
"""
|
4694
4445
|
|
4695
|
-
if not
|
4446
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4696
4447
|
print("Topology.OpenFaces - Error: the input topology parameter is not a valid topology. Returning None.")
|
4697
4448
|
return None
|
4698
4449
|
|
@@ -4705,7 +4456,7 @@ class Topology():
|
|
4705
4456
|
|
4706
4457
|
Parameters
|
4707
4458
|
----------
|
4708
|
-
topology :
|
4459
|
+
topology : topologic_core.Topology
|
4709
4460
|
The input topology.
|
4710
4461
|
|
4711
4462
|
Returns
|
@@ -4715,7 +4466,7 @@ class Topology():
|
|
4715
4466
|
|
4716
4467
|
"""
|
4717
4468
|
|
4718
|
-
if not
|
4469
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4719
4470
|
print("Topology.OpenEdges - Error: the input topology parameter is not a valid topology. Returning None.")
|
4720
4471
|
return None
|
4721
4472
|
|
@@ -4728,7 +4479,7 @@ class Topology():
|
|
4728
4479
|
|
4729
4480
|
Parameters
|
4730
4481
|
----------
|
4731
|
-
topology :
|
4482
|
+
topology : topologic_core.Topology
|
4732
4483
|
The input topology.
|
4733
4484
|
|
4734
4485
|
Returns
|
@@ -4738,7 +4489,7 @@ class Topology():
|
|
4738
4489
|
|
4739
4490
|
"""
|
4740
4491
|
|
4741
|
-
if not
|
4492
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4742
4493
|
print("Topology.OpenVertices - Error: the input topology parameter is not a valid topology. Returning None.")
|
4743
4494
|
return None
|
4744
4495
|
|
@@ -4751,9 +4502,9 @@ class Topology():
|
|
4751
4502
|
|
4752
4503
|
Parameters
|
4753
4504
|
----------
|
4754
|
-
topology :
|
4505
|
+
topology : topologic_core.Topology
|
4755
4506
|
The input topology.
|
4756
|
-
origin :
|
4507
|
+
origin : topologic_core.Vertex , optional
|
4757
4508
|
The input origin. If set to None, The object's centroid will be used to locate the input topology. The default is None.
|
4758
4509
|
dirA : list , optional
|
4759
4510
|
The first input direction vector. The input topology will be rotated such that this vector is parallel to the input dirB vector. The default is [0, 0, 1].
|
@@ -4764,16 +4515,16 @@ class Topology():
|
|
4764
4515
|
|
4765
4516
|
Returns
|
4766
4517
|
-------
|
4767
|
-
|
4518
|
+
topologic_core.Topology
|
4768
4519
|
The flattened topology.
|
4769
4520
|
|
4770
4521
|
"""
|
4771
4522
|
from topologicpy.Vertex import Vertex
|
4772
4523
|
from topologicpy.Vector import Vector
|
4773
|
-
if not
|
4524
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4774
4525
|
print("Topology.Orient - Error: the input topology parameter is not a valid topology. Returning None.")
|
4775
4526
|
return None
|
4776
|
-
if not
|
4527
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
4777
4528
|
origin = Topology.Centroid(topology)
|
4778
4529
|
return_topology = Topology.Place(topology, originA=origin, originB=Vertex.Origin())
|
4779
4530
|
tran_mat = Vector.TransformationMatrix(dirA, dirB)
|
@@ -4788,25 +4539,25 @@ class Topology():
|
|
4788
4539
|
|
4789
4540
|
Parameters
|
4790
4541
|
----------
|
4791
|
-
topology :
|
4542
|
+
topology : topologic_core.Topology
|
4792
4543
|
The input topology.
|
4793
|
-
originA :
|
4544
|
+
originA : topologic_core.Vertex , optional
|
4794
4545
|
The old location to use as the origin of the movement. If set to None, the centroid of the input topology is used. The default is None.
|
4795
|
-
originB :
|
4546
|
+
originB : topologic_core.Vertex , optional
|
4796
4547
|
The new location at which to place the topology. If set to None, the world origin (0, 0, 0) is used. The default is None.
|
4797
4548
|
|
4798
4549
|
Returns
|
4799
4550
|
-------
|
4800
|
-
|
4551
|
+
topologic_core.Topology
|
4801
4552
|
The placed topology.
|
4802
4553
|
|
4803
4554
|
"""
|
4804
4555
|
from topologicpy.Vertex import Vertex
|
4805
|
-
if not
|
4556
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4806
4557
|
return None
|
4807
|
-
if not
|
4558
|
+
if not Topology.IsInstance(originA, "Vertex"):
|
4808
4559
|
originA = Topology.Centroid(topology)
|
4809
|
-
if not
|
4560
|
+
if not Topology.IsInstance(originA, "Vertex"):
|
4810
4561
|
originA = Vertex.ByCoordinates(0, 0, 0)
|
4811
4562
|
|
4812
4563
|
x = originB.X() - originA.X()
|
@@ -4827,7 +4578,7 @@ class Topology():
|
|
4827
4578
|
|
4828
4579
|
Parameters
|
4829
4580
|
----------
|
4830
|
-
topology :
|
4581
|
+
topology : topologic_core.Topology
|
4831
4582
|
The input topology.
|
4832
4583
|
angTolerance : float , optional
|
4833
4584
|
The desired angular tolerance. The default is 0.1.
|
@@ -4836,7 +4587,7 @@ class Topology():
|
|
4836
4587
|
|
4837
4588
|
Returns
|
4838
4589
|
-------
|
4839
|
-
|
4590
|
+
topologic_core.Topology
|
4840
4591
|
The input topology with the collinear edges removed.
|
4841
4592
|
|
4842
4593
|
"""
|
@@ -4847,28 +4598,27 @@ class Topology():
|
|
4847
4598
|
from topologicpy.CellComplex import CellComplex
|
4848
4599
|
from topologicpy.Cluster import Cluster
|
4849
4600
|
|
4850
|
-
if not
|
4601
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4851
4602
|
return None
|
4852
4603
|
return_topology = topology
|
4853
|
-
|
4854
|
-
if isinstance(topology, topologic.Vertex) or isinstance(topology, topologic.Edge): #Vertex or Edge or Cluster, return the original topology
|
4604
|
+
if Topology.IsInstance(topology, "Vertex") or Topology.IsInstance(topology, "Edge"): #Vertex or Edge or Cluster, return the original topology
|
4855
4605
|
return return_topology
|
4856
|
-
elif
|
4606
|
+
elif Topology.IsInstance(topology, "Wire"):
|
4857
4607
|
return_topology = Wire.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
|
4858
4608
|
return return_topology
|
4859
|
-
elif
|
4609
|
+
elif Topology.IsInstance(topology, "Face"):
|
4860
4610
|
return_topology = Face.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
|
4861
4611
|
return return_topology
|
4862
|
-
elif
|
4612
|
+
elif Topology.IsInstance(topology, "Shell"):
|
4863
4613
|
return_topology = Shell.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
|
4864
4614
|
return return_topology
|
4865
|
-
elif
|
4615
|
+
elif Topology.IsInstance(topology, "Cell"):
|
4866
4616
|
return_topology = Cell.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
|
4867
4617
|
return return_topology
|
4868
|
-
elif
|
4618
|
+
elif Topology.IsInstance(topology, "CellComplex"):
|
4869
4619
|
return_topology = CellComplex.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
|
4870
4620
|
return return_topology
|
4871
|
-
elif
|
4621
|
+
elif Topology.IsInstance(topology, "Cluster"):
|
4872
4622
|
topologies = []
|
4873
4623
|
topologies += Cluster.FreeVertices(topology)
|
4874
4624
|
topologies += Cluster.FreeEdges(topology)
|
@@ -4885,14 +4635,14 @@ class Topology():
|
|
4885
4635
|
|
4886
4636
|
Parameters
|
4887
4637
|
----------
|
4888
|
-
topology :
|
4638
|
+
topology : topologic_core.Topology
|
4889
4639
|
The input topology.
|
4890
4640
|
contentList : list
|
4891
4641
|
The input list of contents.
|
4892
4642
|
|
4893
4643
|
Returns
|
4894
4644
|
-------
|
4895
|
-
|
4645
|
+
topologic_core.Topology
|
4896
4646
|
The input topology with the input list of contents removed.
|
4897
4647
|
|
4898
4648
|
"""
|
@@ -4907,7 +4657,7 @@ class Topology():
|
|
4907
4657
|
|
4908
4658
|
Parameters
|
4909
4659
|
----------
|
4910
|
-
topology :
|
4660
|
+
topology : topologic_core.Topology
|
4911
4661
|
The input topology.
|
4912
4662
|
angTolerance : float , optional
|
4913
4663
|
The desired angular tolerance for removing coplanar faces. The default is 0.1.
|
@@ -4918,7 +4668,7 @@ class Topology():
|
|
4918
4668
|
|
4919
4669
|
Returns
|
4920
4670
|
-------
|
4921
|
-
|
4671
|
+
topologic_core.Topology
|
4922
4672
|
The input topology with coplanar faces merged into one face.
|
4923
4673
|
|
4924
4674
|
"""
|
@@ -4929,11 +4679,11 @@ class Topology():
|
|
4929
4679
|
from topologicpy.CellComplex import CellComplex
|
4930
4680
|
from topologicpy.Cluster import Cluster
|
4931
4681
|
|
4932
|
-
if not
|
4933
|
-
print("Topology.
|
4682
|
+
if not Topology.IsInstance(topology, "Topology"):
|
4683
|
+
print("Topology.RemoveCoplanarFaces - Error: The input topology parameter is not a valid topologic topology. Returning None.")
|
4934
4684
|
return None
|
4935
|
-
t =
|
4936
|
-
if (t ==
|
4685
|
+
t = Topology.Type(topology)
|
4686
|
+
if (t == Topology.TypeID("Vertex")) or (t == Topology.TypeID("Edge")) or (t == Topology.TypeID("Wire")) or (t == Topology.TypeID("Face")):
|
4937
4687
|
return topology
|
4938
4688
|
|
4939
4689
|
def faces_on_same_plane(face1, face2, epsilon=1e-6):
|
@@ -4971,12 +4721,12 @@ class Topology():
|
|
4971
4721
|
final_faces = []
|
4972
4722
|
for face_cluster in face_clusters:
|
4973
4723
|
t = Topology.SelfMerge(Cluster.ByTopologies(face_cluster), tolerance=tolerance)
|
4974
|
-
if
|
4724
|
+
if Topology.IsInstance(t, "Face"):
|
4975
4725
|
#final_faces.append(Face.RemoveCollinearEdges(t))
|
4976
4726
|
final_faces.append(t)
|
4977
|
-
elif
|
4727
|
+
elif Topology.IsInstance(t, "Shell"):
|
4978
4728
|
f = Face.ByShell(t)
|
4979
|
-
if
|
4729
|
+
if Topology.IsInstance(f, "Face"):
|
4980
4730
|
final_faces.append(f)
|
4981
4731
|
else:
|
4982
4732
|
print("Topology.RemoveCoplanarFaces - Warning: Could not remove some coplanar faces. Re-adding original faces.")
|
@@ -4985,7 +4735,7 @@ class Topology():
|
|
4985
4735
|
shells = Topology.Shells(t)
|
4986
4736
|
for shell in shells:
|
4987
4737
|
f = Face.ByShell(shell)
|
4988
|
-
if
|
4738
|
+
if Topology.IsInstance(f, "Face"):
|
4989
4739
|
final_faces.append(f)
|
4990
4740
|
else:
|
4991
4741
|
print("Topology.RemoveCoplanarFaces - Warning: Could not remove some coplanar faces. Re-adding original faces.")
|
@@ -4996,16 +4746,16 @@ class Topology():
|
|
4996
4746
|
faces = Cluster.FreeFaces(t)
|
4997
4747
|
final_faces += faces
|
4998
4748
|
return_topology = None
|
4999
|
-
if
|
4749
|
+
if Topology.IsInstance(topology, "CellComplex"):
|
5000
4750
|
return_topology = CellComplex.ByFaces(final_faces, tolerance=tolerance)
|
5001
|
-
elif
|
4751
|
+
elif Topology.IsInstance(topology, "Cell"):
|
5002
4752
|
return_topology = Cell.ByFaces(final_faces, tolerance=tolerance)
|
5003
|
-
elif
|
4753
|
+
elif Topology.IsInstance(topology, "Shell"):
|
5004
4754
|
if len(final_faces) == 1:
|
5005
4755
|
return_topology = final_faces[0]
|
5006
4756
|
else:
|
5007
4757
|
return_topology = Shell.ByFaces(final_faces, tolerance=tolerance)
|
5008
|
-
if not
|
4758
|
+
if not Topology.IsInstance(return_topology, "Topology"):
|
5009
4759
|
return_topology = Cluster.ByTopologies(final_faces)
|
5010
4760
|
return return_topology
|
5011
4761
|
|
@@ -5016,7 +4766,7 @@ class Topology():
|
|
5016
4766
|
|
5017
4767
|
Parameters
|
5018
4768
|
----------
|
5019
|
-
topology :
|
4769
|
+
topology : topologic_core.Topology
|
5020
4770
|
The input topology.
|
5021
4771
|
edges : list
|
5022
4772
|
The input list of edges.
|
@@ -5025,15 +4775,15 @@ class Topology():
|
|
5025
4775
|
|
5026
4776
|
Returns
|
5027
4777
|
-------
|
5028
|
-
|
4778
|
+
topologic_core.Topology
|
5029
4779
|
The input topology with the input list of edges removed.
|
5030
4780
|
|
5031
4781
|
"""
|
5032
4782
|
|
5033
4783
|
from topologicpy.Cluster import Cluster
|
5034
|
-
if not
|
4784
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5035
4785
|
return None
|
5036
|
-
edges = [e for e in edges if
|
4786
|
+
edges = [e for e in edges if Topology.IsInstance(e, "Edge")]
|
5037
4787
|
if len(edges) < 1:
|
5038
4788
|
return topology
|
5039
4789
|
t_edges = Topology.Edges(topology)
|
@@ -5076,7 +4826,7 @@ class Topology():
|
|
5076
4826
|
|
5077
4827
|
Parameters
|
5078
4828
|
----------
|
5079
|
-
topology :
|
4829
|
+
topology : topologic_core.Topology
|
5080
4830
|
The input topology.
|
5081
4831
|
faces : list
|
5082
4832
|
The input list of faces.
|
@@ -5085,15 +4835,15 @@ class Topology():
|
|
5085
4835
|
|
5086
4836
|
Returns
|
5087
4837
|
-------
|
5088
|
-
|
4838
|
+
topologic_core.Topology
|
5089
4839
|
The input topology with the input list of faces removed.
|
5090
4840
|
|
5091
4841
|
"""
|
5092
4842
|
|
5093
4843
|
from topologicpy.Cluster import Cluster
|
5094
|
-
if not
|
4844
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5095
4845
|
return None
|
5096
|
-
faces = [f for f in faces if
|
4846
|
+
faces = [f for f in faces if Topology.IsInstance(f, "Face")]
|
5097
4847
|
if len(faces) < 1:
|
5098
4848
|
return topology
|
5099
4849
|
t_faces = Topology.Faces(topology)
|
@@ -5122,7 +4872,7 @@ class Topology():
|
|
5122
4872
|
|
5123
4873
|
Parameters
|
5124
4874
|
----------
|
5125
|
-
topology :
|
4875
|
+
topology : topologic_core.Topology
|
5126
4876
|
The input topology.
|
5127
4877
|
selectors : list
|
5128
4878
|
The input list of selectors (vertices).
|
@@ -5131,15 +4881,15 @@ class Topology():
|
|
5131
4881
|
|
5132
4882
|
Returns
|
5133
4883
|
-------
|
5134
|
-
|
4884
|
+
topologic_core.Topology
|
5135
4885
|
The input topology with the identified faces removed.
|
5136
4886
|
|
5137
4887
|
"""
|
5138
4888
|
from topologicpy.Vertex import Vertex
|
5139
4889
|
|
5140
|
-
if not
|
4890
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5141
4891
|
return None
|
5142
|
-
selectors = [v for v in selectors if
|
4892
|
+
selectors = [v for v in selectors if Topology.IsInstance(v, "Vertex")]
|
5143
4893
|
if len(selectors) < 1:
|
5144
4894
|
return topology
|
5145
4895
|
t_faces = Topology.Faces(topology)
|
@@ -5164,7 +4914,7 @@ class Topology():
|
|
5164
4914
|
|
5165
4915
|
Parameters
|
5166
4916
|
----------
|
5167
|
-
topology :
|
4917
|
+
topology : topologic_core.Topology
|
5168
4918
|
The input topology.
|
5169
4919
|
vertices : list
|
5170
4920
|
The input list of vertices.
|
@@ -5173,15 +4923,15 @@ class Topology():
|
|
5173
4923
|
|
5174
4924
|
Returns
|
5175
4925
|
-------
|
5176
|
-
|
4926
|
+
topologic_core.Topology
|
5177
4927
|
The input topology with the input list of vertices removed.
|
5178
4928
|
|
5179
4929
|
"""
|
5180
4930
|
|
5181
4931
|
from topologicpy.Cluster import Cluster
|
5182
|
-
if not
|
4932
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5183
4933
|
return None
|
5184
|
-
vertices = [v for v in vertices if
|
4934
|
+
vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
|
5185
4935
|
if len(vertices) < 1:
|
5186
4936
|
return topology
|
5187
4937
|
t_vertices = Topology.Vertices(topology)
|
@@ -5225,16 +4975,16 @@ class Topology():
|
|
5225
4975
|
|
5226
4976
|
Parameters
|
5227
4977
|
----------
|
5228
|
-
topology :
|
4978
|
+
topology : topologic_core.Topology , optional
|
5229
4979
|
If specified the resources used by the input topology will be deleted. If not, ALL resources will be deleted.
|
5230
4980
|
|
5231
4981
|
Returns
|
5232
4982
|
-------
|
5233
|
-
|
4983
|
+
topologic_core.Topology
|
5234
4984
|
The input topology, but with its resources deleted or None.
|
5235
4985
|
"""
|
5236
4986
|
if not topology == None:
|
5237
|
-
if not
|
4987
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5238
4988
|
print("Topology.Cleanup - Error: The input topology parameter is not a valid topology. Returning None.")
|
5239
4989
|
return None
|
5240
4990
|
topologic.Topology.Cleanup(topology)
|
@@ -5247,7 +4997,7 @@ class Topology():
|
|
5247
4997
|
|
5248
4998
|
Parameters
|
5249
4999
|
----------
|
5250
|
-
topology :
|
5000
|
+
topology : topologic_core.Topology
|
5251
5001
|
The input topology.
|
5252
5002
|
verticesA : list
|
5253
5003
|
The first input list of vertices.
|
@@ -5260,7 +5010,7 @@ class Topology():
|
|
5260
5010
|
|
5261
5011
|
Returns
|
5262
5012
|
-------
|
5263
|
-
|
5013
|
+
topologic_core.Topology
|
5264
5014
|
The new topology.
|
5265
5015
|
|
5266
5016
|
"""
|
@@ -5289,9 +5039,9 @@ class Topology():
|
|
5289
5039
|
|
5290
5040
|
Parameters
|
5291
5041
|
----------
|
5292
|
-
topology :
|
5042
|
+
topology : topologic_core.Topology
|
5293
5043
|
The input topology.
|
5294
|
-
origin :
|
5044
|
+
origin : topologic_core.Vertex , optional
|
5295
5045
|
The origin (center) of the rotation. If set to None, the world origin (0, 0, 0) is used. The default is None.
|
5296
5046
|
axis : list , optional
|
5297
5047
|
The vector representing the axis of rotation. The default is [0, 0, 1] which equates to the Z axis.
|
@@ -5304,7 +5054,7 @@ class Topology():
|
|
5304
5054
|
|
5305
5055
|
Returns
|
5306
5056
|
-------
|
5307
|
-
|
5057
|
+
topologic_core.Topology
|
5308
5058
|
The rotated topology.
|
5309
5059
|
|
5310
5060
|
"""
|
@@ -5335,12 +5085,12 @@ class Topology():
|
|
5335
5085
|
rotated_vertex = [v for v in rotated_vertex]
|
5336
5086
|
return rotated_vertex
|
5337
5087
|
|
5338
|
-
if not
|
5088
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5339
5089
|
print("Topology.Rotate - Error: The input topology parameter is not a valid topologic topology. Returning None.")
|
5340
5090
|
return None
|
5341
5091
|
if not origin:
|
5342
5092
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
5343
|
-
if not
|
5093
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
5344
5094
|
print("Topology.Rotate - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
5345
5095
|
return None
|
5346
5096
|
returnTopology = topology
|
@@ -5368,9 +5118,9 @@ class Topology():
|
|
5368
5118
|
|
5369
5119
|
Parameters
|
5370
5120
|
----------
|
5371
|
-
topology :
|
5121
|
+
topology : topologic_core.Topology
|
5372
5122
|
The input topology.
|
5373
|
-
origin :
|
5123
|
+
origin : topologic_core.Vertex , optional
|
5374
5124
|
The origin (center) of the scaling. If set to None, the world origin (0, 0, 0) is used. The default is None.
|
5375
5125
|
x : float , optional
|
5376
5126
|
The 'x' component of the scaling factor. The default is 1.
|
@@ -5381,16 +5131,16 @@ class Topology():
|
|
5381
5131
|
|
5382
5132
|
Returns
|
5383
5133
|
-------
|
5384
|
-
|
5134
|
+
topologic_core.Topology
|
5385
5135
|
The scaled topology.
|
5386
5136
|
|
5387
5137
|
"""
|
5388
5138
|
from topologicpy.Vertex import Vertex
|
5389
|
-
if not
|
5139
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5390
5140
|
return None
|
5391
5141
|
if not origin:
|
5392
5142
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
5393
|
-
if not
|
5143
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
5394
5144
|
return None
|
5395
5145
|
newTopology = None
|
5396
5146
|
try:
|
@@ -5408,22 +5158,22 @@ class Topology():
|
|
5408
5158
|
|
5409
5159
|
Parameters
|
5410
5160
|
----------
|
5411
|
-
topology :
|
5161
|
+
topology : topologic_core.Topology
|
5412
5162
|
The input topology.
|
5413
|
-
selector :
|
5163
|
+
selector : topologic_core.Vertex
|
5414
5164
|
A vertex located on the desired subtopology.
|
5415
5165
|
subTopologyType : str , optional.
|
5416
5166
|
The desired subtopology type. This can be of "vertex", "edge", "wire", "face", "shell", "cell", or "cellcomplex". It is case insensitive. The default is "vertex".
|
5417
5167
|
|
5418
5168
|
Returns
|
5419
5169
|
-------
|
5420
|
-
|
5170
|
+
topologic_core.Topology
|
5421
5171
|
The selected subtopology.
|
5422
5172
|
|
5423
5173
|
"""
|
5424
|
-
if not
|
5174
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5425
5175
|
return None
|
5426
|
-
if not
|
5176
|
+
if not Topology.IsInstance(selector, "Vertex"):
|
5427
5177
|
return None
|
5428
5178
|
t = 1
|
5429
5179
|
if subTopologyType.lower() == "vertex":
|
@@ -5450,71 +5200,59 @@ class Topology():
|
|
5450
5200
|
|
5451
5201
|
Parameters
|
5452
5202
|
----------
|
5453
|
-
topology :
|
5203
|
+
topology : topologic_core.Topology
|
5454
5204
|
The input topology.
|
5455
5205
|
tolerance : float , optional
|
5456
5206
|
The desired tolerance. The default is 0.0001
|
5457
5207
|
|
5458
5208
|
Returns
|
5459
5209
|
-------
|
5460
|
-
|
5210
|
+
topologic_core.Topology
|
5461
5211
|
The self-merged topology.
|
5462
5212
|
|
5463
5213
|
"""
|
5464
5214
|
from topologicpy.Cluster import Cluster
|
5465
|
-
|
5215
|
+
|
5216
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5466
5217
|
return None #return Silently
|
5467
|
-
if
|
5218
|
+
if not Topology.Type(topology) == Topology.TypeID("Cluster"):
|
5468
5219
|
topology = Cluster.ByTopologies([topology])
|
5469
5220
|
resultingTopologies = []
|
5470
|
-
topCC =
|
5471
|
-
|
5472
|
-
|
5473
|
-
|
5474
|
-
|
5475
|
-
|
5476
|
-
|
5477
|
-
_ = topology.Faces(None, topFaces)
|
5478
|
-
topWires = []
|
5479
|
-
_ = topology.Wires(None, topWires)
|
5480
|
-
topEdges = []
|
5481
|
-
_ = topology.Edges(None, topEdges)
|
5482
|
-
topVertices = []
|
5483
|
-
_ = topology.Vertices(None, topVertices)
|
5221
|
+
topCC = Topology.CellComplexes(topology)
|
5222
|
+
topCells = Topology.Cells(topology)
|
5223
|
+
topShells = Topology.Shells(topology)
|
5224
|
+
topFaces = Topology.Faces(topology)
|
5225
|
+
topWires = Topology.Wires(topology)
|
5226
|
+
topEdges = Topology.Edges(topology)
|
5227
|
+
topVertices = Topology.Vertices(topology)
|
5484
5228
|
if len(topCC) == 1:
|
5485
5229
|
cc = topCC[0]
|
5486
|
-
ccVertices =
|
5487
|
-
_ = cc.Vertices(None, ccVertices)
|
5230
|
+
ccVertices = Topology.Vertices(cc)
|
5488
5231
|
if len(topVertices) == len(ccVertices):
|
5489
5232
|
resultingTopologies.append(cc)
|
5490
5233
|
if len(topCC) == 0 and len(topCells) == 1:
|
5491
5234
|
cell = topCells[0]
|
5492
|
-
ccVertices =
|
5493
|
-
_ = cell.Vertices(None, ccVertices)
|
5235
|
+
ccVertices = Topology.Vertices(cell)
|
5494
5236
|
if len(topVertices) == len(ccVertices):
|
5495
5237
|
resultingTopologies.append(cell)
|
5496
5238
|
if len(topCC) == 0 and len(topCells) == 0 and len(topShells) == 1:
|
5497
5239
|
shell = topShells[0]
|
5498
|
-
ccVertices =
|
5499
|
-
_ = shell.Vertices(None, ccVertices)
|
5240
|
+
ccVertices = Topology.Vertices(shell)
|
5500
5241
|
if len(topVertices) == len(ccVertices):
|
5501
5242
|
resultingTopologies.append(shell)
|
5502
5243
|
if len(topCC) == 0 and len(topCells) == 0 and len(topShells) == 0 and len(topFaces) == 1:
|
5503
5244
|
face = topFaces[0]
|
5504
|
-
ccVertices =
|
5505
|
-
_ = face.Vertices(None, ccVertices)
|
5245
|
+
ccVertices = Topology.Vertices(face)
|
5506
5246
|
if len(topVertices) == len(ccVertices):
|
5507
5247
|
resultingTopologies.append(face)
|
5508
5248
|
if len(topCC) == 0 and len(topCells) == 0 and len(topShells) == 0 and len(topFaces) == 0 and len(topWires) == 1:
|
5509
5249
|
wire = topWires[0]
|
5510
|
-
ccVertices =
|
5511
|
-
_ = wire.Vertices(None, ccVertices)
|
5250
|
+
ccVertices = Topology.Vertices(wire)
|
5512
5251
|
if len(topVertices) == len(ccVertices):
|
5513
5252
|
resultingTopologies.append(wire)
|
5514
5253
|
if len(topCC) == 0 and len(topCells) == 0 and len(topShells) == 0 and len(topFaces) == 0 and len(topWires) == 0 and len(topEdges) == 1:
|
5515
5254
|
edge = topEdges[0]
|
5516
|
-
ccVertices =
|
5517
|
-
_ = edge.Vertices(None, ccVertices)
|
5255
|
+
ccVertices = Topology.Vertices(edge)
|
5518
5256
|
if len(topVertices) == len(ccVertices):
|
5519
5257
|
resultingTopologies.append(edge)
|
5520
5258
|
if len(topCC) == 0 and len(topCells) == 0 and len(topShells) == 0 and len(topFaces) == 0 and len(topWires) == 0 and len(topEdges) == 0 and len(topVertices) == 1:
|
@@ -5526,7 +5264,7 @@ class Topology():
|
|
5526
5264
|
return_topology = topology.SelfMerge()
|
5527
5265
|
except:
|
5528
5266
|
return_topology = None
|
5529
|
-
if
|
5267
|
+
if Topology.IsInstance(return_topology, "CellComplex"):
|
5530
5268
|
cells = Topology.Cells(return_topology)
|
5531
5269
|
if isinstance(cells, list):
|
5532
5270
|
if len(cells) > 1:
|
@@ -5544,25 +5282,25 @@ class Topology():
|
|
5544
5282
|
|
5545
5283
|
Parameters
|
5546
5284
|
----------
|
5547
|
-
topology :
|
5285
|
+
topology : topologic_core.Topology
|
5548
5286
|
The input topology.
|
5549
|
-
dictionary :
|
5287
|
+
dictionary : topologic_core.Dictionary
|
5550
5288
|
The input dictionary.
|
5551
5289
|
|
5552
5290
|
Returns
|
5553
5291
|
-------
|
5554
|
-
|
5292
|
+
topologic_core.Topology
|
5555
5293
|
The input topology with the input dictionary set in it.
|
5556
5294
|
|
5557
5295
|
"""
|
5558
5296
|
from topologicpy.Dictionary import Dictionary
|
5559
5297
|
|
5560
|
-
if not
|
5298
|
+
if not Topology.IsInstance(topology, "Topology") and not Topology.IsInstance(topology, "Graph"):
|
5561
5299
|
print("Topology.SetDictionary - Error: the input topology parameter is not a valid topology or graph. Returning None.")
|
5562
5300
|
return None
|
5563
5301
|
if isinstance(dictionary, dict):
|
5564
5302
|
dictionary = Dictionary.ByPythonDictionary(dictionary)
|
5565
|
-
if not
|
5303
|
+
if not Topology.IsInstance(dictionary, "Dictionary"):
|
5566
5304
|
print("Topology.SetDictionary - Warning: the input dictionary parameter is not a valid dictionary. Returning original input.")
|
5567
5305
|
return topology
|
5568
5306
|
if len(dictionary.Keys()) < 1:
|
@@ -5573,6 +5311,7 @@ class Topology():
|
|
5573
5311
|
|
5574
5312
|
@staticmethod
|
5575
5313
|
def SetSnapshot(topology, snapshot=None, timestamp=None, key="timestamp", silent=False):
|
5314
|
+
from topologicpy.Dictionary import Dictionary
|
5576
5315
|
from datetime import datetime
|
5577
5316
|
def is_valid_timestamp(timestamp):
|
5578
5317
|
if isinstance(timestamp, datetime):
|
@@ -5596,13 +5335,13 @@ class Topology():
|
|
5596
5335
|
else:
|
5597
5336
|
return False
|
5598
5337
|
|
5599
|
-
if not
|
5338
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5600
5339
|
if not silent:
|
5601
5340
|
print("Topology.SetSnapshot - Error: The input topology parameter is not a valid topology. Returning None.")
|
5602
5341
|
return None
|
5603
|
-
if not
|
5342
|
+
if not Topology.IsInstance(snapshot, "Topology"):
|
5604
5343
|
snapshot = Topology.Copy(topology)
|
5605
|
-
if not
|
5344
|
+
if not Topology.IsInstance(snapshot, "Topology"):
|
5606
5345
|
if not silent:
|
5607
5346
|
print("Topology.SetSnapshot - Error: The input snapshot parameter is not a valid topology. Returning None.")
|
5608
5347
|
return None
|
@@ -5626,9 +5365,9 @@ class Topology():
|
|
5626
5365
|
|
5627
5366
|
Parameters
|
5628
5367
|
----------
|
5629
|
-
topologyA :
|
5368
|
+
topologyA : topologic_core.Topology
|
5630
5369
|
The first input topology.
|
5631
|
-
topologyB :
|
5370
|
+
topologyB : topologic_core.Topology
|
5632
5371
|
The second input topology.
|
5633
5372
|
|
5634
5373
|
Returns
|
@@ -5638,10 +5377,10 @@ class Topology():
|
|
5638
5377
|
|
5639
5378
|
"""
|
5640
5379
|
|
5641
|
-
if not
|
5380
|
+
if not Topology.IsInstance(topologyA, "Topology"):
|
5642
5381
|
print("Topology.SharedTopologies - Error: the input topologyA parameter is not a valid topology. Returning None.")
|
5643
5382
|
return None
|
5644
|
-
if not
|
5383
|
+
if not Topology.IsInstance(topologyB, "Topology"):
|
5645
5384
|
print("Topology.SharedTopologies - Error: the input topologyB parameter is not a valid topology. Returning None.")
|
5646
5385
|
return None
|
5647
5386
|
vOutput = []
|
@@ -5661,9 +5400,9 @@ class Topology():
|
|
5661
5400
|
|
5662
5401
|
Parameters
|
5663
5402
|
----------
|
5664
|
-
topologyA :
|
5403
|
+
topologyA : topologic_core.Topology
|
5665
5404
|
The first input topology.
|
5666
|
-
topologyB :
|
5405
|
+
topologyB : topologic_core.Topology
|
5667
5406
|
The second input topology.
|
5668
5407
|
|
5669
5408
|
Returns
|
@@ -5689,9 +5428,9 @@ class Topology():
|
|
5689
5428
|
|
5690
5429
|
Parameters
|
5691
5430
|
----------
|
5692
|
-
topologyA :
|
5431
|
+
topologyA : topologic_core.Topology
|
5693
5432
|
The first input topology.
|
5694
|
-
topologyB :
|
5433
|
+
topologyB : topologic_core.Topology
|
5695
5434
|
The second input topology.
|
5696
5435
|
|
5697
5436
|
Returns
|
@@ -5716,9 +5455,9 @@ class Topology():
|
|
5716
5455
|
|
5717
5456
|
Parameters
|
5718
5457
|
----------
|
5719
|
-
topologyA :
|
5458
|
+
topologyA : topologic_core.Topology
|
5720
5459
|
The first input topology.
|
5721
|
-
topologyB :
|
5460
|
+
topologyB : topologic_core.Topology
|
5722
5461
|
The second input topology.
|
5723
5462
|
|
5724
5463
|
Returns
|
@@ -5744,9 +5483,9 @@ class Topology():
|
|
5744
5483
|
|
5745
5484
|
Parameters
|
5746
5485
|
----------
|
5747
|
-
topologyA :
|
5486
|
+
topologyA : topologic_core.Topology
|
5748
5487
|
The first input topology.
|
5749
|
-
topologyB :
|
5488
|
+
topologyB : topologic_core.Topology
|
5750
5489
|
The second input topology.
|
5751
5490
|
|
5752
5491
|
Returns
|
@@ -5799,7 +5538,7 @@ class Topology():
|
|
5799
5538
|
|
5800
5539
|
Parameters
|
5801
5540
|
----------
|
5802
|
-
topologies :
|
5541
|
+
topologies : topologic_core.Topology or list
|
5803
5542
|
The input topology. This must contain faces and or edges. If the input is a list, a cluster is first created
|
5804
5543
|
|
5805
5544
|
showVertices : bool , optional
|
@@ -5973,8 +5712,8 @@ class Topology():
|
|
5973
5712
|
if isinstance(topologies, tuple):
|
5974
5713
|
topologies = Helper.Flatten(list(topologies))
|
5975
5714
|
if isinstance(topologies, list):
|
5976
|
-
new_topologies = [t for t in topologies if
|
5977
|
-
graphs = [Graph.Topology(g) for g in topologies if
|
5715
|
+
new_topologies = [t for t in topologies if Topology.IsInstance(t, "Topology")]
|
5716
|
+
graphs = [Graph.Topology(g) for g in topologies if Topology.IsInstance(g, "Graph")]
|
5978
5717
|
new_topologies += graphs
|
5979
5718
|
if len(new_topologies) == 0:
|
5980
5719
|
print("Topology.Show - Error: the input topologies parameter does not contain any valid topology. Returning None.")
|
@@ -5983,7 +5722,7 @@ class Topology():
|
|
5983
5722
|
topology = new_topologies[0]
|
5984
5723
|
else:
|
5985
5724
|
topology = Cluster.ByTopologies(new_topologies)
|
5986
|
-
if not
|
5725
|
+
if not Topology.IsInstance(topology, "Topology"):
|
5987
5726
|
print("Topology.Show - Error: the input topology parameter is not a valid topology. Returning None.")
|
5988
5727
|
return None
|
5989
5728
|
data = Plotly.DataByTopology(topology=topology,
|
@@ -6062,6 +5801,7 @@ class Topology():
|
|
6062
5801
|
|
6063
5802
|
@staticmethod
|
6064
5803
|
def Snapshots(topology, key="timestamp", start=None, end=None, silent=False):
|
5804
|
+
from topologicpy.Dictionary import Dictionary
|
6065
5805
|
from datetime import datetime
|
6066
5806
|
def is_valid_timestamp(timestamp):
|
6067
5807
|
if isinstance(timestamp, datetime):
|
@@ -6084,7 +5824,7 @@ class Topology():
|
|
6084
5824
|
else:
|
6085
5825
|
return False
|
6086
5826
|
|
6087
|
-
if not
|
5827
|
+
if not Topology.IsInstance(topology, "Topology"):
|
6088
5828
|
if not silent:
|
6089
5829
|
print("Topology.Snapshots - Error: The input topology parameter is not a valid topology. Returning None.")
|
6090
5830
|
return None
|
@@ -6119,9 +5859,9 @@ class Topology():
|
|
6119
5859
|
|
6120
5860
|
Parameters
|
6121
5861
|
----------
|
6122
|
-
topology :
|
5862
|
+
topology : topologic_core.Topology
|
6123
5863
|
The input topology.
|
6124
|
-
origin :
|
5864
|
+
origin : topologic_core.Vertex
|
6125
5865
|
The origin (center) of the spin.
|
6126
5866
|
triangulate : bool , optional
|
6127
5867
|
If set to True, the result will be triangulated. The default is True.
|
@@ -6136,7 +5876,7 @@ class Topology():
|
|
6136
5876
|
|
6137
5877
|
Returns
|
6138
5878
|
-------
|
6139
|
-
|
5879
|
+
topologic_core.Topology
|
6140
5880
|
The spun topology.
|
6141
5881
|
|
6142
5882
|
"""
|
@@ -6149,11 +5889,11 @@ class Topology():
|
|
6149
5889
|
|
6150
5890
|
if not origin:
|
6151
5891
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
6152
|
-
if not
|
5892
|
+
if not Topology.IsInstance(topology, "Topology"):
|
6153
5893
|
if not silent:
|
6154
5894
|
print("Topology.Spin - Error: the input topology parameter is not a valid topology. Returning None.")
|
6155
5895
|
return None
|
6156
|
-
if not
|
5896
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
6157
5897
|
if not silent:
|
6158
5898
|
print("Topology.Spin - Error: the input origin parameter is not a valid vertex. Returning None.")
|
6159
5899
|
return None
|
@@ -6164,9 +5904,9 @@ class Topology():
|
|
6164
5904
|
if tempTopology:
|
6165
5905
|
topologies.append(tempTopology)
|
6166
5906
|
returnTopology = None
|
6167
|
-
if
|
5907
|
+
if Topology.Type(topology) == Topology.TypeID("Vertex"):
|
6168
5908
|
returnTopology = Wire.ByVertices(topologies, False)
|
6169
|
-
elif
|
5909
|
+
elif Topology.Type(topology) == Topology.TypeID("Edge"):
|
6170
5910
|
try:
|
6171
5911
|
returnTopology = Shell.ByWires(topologies,triangulate=triangulate, tolerance=tolerance, silent=True)
|
6172
5912
|
except:
|
@@ -6174,7 +5914,7 @@ class Topology():
|
|
6174
5914
|
returnTopology = Cluster.ByTopologies(topologies)
|
6175
5915
|
except:
|
6176
5916
|
returnTopology = None
|
6177
|
-
elif
|
5917
|
+
elif Topology.Type(topology) == Topology.TypeID("Wire"):
|
6178
5918
|
if topology.IsClosed():
|
6179
5919
|
#returnTopology = Cell.ByWires(topologies, triangulate=triangulate, tolerance=tolerance, silent=True)
|
6180
5920
|
try:
|
@@ -6205,7 +5945,7 @@ class Topology():
|
|
6205
5945
|
returnTopology = Cluster.ByTopologies(topologies)
|
6206
5946
|
except:
|
6207
5947
|
returnTopology = None
|
6208
|
-
elif
|
5948
|
+
elif Topology.IsInstance(topology, "Face"):
|
6209
5949
|
external_wires = []
|
6210
5950
|
for t in topologies:
|
6211
5951
|
external_wires.append(topologic.Face.ExternalBoundary(t))
|
@@ -6223,7 +5963,7 @@ class Topology():
|
|
6223
5963
|
returnTopology = Topology.SelfMerge(Cluster.ByTopologies(topologies), tolerance=tolerance)
|
6224
5964
|
if not returnTopology:
|
6225
5965
|
return Cluster.ByTopologies(topologies)
|
6226
|
-
if
|
5966
|
+
if Topology.Type(returnTopology) == Topology.TypeID("Shell"):
|
6227
5967
|
try:
|
6228
5968
|
new_t = Cell.ByShell(returnTopology)
|
6229
5969
|
if new_t:
|
@@ -6239,9 +5979,9 @@ class Topology():
|
|
6239
5979
|
|
6240
5980
|
Parameters
|
6241
5981
|
----------
|
6242
|
-
topology :
|
5982
|
+
topology : topologic_core.Topology
|
6243
5983
|
The input topology.
|
6244
|
-
origin :
|
5984
|
+
origin : topologic_core.Vertex , optional
|
6245
5985
|
The desired origin for tapering. If not specified, the centroid of the input topology is used. The tapering will use the X, Y coordinates of the specified origin, but will use the Z of the point being tapered. The default is None.
|
6246
5986
|
ratioRange : list , optional
|
6247
5987
|
The desired ratio range. This will specify a linear range from bottom to top for tapering the vertices. 0 means no tapering, and 1 means maximum (inward) tapering. Negative numbers mean that tapering will be outwards.
|
@@ -6252,7 +5992,7 @@ class Topology():
|
|
6252
5992
|
|
6253
5993
|
Returns
|
6254
5994
|
-------
|
6255
|
-
|
5995
|
+
topologic_core.Topology
|
6256
5996
|
The tapered topology.
|
6257
5997
|
|
6258
5998
|
"""
|
@@ -6295,9 +6035,9 @@ class Topology():
|
|
6295
6035
|
|
6296
6036
|
Parameters
|
6297
6037
|
----------
|
6298
|
-
topology :
|
6038
|
+
topology : topologic_core.Topology
|
6299
6039
|
The input topology.
|
6300
|
-
origin :
|
6040
|
+
origin : topologic_core.Vertex , optional
|
6301
6041
|
The desired origin for tapering. If not specified, the centroid of the input topology is used. The tapering will use the X, Y coordinates of the specified origin, but will use the Z of the point being tapered. The default is None.
|
6302
6042
|
angleRange : list , optional
|
6303
6043
|
The desired angle range in degrees. This will specify a linear range from bottom to top for twisting the vertices. positive numbers mean a clockwise rotation.
|
@@ -6306,7 +6046,7 @@ class Topology():
|
|
6306
6046
|
|
6307
6047
|
Returns
|
6308
6048
|
-------
|
6309
|
-
|
6049
|
+
topologic_core.Topology
|
6310
6050
|
The twisted topology.
|
6311
6051
|
|
6312
6052
|
"""
|
@@ -6341,23 +6081,23 @@ class Topology():
|
|
6341
6081
|
|
6342
6082
|
Parameters
|
6343
6083
|
----------
|
6344
|
-
topology :
|
6084
|
+
topology : topologic_core.Topology
|
6345
6085
|
The input topology.
|
6346
|
-
origin :
|
6086
|
+
origin : topologic_core.Vertex , optional
|
6347
6087
|
The input origin. If set to None, The object's centroid will be used to translate the world origin. The default is None.
|
6348
6088
|
vector : list , optional
|
6349
6089
|
The input direction vector. The input topology will be rotated such that this vector is pointed in the positive Z axis.
|
6350
6090
|
|
6351
6091
|
Returns
|
6352
6092
|
-------
|
6353
|
-
|
6093
|
+
topologic_core.Topology
|
6354
6094
|
The flattened topology.
|
6355
6095
|
|
6356
6096
|
"""
|
6357
6097
|
from topologicpy.Vertex import Vertex
|
6358
6098
|
from topologicpy.Vector import Vector
|
6359
6099
|
|
6360
|
-
if not
|
6100
|
+
if not Topology.IsInstance(topology, "Topology"):
|
6361
6101
|
print("Topology.Unflatten - Error: the input topology parameter is not a valid topology. Returning None.")
|
6362
6102
|
return None
|
6363
6103
|
if origin == None:
|
@@ -6375,7 +6115,7 @@ class Topology():
|
|
6375
6115
|
|
6376
6116
|
Parameters
|
6377
6117
|
----------
|
6378
|
-
topology :
|
6118
|
+
topology : topologic_core.Topology
|
6379
6119
|
The input topology.
|
6380
6120
|
|
6381
6121
|
Returns
|
@@ -6393,7 +6133,7 @@ class Topology():
|
|
6393
6133
|
|
6394
6134
|
Parameters
|
6395
6135
|
----------
|
6396
|
-
topology :
|
6136
|
+
topology : topologic_core.Topology
|
6397
6137
|
The input topology.
|
6398
6138
|
|
6399
6139
|
Returns
|
@@ -6402,7 +6142,7 @@ class Topology():
|
|
6402
6142
|
The list of edges.
|
6403
6143
|
|
6404
6144
|
"""
|
6405
|
-
if
|
6145
|
+
if Topology.IsInstance(topology, "Edge") or Topology.IsInstance(topology, "Vertex"):
|
6406
6146
|
return []
|
6407
6147
|
return Topology.SubTopologies(topology=topology, subTopologyType="edge")
|
6408
6148
|
|
@@ -6413,7 +6153,7 @@ class Topology():
|
|
6413
6153
|
|
6414
6154
|
Parameters
|
6415
6155
|
----------
|
6416
|
-
topology :
|
6156
|
+
topology : topologic_core.Topology
|
6417
6157
|
The input topology.
|
6418
6158
|
|
6419
6159
|
Returns
|
@@ -6422,7 +6162,7 @@ class Topology():
|
|
6422
6162
|
The list of wires.
|
6423
6163
|
|
6424
6164
|
"""
|
6425
|
-
if
|
6165
|
+
if Topology.IsInstance(topology, "Wire") or Topology.IsInstance(topology, "Edge") or Topology.IsInstance(topology, "Vertex"):
|
6426
6166
|
return []
|
6427
6167
|
return Topology.SubTopologies(topology=topology, subTopologyType="wire")
|
6428
6168
|
|
@@ -6433,7 +6173,7 @@ class Topology():
|
|
6433
6173
|
|
6434
6174
|
Parameters
|
6435
6175
|
----------
|
6436
|
-
topology :
|
6176
|
+
topology : topologic_core.Topology
|
6437
6177
|
The input topology.
|
6438
6178
|
|
6439
6179
|
Returns
|
@@ -6442,7 +6182,7 @@ class Topology():
|
|
6442
6182
|
The list of faces.
|
6443
6183
|
|
6444
6184
|
"""
|
6445
|
-
if
|
6185
|
+
if Topology.IsInstance(topology, "Face") or Topology.IsInstance(topology, "Wire") or Topology.IsInstance(topology, "Edge") or Topology.IsInstance(topology, "Vertex"):
|
6446
6186
|
return []
|
6447
6187
|
return Topology.SubTopologies(topology=topology, subTopologyType="face")
|
6448
6188
|
|
@@ -6453,7 +6193,7 @@ class Topology():
|
|
6453
6193
|
|
6454
6194
|
Parameters
|
6455
6195
|
----------
|
6456
|
-
topology :
|
6196
|
+
topology : topologic_core.Topology
|
6457
6197
|
The input topology.
|
6458
6198
|
|
6459
6199
|
Returns
|
@@ -6462,7 +6202,7 @@ class Topology():
|
|
6462
6202
|
The list of shells.
|
6463
6203
|
|
6464
6204
|
"""
|
6465
|
-
if
|
6205
|
+
if Topology.IsInstance(topology, "Shell") or Topology.IsInstance(topology, "Face") or Topology.IsInstance(topology, "Wire") or Topology.IsInstance(topology, "Edge") or Topology.IsInstance(topology, "Vertex"):
|
6466
6206
|
return []
|
6467
6207
|
return Topology.SubTopologies(topology=topology, subTopologyType="shell")
|
6468
6208
|
|
@@ -6473,7 +6213,7 @@ class Topology():
|
|
6473
6213
|
|
6474
6214
|
Parameters
|
6475
6215
|
----------
|
6476
|
-
topology :
|
6216
|
+
topology : topologic_core.Topology
|
6477
6217
|
The input topology.
|
6478
6218
|
|
6479
6219
|
Returns
|
@@ -6482,7 +6222,7 @@ class Topology():
|
|
6482
6222
|
The list of cells.
|
6483
6223
|
|
6484
6224
|
"""
|
6485
|
-
if
|
6225
|
+
if Topology.IsInstance(topology, "Cell") or Topology.IsInstance(topology, "Shell") or Topology.IsInstance(topology, "Face") or Topology.IsInstance(topology, "Wire") or Topology.IsInstance(topology, "Edge") or Topology.IsInstance(topology, "Vertex"):
|
6486
6226
|
return []
|
6487
6227
|
return Topology.SubTopologies(topology=topology, subTopologyType="cell")
|
6488
6228
|
|
@@ -6493,7 +6233,7 @@ class Topology():
|
|
6493
6233
|
|
6494
6234
|
Parameters
|
6495
6235
|
----------
|
6496
|
-
topology :
|
6236
|
+
topology : topologic_core.Topology
|
6497
6237
|
The input topology.
|
6498
6238
|
|
6499
6239
|
Returns
|
@@ -6502,7 +6242,7 @@ class Topology():
|
|
6502
6242
|
The list of cellcomplexes.
|
6503
6243
|
|
6504
6244
|
"""
|
6505
|
-
if
|
6245
|
+
if Topology.IsInstance(topology, "CellComplex") or Topology.IsInstance(topology, "Cell") or Topology.IsInstance(topology, "Shell") or Topology.IsInstance(topology, "Face") or Topology.IsInstance(topology, "Wire") or Topology.IsInstance(topology, "Edge") or Topology.IsInstance(topology, "Vertex"):
|
6506
6246
|
return []
|
6507
6247
|
return Topology.SubTopologies(topology=topology, subTopologyType="cellcomplex")
|
6508
6248
|
|
@@ -6513,7 +6253,7 @@ class Topology():
|
|
6513
6253
|
|
6514
6254
|
Parameters
|
6515
6255
|
----------
|
6516
|
-
topology :
|
6256
|
+
topology : topologic_core.Topology
|
6517
6257
|
The input topology.
|
6518
6258
|
|
6519
6259
|
Returns
|
@@ -6522,7 +6262,7 @@ class Topology():
|
|
6522
6262
|
The list of clusters.
|
6523
6263
|
|
6524
6264
|
"""
|
6525
|
-
if not
|
6265
|
+
if not Topology.IsInstance(topology, "Cluster"):
|
6526
6266
|
return []
|
6527
6267
|
return Topology.SubTopologies(topology=topology, subTopologyType="cluster")
|
6528
6268
|
|
@@ -6533,7 +6273,7 @@ class Topology():
|
|
6533
6273
|
|
6534
6274
|
Parameters
|
6535
6275
|
----------
|
6536
|
-
topology :
|
6276
|
+
topology : topologic_core.Topology
|
6537
6277
|
The input topology.
|
6538
6278
|
subTopologyType : str , optional
|
6539
6279
|
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".
|
@@ -6544,7 +6284,7 @@ class Topology():
|
|
6544
6284
|
The list of subtopologies.
|
6545
6285
|
|
6546
6286
|
"""
|
6547
|
-
if not
|
6287
|
+
if not Topology.IsInstance(topology, "Topology"):
|
6548
6288
|
print("Topology.SubTopologies - Error: the input topology parameter is not a valid topology. Returning None.")
|
6549
6289
|
return None
|
6550
6290
|
if Topology.TypeAsString(topology).lower() == subTopologyType.lower():
|
@@ -6574,15 +6314,15 @@ class Topology():
|
|
6574
6314
|
|
6575
6315
|
|
6576
6316
|
@staticmethod
|
6577
|
-
def SuperTopologies(topology, hostTopology, topologyType = None):
|
6317
|
+
def SuperTopologies(topology, hostTopology, topologyType: str = None) -> list:
|
6578
6318
|
"""
|
6579
6319
|
Returns the supertopologies connected to the input topology.
|
6580
6320
|
|
6581
6321
|
Parameters
|
6582
6322
|
----------
|
6583
|
-
topology :
|
6323
|
+
topology : topologic_core.Topology
|
6584
6324
|
The input topology.
|
6585
|
-
hostTopology :
|
6325
|
+
hostTopology : topologic_core.Topology
|
6586
6326
|
The host to topology in which to search for ther supertopologies.
|
6587
6327
|
topologyType : str , optional
|
6588
6328
|
The topology type to search for. This can be any of "edge", "wire", "face", "shell", "cell", "cellcomplex", "cluster". It is case insensitive. If set to None, the immediate supertopology type is searched for. The default is None.
|
@@ -6594,35 +6334,35 @@ class Topology():
|
|
6594
6334
|
|
6595
6335
|
"""
|
6596
6336
|
|
6597
|
-
if not
|
6337
|
+
if not Topology.IsInstance(topology, "Topology"):
|
6598
6338
|
print("Topology.SuperTopologies - Error: the input topology parameter is not a valid topology. Returning None.")
|
6599
6339
|
return None
|
6600
|
-
if not
|
6340
|
+
if not Topology.IsInstance(hostTopology, "Topology"):
|
6601
6341
|
print("Topology.SuperTopologies - Error: the input hostTopology parameter is not a valid topology. Returning None.")
|
6602
6342
|
return None
|
6603
6343
|
|
6604
6344
|
superTopologies = []
|
6605
6345
|
|
6606
|
-
if
|
6346
|
+
if topologyType == None:
|
6607
6347
|
typeID = 2*Topology.TypeID(topology)
|
6608
6348
|
else:
|
6609
6349
|
typeID = Topology.TypeID(topologyType)
|
6610
|
-
if
|
6350
|
+
if Topology.Type(topology) >= typeID:
|
6611
6351
|
print("Topology.SuperTopologies - Error: The input topologyType parameter is not a valid type for a super topology of the input topology. Returning None.")
|
6612
6352
|
return None #The user has asked for a topology type lower than the input topology
|
6613
|
-
elif typeID ==
|
6353
|
+
elif typeID == Topology.TypeID("Edge"):
|
6614
6354
|
topology.Edges(hostTopology, superTopologies)
|
6615
|
-
elif typeID ==
|
6355
|
+
elif typeID == Topology.TypeID("Wire"):
|
6616
6356
|
topology.Wires(hostTopology, superTopologies)
|
6617
|
-
elif typeID ==
|
6357
|
+
elif typeID == Topology.TypeID("Face"):
|
6618
6358
|
topology.Faces(hostTopology, superTopologies)
|
6619
|
-
elif typeID ==
|
6359
|
+
elif typeID == Topology.TypeID("Shell"):
|
6620
6360
|
topology.Shells(hostTopology, superTopologies)
|
6621
|
-
elif typeID ==
|
6361
|
+
elif typeID == Topology.TypeID("Cell"):
|
6622
6362
|
topology.Cells(hostTopology, superTopologies)
|
6623
|
-
elif typeID ==
|
6363
|
+
elif typeID == Topology.TypeID("CellComplex"):
|
6624
6364
|
topology.CellComplexes(hostTopology, superTopologies)
|
6625
|
-
elif typeID ==
|
6365
|
+
elif typeID == Topology.TypeID("Cluster"):
|
6626
6366
|
topology.Cluster(hostTopology, superTopologies)
|
6627
6367
|
else:
|
6628
6368
|
print("Topology.SuperTopologies - Error: The input topologyType parameter is not a valid type for a super topology of the input topology. Returning None.")
|
@@ -6663,8 +6403,8 @@ class Topology():
|
|
6663
6403
|
if numWorkers == None:
|
6664
6404
|
import multiprocessing
|
6665
6405
|
numWorkers = multiprocessing.cpu_count()*2
|
6666
|
-
sources = [x for x in sources if
|
6667
|
-
sinks = [x for x in sinks if
|
6406
|
+
sources = [x for x in sources if Topology.IsInstance(x, "Topology")]
|
6407
|
+
sinks = [x for x in sinks if Topology.IsInstance(x, "Topology")]
|
6668
6408
|
so_dicts = [Dictionary.PythonDictionary(Topology.Dictionary(s)) for s in sources]
|
6669
6409
|
if len(sources) < 1:
|
6670
6410
|
print("Topology.TransferDictionaries - Error: The input sources does not contain any valid topologies. Returning None.")
|
@@ -6701,7 +6441,7 @@ class Topology():
|
|
6701
6441
|
|
6702
6442
|
Parameters
|
6703
6443
|
----------
|
6704
|
-
topology :
|
6444
|
+
topology : topologic_core.Topology
|
6705
6445
|
The input topology.
|
6706
6446
|
selectors : list
|
6707
6447
|
The list of input selectors from which to transfer the dictionaries.
|
@@ -6720,13 +6460,12 @@ class Topology():
|
|
6720
6460
|
|
6721
6461
|
Returns
|
6722
6462
|
-------
|
6723
|
-
|
6463
|
+
Topology
|
6724
6464
|
The input topology with the dictionaries transferred to its subtopologies.
|
6725
6465
|
|
6726
6466
|
"""
|
6727
|
-
|
6728
|
-
|
6729
|
-
if not isinstance(topology, topologic.Topology):
|
6467
|
+
|
6468
|
+
if not Topology.IsInstance(topology, "Topology"):
|
6730
6469
|
print("Topology.TransferDictionariesBySelectors - Error: The input topology parameter is not a valid topology. Returning None.")
|
6731
6470
|
return None
|
6732
6471
|
if not isinstance(selectors, list):
|
@@ -6735,7 +6474,7 @@ class Topology():
|
|
6735
6474
|
if numWorkers == None:
|
6736
6475
|
import multiprocessing
|
6737
6476
|
numWorkers = multiprocessing.cpu_count()*2
|
6738
|
-
selectors_tmp = [x for x in selectors if
|
6477
|
+
selectors_tmp = [x for x in selectors if Topology.IsInstance(x, "Vertex")]
|
6739
6478
|
if len(selectors_tmp) < 1:
|
6740
6479
|
print("Topology.TransferDictionariesBySelectors - Error: The input selectors do not contain any valid topologies. Returning None.")
|
6741
6480
|
return None
|
@@ -6745,30 +6484,30 @@ class Topology():
|
|
6745
6484
|
hidimSink = Topology.HighestType(topology)
|
6746
6485
|
if tranVertices == True:
|
6747
6486
|
sinkVertices = []
|
6748
|
-
if
|
6487
|
+
if Topology.Type(topology) == Topology.TypeID("Vertex"):
|
6749
6488
|
sinkVertices.append(topology)
|
6750
|
-
elif hidimSink >=
|
6489
|
+
elif hidimSink >= Topology.TypeID("Vertex"):
|
6751
6490
|
topology.Vertices(None, sinkVertices)
|
6752
6491
|
_ = Topology.TransferDictionaries(selectors, sinkVertices, tolerance=tolerance, numWorkers=numWorkers)
|
6753
6492
|
if tranEdges == True:
|
6754
6493
|
sinkEdges = []
|
6755
|
-
if
|
6494
|
+
if Topology.Type(topology) == Topology.TypeID("Edge"):
|
6756
6495
|
sinkEdges.append(topology)
|
6757
|
-
elif hidimSink >=
|
6496
|
+
elif hidimSink >= Topology.TypeID("Edge"):
|
6758
6497
|
topology.Edges(None, sinkEdges)
|
6759
6498
|
_ = Topology.TransferDictionaries(selectors, sinkEdges, tolerance=tolerance, numWorkers=numWorkers)
|
6760
6499
|
if tranFaces == True:
|
6761
6500
|
sinkFaces = []
|
6762
|
-
if
|
6501
|
+
if Topology.Type(topology) == Topology.TypeID("Face"):
|
6763
6502
|
sinkFaces.append(topology)
|
6764
|
-
elif hidimSink >=
|
6503
|
+
elif hidimSink >= Topology.TypeID("Face"):
|
6765
6504
|
topology.Faces(None, sinkFaces)
|
6766
6505
|
_ = Topology.TransferDictionaries(selectors, sinkFaces, tolerance=tolerance, numWorkers=numWorkers)
|
6767
6506
|
if tranCells == True:
|
6768
6507
|
sinkCells = []
|
6769
|
-
if
|
6508
|
+
if Topology.Type(topology) == Topology.TypeID("Cell"):
|
6770
6509
|
sinkCells.append(topology)
|
6771
|
-
elif hidimSink >=
|
6510
|
+
elif hidimSink >= Topology.TypeID("Cell"):
|
6772
6511
|
topology.Cells(None, sinkCells)
|
6773
6512
|
_ = Topology.TransferDictionaries(selectors, sinkCells, tolerance=tolerance, numWorkers=numWorkers)
|
6774
6513
|
return topology
|
@@ -6781,14 +6520,14 @@ class Topology():
|
|
6781
6520
|
|
6782
6521
|
Parameters
|
6783
6522
|
----------
|
6784
|
-
topology :
|
6523
|
+
topology : topologic_core.Topology
|
6785
6524
|
The input topology.
|
6786
6525
|
matrix : list
|
6787
6526
|
The input 4x4 transformation matrix.
|
6788
6527
|
|
6789
6528
|
Returns
|
6790
6529
|
-------
|
6791
|
-
|
6530
|
+
topologic_core.Topology
|
6792
6531
|
The transformed topology.
|
6793
6532
|
|
6794
6533
|
"""
|
@@ -6805,9 +6544,7 @@ class Topology():
|
|
6805
6544
|
kRotation32 = 0.0
|
6806
6545
|
kRotation33 = 1.0
|
6807
6546
|
|
6808
|
-
|
6809
|
-
kTranslationY = matrix[1][3]
|
6810
|
-
kTranslationZ = matrix[2][3]
|
6547
|
+
|
6811
6548
|
kRotation11 = matrix[0][0]
|
6812
6549
|
kRotation12 = matrix[0][1]
|
6813
6550
|
kRotation13 = matrix[0][2]
|
@@ -6817,6 +6554,9 @@ class Topology():
|
|
6817
6554
|
kRotation31 = matrix[2][0]
|
6818
6555
|
kRotation32 = matrix[2][1]
|
6819
6556
|
kRotation33 = matrix[2][2]
|
6557
|
+
kTranslationX = matrix[3][0]
|
6558
|
+
kTranslationY = matrix[3][1]
|
6559
|
+
kTranslationZ = matrix[3][2]
|
6820
6560
|
|
6821
6561
|
return topologic.TopologyUtility.Transform(topology, kTranslationX, kTranslationY, kTranslationZ, kRotation11, kRotation12, kRotation13, kRotation21, kRotation22, kRotation23, kRotation31, kRotation32, kRotation33)
|
6822
6562
|
|
@@ -6827,7 +6567,7 @@ class Topology():
|
|
6827
6567
|
|
6828
6568
|
Parameters
|
6829
6569
|
----------
|
6830
|
-
topology :
|
6570
|
+
topology : topologic_core.topology
|
6831
6571
|
The input topology.
|
6832
6572
|
x : float , optional
|
6833
6573
|
The x translation value. The default is 0.
|
@@ -6838,11 +6578,11 @@ class Topology():
|
|
6838
6578
|
|
6839
6579
|
Returns
|
6840
6580
|
-------
|
6841
|
-
|
6581
|
+
topologic_core.Topology
|
6842
6582
|
The translated topology.
|
6843
6583
|
|
6844
6584
|
"""
|
6845
|
-
if not
|
6585
|
+
if not Topology.IsInstance(topology, "Topology"):
|
6846
6586
|
print("Topology.Translate - Error: The input topology parameter is not a valid topology. Returning None.")
|
6847
6587
|
return None
|
6848
6588
|
try:
|
@@ -6857,7 +6597,7 @@ class Topology():
|
|
6857
6597
|
|
6858
6598
|
Parameters
|
6859
6599
|
----------
|
6860
|
-
topology :
|
6600
|
+
topology : topologic_core.topology
|
6861
6601
|
The input topology.
|
6862
6602
|
direction : list , optional
|
6863
6603
|
The direction vector in which the topology should be moved. The default is [0, 0, 0]
|
@@ -6866,12 +6606,12 @@ class Topology():
|
|
6866
6606
|
|
6867
6607
|
Returns
|
6868
6608
|
-------
|
6869
|
-
|
6609
|
+
topologic_core.Topology
|
6870
6610
|
The translated topology.
|
6871
6611
|
|
6872
6612
|
"""
|
6873
6613
|
from topologicpy.Vector import Vector
|
6874
|
-
if not
|
6614
|
+
if not Topology.IsInstance(topology, "Topology"):
|
6875
6615
|
print("Topology.TranslateByDirectionDistance - Error: The input topology parameter is not a valid topology. Returning None.")
|
6876
6616
|
return None
|
6877
6617
|
v = Vector.SetMagnitude(direction, distance)
|
@@ -6885,7 +6625,7 @@ class Topology():
|
|
6885
6625
|
|
6886
6626
|
Parameters
|
6887
6627
|
----------
|
6888
|
-
topology :
|
6628
|
+
topology : topologic_core.Topology
|
6889
6629
|
The input topologgy.
|
6890
6630
|
transferDictionaries : bool , optional
|
6891
6631
|
If set to True, the dictionaries of the faces in the input topology will be transferred to the created triangular faces. The default is False.
|
@@ -6909,7 +6649,7 @@ class Topology():
|
|
6909
6649
|
|
6910
6650
|
Returns
|
6911
6651
|
-------
|
6912
|
-
|
6652
|
+
topologic_core.Topology
|
6913
6653
|
The triangulated topology.
|
6914
6654
|
|
6915
6655
|
"""
|
@@ -6919,13 +6659,13 @@ class Topology():
|
|
6919
6659
|
from topologicpy.CellComplex import CellComplex
|
6920
6660
|
from topologicpy.Cluster import Cluster
|
6921
6661
|
|
6922
|
-
if not
|
6662
|
+
if not Topology.IsInstance(topology, "Topology"):
|
6923
6663
|
print("Topology.Triangulate - Error: The input parameter is not a valid topology. Returning None.")
|
6924
6664
|
return None
|
6925
|
-
t =
|
6926
|
-
if (t ==
|
6665
|
+
t = Topology.Type(topology)
|
6666
|
+
if (t == Topology.TypeID("Vertex")) or (t == Topology.TypeID("Edge")) or (t == Topology.TypeID("Wire")):
|
6927
6667
|
return topology
|
6928
|
-
elif t ==
|
6668
|
+
elif t == Topology.TypeID("Cluster"):
|
6929
6669
|
temp_topologies = []
|
6930
6670
|
cellComplexes = Topology.SubTopologies(topology, subTopologyType="cellcomplex") or []
|
6931
6671
|
for cc in cellComplexes:
|
@@ -6956,15 +6696,15 @@ class Topology():
|
|
6956
6696
|
if transferDictionaries:
|
6957
6697
|
selectors.append(Topology.SetDictionary(Face.Centroid(triFace), Topology.Dictionary(aFace)))
|
6958
6698
|
faceTriangles.append(triFace)
|
6959
|
-
if t ==
|
6699
|
+
if t == Topology.TypeID("Face") or t == Topology.TypeID("Shell"): # Face or Shell
|
6960
6700
|
return_topology = Shell.ByFaces(faceTriangles, tolerance=tolerance)
|
6961
6701
|
if transferDictionaries and not return_topology == None:
|
6962
6702
|
return_topology = Topology.TransferDictionariesBySelectors(return_topology, selectors, tranFaces=True, tolerance=tolerance)
|
6963
|
-
elif t ==
|
6703
|
+
elif t == Topology.TypeID("Cell"): # Cell
|
6964
6704
|
return_topology = Cell.ByFaces(faceTriangles, tolerance=tolerance)
|
6965
6705
|
if transferDictionaries and not return_topology == None:
|
6966
6706
|
return_topology = Topology.TransferDictionariesBySelectors(return_topology, selectors, tranFaces=True, tolerance=tolerance)
|
6967
|
-
elif t ==
|
6707
|
+
elif t == Topology.TypeID("CellComplex"): #CellComplex
|
6968
6708
|
return_topology = CellComplex.ByFaces(faceTriangles, tolerance=tolerance)
|
6969
6709
|
if transferDictionaries and not return_topology == None:
|
6970
6710
|
return_topology = Topology.TransferDictionariesBySelectors(return_topology, selectors, tranFaces=True, tolerance=tolerance)
|
@@ -6984,7 +6724,7 @@ class Topology():
|
|
6984
6724
|
|
6985
6725
|
Parameters
|
6986
6726
|
----------
|
6987
|
-
topology :
|
6727
|
+
topology : topologic_core.Topology
|
6988
6728
|
The input topology.
|
6989
6729
|
|
6990
6730
|
Returns
|
@@ -6993,9 +6733,9 @@ class Topology():
|
|
6993
6733
|
The type of the input topology.
|
6994
6734
|
|
6995
6735
|
"""
|
6996
|
-
if not
|
6997
|
-
print("Topology.Type - Error: The input topology parameter is not a valid topology. Returning None.")
|
6998
|
-
return None
|
6736
|
+
#if not Topology.IsInstance(topology, "Topology"):
|
6737
|
+
#print("Topology.Type - Error: The input topology parameter is not a valid topology. Returning None.")
|
6738
|
+
#return None
|
6999
6739
|
return topology.Type()
|
7000
6740
|
|
7001
6741
|
@staticmethod
|
@@ -7005,7 +6745,7 @@ class Topology():
|
|
7005
6745
|
|
7006
6746
|
Parameters
|
7007
6747
|
----------
|
7008
|
-
topology :
|
6748
|
+
topology : topologic_core.Topology
|
7009
6749
|
The input topology.
|
7010
6750
|
|
7011
6751
|
Returns
|
@@ -7014,20 +6754,35 @@ class Topology():
|
|
7014
6754
|
The type of the topology as a string.
|
7015
6755
|
|
7016
6756
|
"""
|
7017
|
-
if not
|
6757
|
+
if not Topology.IsInstance(topology, "Topology"):
|
7018
6758
|
print("Topology.TypeAsString - Error: The input topology parameter is not a valid topology. Returning None.")
|
7019
6759
|
return None
|
7020
6760
|
return topology.GetTypeAsString()
|
7021
6761
|
|
7022
6762
|
@staticmethod
|
7023
|
-
def TypeID(
|
6763
|
+
def TypeID(name : str = None) -> int:
|
7024
6764
|
"""
|
7025
|
-
Returns the type id of the input
|
6765
|
+
Returns the type id of the input name string.
|
7026
6766
|
|
7027
6767
|
Parameters
|
7028
6768
|
----------
|
7029
|
-
|
7030
|
-
The input
|
6769
|
+
name : str , optional
|
6770
|
+
The input class name string. This could be one of:
|
6771
|
+
"vertex",
|
6772
|
+
"edge",
|
6773
|
+
"wire",
|
6774
|
+
"face",
|
6775
|
+
"shell",
|
6776
|
+
"cell",
|
6777
|
+
"cellcomplex",
|
6778
|
+
"cluster",
|
6779
|
+
"aperture",
|
6780
|
+
"context",
|
6781
|
+
"dictionary",
|
6782
|
+
"graph",
|
6783
|
+
"topology"
|
6784
|
+
|
6785
|
+
It is case insensitive. The default is None.
|
7031
6786
|
|
7032
6787
|
Returns
|
7033
6788
|
-------
|
@@ -7036,28 +6791,41 @@ class Topology():
|
|
7036
6791
|
|
7037
6792
|
"""
|
7038
6793
|
|
7039
|
-
if not isinstance(
|
6794
|
+
if not isinstance(name, str):
|
7040
6795
|
print("Topology.TypeID - Error: The input topologyType parameter is not a valid string. Returning None.")
|
7041
6796
|
return None
|
7042
|
-
|
7043
|
-
if not
|
7044
|
-
|
6797
|
+
name = name.lower()
|
6798
|
+
if not name in ["vertex", "edge", "wire",
|
6799
|
+
"face", "shell", "cell",
|
6800
|
+
"cellcomplex", "cluster", "aperture",
|
6801
|
+
"context", "dictionary", "graph", "topology"]:
|
6802
|
+
print("Topology.TypeID - Error: The input name parameter is not a recognized string. Returning None.")
|
7045
6803
|
return None
|
7046
6804
|
typeID = None
|
7047
|
-
if
|
7048
|
-
typeID =
|
7049
|
-
elif
|
7050
|
-
typeID =
|
7051
|
-
elif
|
7052
|
-
typeID =
|
7053
|
-
elif
|
7054
|
-
typeID =
|
7055
|
-
elif
|
7056
|
-
typeID =
|
7057
|
-
elif
|
7058
|
-
typeID =
|
7059
|
-
elif
|
7060
|
-
typeID =
|
7061
|
-
elif
|
7062
|
-
typeID =
|
6805
|
+
if name == "vertex":
|
6806
|
+
typeID = 1
|
6807
|
+
elif name == "edge":
|
6808
|
+
typeID = 2
|
6809
|
+
elif name == "wire":
|
6810
|
+
typeID = 4
|
6811
|
+
elif name == "face":
|
6812
|
+
typeID = 8
|
6813
|
+
elif name == "shell":
|
6814
|
+
typeID = 16
|
6815
|
+
elif name == "cell":
|
6816
|
+
typeID = 32
|
6817
|
+
elif name == "cellComplex":
|
6818
|
+
typeID = 64
|
6819
|
+
elif name == "cluster":
|
6820
|
+
typeID = 128
|
6821
|
+
elif name == "aperture":
|
6822
|
+
typeID = 256
|
6823
|
+
elif name == "context":
|
6824
|
+
typeID = 512
|
6825
|
+
elif name == "dictionary":
|
6826
|
+
typeID = 1024
|
6827
|
+
elif name == "graph":
|
6828
|
+
typeID = 2048
|
6829
|
+
elif name == "topology":
|
6830
|
+
typeID = 4096
|
7063
6831
|
return typeID
|