topologicpy 0.6.3__py3-none-any.whl → 0.7.2__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/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 isinstance(source, topologic.Vertex):
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 : topologic.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
- topologic.Topology
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 isinstance(topology, topologic.Topology):
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 isinstance(x , topologic.Topology)]
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 : topologic.Topology
276
+ topology : topologic_core.Topology
278
277
  The input topology.
279
- conntents : list or topologic.Topology
280
- The input list of contents (of type topologic.Topology). A single topology is also accepted as input.
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
- topologic.Topology
287
+ topologic_core.Topology
289
288
  The input topology with the contents added to it.
290
289
 
291
290
  """
292
- if not isinstance(topology, topologic.Topology):
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 isinstance(x, topologic.Topology)]
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() == "vertex":
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 : topologic.topology
322
+ topology : topologic_core.Topology
336
323
  The input topology.
337
- dictionary : topologic.Dictionary
324
+ dictionary : topologic_core.Dictionary
338
325
  The input dictionary.
339
326
 
340
327
  Returns
341
328
  -------
342
- topologic.Topology
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 isinstance(topology, topologic.Topology):
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 isinstance(dictionary, topologic.Dictionary):
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 : topologic.Topology
357
+ topology : topologic_core.Topology
371
358
  The input topology.
372
- hostTopology : topologic.Topology
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 isinstance(topology, topologic.Topology):
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 isinstance(hostTopology, topologic.Topology):
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 isinstance(topology, topologic.Vertex):
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 isinstance(topology, topologic.Edge):
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 isinstance(topology, topologic.Wire):
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 isinstance(topology, topologic.Face):
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 isinstance(topology, topologic.Shell):
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 isinstance(topology, topologic.Cell):
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 isinstance(topology, topologic.CellComplex):
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 isinstance(topology, topologic.Cluster):
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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.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 isinstance(topology, topologic.Topology):
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
- if isinstance(topologyA, topologic.Vertex):
896
- # Vertex:
897
- if isinstance(topologyB, topologic.Vertex):
898
- if Vertex.Distance(topologyA, topologyB) < tolerance:
899
- return topologyA
900
- else:
901
- return None
902
- # Edge/Wire/Face/Shell/Cell/CellComplex:
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
- return None
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
- return None
915
- # Edge:
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 : topologic.Topology
980
+ topologyA : topologic_core.Topology
1235
981
  The first input topology.
1236
- topologyB : topologic.Topology
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
- topologic.Topology
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 isinstance(topologyB, topologic.Topology):
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
- try:
1273
- if operation.lower() == "union":
1274
- topologyC = topologyA.Union(topologyB, False)
1275
- elif operation.lower() == "difference":
1276
- topologyC = topologyA.Difference(topologyB, False)
1277
- elif operation.lower() == "intersect": #Intersect in Topologic (Core) is faulty. This is a workaround.
1278
- #topologyC = topologyA.Intersect(topologyB, False)
1279
- topologyC = Topology.Intersect(topologyA, topologyB)
1280
- elif operation.lower() == "symdif":
1281
- topologyC = topologyA.XOR(topologyB, False)
1282
- elif operation.lower() == "merge":
1283
- topologyC = topologyA.Merge(topologyB, False)
1284
- elif operation.lower() == "slice":
1285
- topologyC = topologyA.Slice(topologyB, False)
1286
- elif operation.lower() == "impose":
1287
- topologyC = topologyA.Impose(topologyB, False)
1288
- elif operation.lower() == "imprint":
1289
- topologyC = topologyA.Imprint(topologyB, False)
1290
- else:
1291
- print("Topology.Boolean - Error: the boolean operation failed. Returning None.")
1292
- return None
1293
- except:
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 topologyA.Type() == topologic.Vertex.Type():
1053
+ if Topology.Type(topologyA) == Topology.TypeID("Vertex"):
1310
1054
  sourceVertices += [topologyA]
1311
- elif hidimA >= topologic.Vertex.Type():
1055
+ elif hidimA >= Topology.TypeID("Vertex"):
1312
1056
  sourceVertices += Topology.Vertices(topologyA)
1313
- if topologyB.Type() == topologic.Vertex.Type():
1057
+ if Topology.Type(topologyB) == Topology.TypeID("Vertex"):
1314
1058
  sourceVertices += [topologyB]
1315
- elif hidimB >= topologic.Vertex.Type():
1059
+ elif hidimB >= Topology.TypeID("Vertex"):
1316
1060
  sourceVertices += Topology.Vertices(topologyB)
1317
- if topologyC.Type() == topologic.Vertex.Type():
1061
+ if Topology.Type(topologyC) == Topology.TypeID("Vertex"):
1318
1062
  sinkVertices = [topologyC]
1319
- elif hidimC >= topologic.Vertex.Type():
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 topologyA.Type() == topologic.Edge.Type():
1068
+ if Topology.Type(topologyA) == Topology.TypeID("Edge"):
1325
1069
  sourceEdges += [topologyA]
1326
- elif hidimA >= topologic.Edge.Type():
1070
+ elif hidimA >= Topology.TypeID("Edge"):
1327
1071
  sourceEdges += Topology.Edges(topologyA)
1328
- if topologyB.Type() == topologic.Edge.Type():
1072
+ if Topology.Type(topologyB) == Topology.TypeID("Edge"):
1329
1073
  sourceEdges += [topologyB]
1330
- elif hidimB >= topologic.Edge.Type():
1074
+ elif hidimB >= Topology.TypeID("Edge"):
1331
1075
  sourceEdges += Topology.Edges(topologyB)
1332
- if topologyC.Type() == topologic.Edge.Type():
1076
+ if Topology.Type(topologyC) == Topology.TypeID("Edge"):
1333
1077
  sinkEdges = [topologyC]
1334
- elif hidimC >= topologic.Edge.Type():
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 topologyA.Type() == topologic.Face.Type():
1083
+ if Topology.Type(topologyA) == Topology.TypeID("Face"):
1340
1084
  sourceFaces += [topologyA]
1341
- elif hidimA >= topologic.Face.Type():
1085
+ elif hidimA >= Topology.TypeID("Face"):
1342
1086
  sourceFaces += Topology.Faces(topologyA)
1343
- if topologyB.Type() == topologic.Face.Type():
1087
+ if Topology.Type(topologyB) == Topology.TypeID("Face"):
1344
1088
  sourceFaces += [topologyB]
1345
- elif hidimB >= topologic.Face.Type():
1089
+ elif hidimB >= Topology.TypeID("Face"):
1346
1090
  sourceFaces += Topology.Faces(topologyB)
1347
- if topologyC.Type() == topologic.Face.Type():
1091
+ if Topology.Type(topologyC) == Topology.TypeID("Face"):
1348
1092
  sinkFaces += [topologyC]
1349
- elif hidimC >= topologic.Face.Type():
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 topologyA.Type() == topologic.Cell.Type():
1098
+ if Topology.Type(topologyA) == Topology.TypeID("Cell"):
1355
1099
  sourceCells += [topologyA]
1356
- elif hidimA >= topologic.Cell.Type():
1100
+ elif hidimA >= Topology.TypeID("Cell"):
1357
1101
  sourceCells += Topology.Cells(topologyA)
1358
- if topologyB.Type() == topologic.Cell.Type():
1102
+ if Topology.Type(topologyB) == Topology.TypeID("Cell"):
1359
1103
  sourceCells += [topologyB]
1360
- elif hidimB >= topologic.Cell.Type():
1104
+ elif hidimB >= Topology.TypeID("Cell"):
1361
1105
  sourceCells += Topology.Cells(topologyB)
1362
- if topologyC.Type() == topologic.Cell.Type():
1106
+ if Topology.Type(topologyC) == Topology.TypeID("Cell"):
1363
1107
  sinkCells = [topologyC]
1364
- elif hidimC >= topologic.Cell.Type():
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 : topologic.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
- topologic.Cell or topologic.Face
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 isinstance(topology, topologic.Topology):
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 = topologic.Vertex.ByCoordinates(minX, minY, minZ)
1516
- vb2 = topologic.Vertex.ByCoordinates(maxX, minY, minZ)
1517
- vb3 = topologic.Vertex.ByCoordinates(maxX, maxY, minZ)
1518
- vb4 = topologic.Vertex.ByCoordinates(minX, maxY, minZ)
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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.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 isinstance(output, topologic.Shell):
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 isinstance(output, topologic.Wire):
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 isinstance(topFace, topologic.Face):
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
- topologic.Topology
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
- topologic.Topology
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 isinstance(external_boundary, topologic.Wire):
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 isinstance(temp_boundary, topologic.Wire):
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 isinstance(ib, topologic.Wire):
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 isinstance(f, topologic.Face):
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 isinstance(s, topologic.Shell):
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 : topologic.TopoDS_Shape
2348
+ occtShape : topologic_core.TopoDS_Shape
2602
2349
  The inoput OCCT Shape.
2603
2350
 
2604
2351
  Returns
2605
2352
  -------
2606
- topologic.Topology
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
- topologic.Topology
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 (topologic.Cluster)
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 (topologic.Cluster).
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 (topologic.Cluster)
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 (topologic.Cluster).
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 : topologic.Topology
2527
+ topology : topologic_core.Topology
2781
2528
  The input topology.
2782
2529
 
2783
2530
  Returns
2784
2531
  -------
2785
- topologic.Vertex
2532
+ topologic_core.Vertex
2786
2533
  The center of mass of the input topology.
2787
2534
 
2788
2535
  """
2789
- if not isinstance(topology, topologic.Topology):
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 : topologic.Topology
2548
+ topology : topologic_core.Topology
2802
2549
  The input topology.
2803
2550
 
2804
2551
  Returns
2805
2552
  -------
2806
- topologic.Vertex
2553
+ topologic_core.Vertex
2807
2554
  The centroid of the input topology.
2808
2555
 
2809
2556
  """
2810
- if not isinstance(topology, topologic.Topology):
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 isinstance(topology, topologic.Aperture):
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 : topologic.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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.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
- topologic.Topology
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 returnTopology.Type() == 16:
2852
+ if Topology.Type(returnTopology) == Topology.TypeID("Shell"):
3104
2853
  return Shell.ExternalBoundary(returnTopology, tolerance=tolerance)
3105
- if not isinstance(topology, topologic.Topology):
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 : topologic.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
- topologic.Topology
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 isinstance(topology, topologic.Topology):
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 : topologic.Topology
2902
+ topology : topologic_core.Topology
3154
2903
  The input topology.
3155
2904
 
3156
2905
  Returns
3157
2906
  -------
3158
- topologic.Dictionary
2907
+ topologic_core.Dictionary
3159
2908
  The dictionary of the input topology.
3160
2909
 
3161
2910
  """
3162
- if not isinstance(topology, topologic.Topology):
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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.Topology
2944
+ topologyA : topologic_core.Topology
3196
2945
  The input topology to be divided.
3197
- topologyB : topologic.Topology
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
- topologic.Topology
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 isinstance(topologyA, topologic.Topology):
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 isinstance(topologyB, topologic.Topology):
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 : topologic.Topology
3033
+ topology : topologic_core.Topology
3285
3034
  The input topology.
3286
- origin : topologic.Vertex , optional
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
- topologic.Cluster
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 isinstance(topology, topologic.Vertex):
3074
+ if Topology.IsInstance(topology, "Vertex"):
3326
3075
  typeFilter = "self"
3327
- elif isinstance(topology, topologic.Edge):
3076
+ elif Topology.IsInstance(topology, "Edge"):
3328
3077
  typeFilter = "vertex"
3329
- elif isinstance(topology, topologic.Wire):
3078
+ elif Topology.IsInstance(topology, "Wire"):
3330
3079
  typeFilter = "edge"
3331
- elif isinstance(topology, topologic.Face):
3080
+ elif Topology.IsInstance(topology, "Face"):
3332
3081
  typeFilter = "edge"
3333
- elif isinstance(topology, topologic.Shell):
3082
+ elif Topology.IsInstance(topology, "Shell"):
3334
3083
  typeFilter = "face"
3335
- elif isinstance(topology, topologic.Cell):
3084
+ elif Topology.IsInstance(topology, "Cell"):
3336
3085
  typeFilter = "face"
3337
- elif isinstance(topology, topologic.CellComplex):
3086
+ elif Topology.IsInstance(topology, "CellComplex"):
3338
3087
  typeFilter = "cell"
3339
- elif isinstance(topology, topologic.Cluster):
3088
+ elif Topology.IsInstance(topology, "Cluster"):
3340
3089
  typeFilter = processClusterTypeFilter(topology)
3341
- elif isinstance(topology, topologic.Graph):
3090
+ elif Topology.IsInstance(topology, "Graph"):
3342
3091
  typeFilter = "edge"
3343
3092
  return typeFilter
3344
3093
 
3345
- if not isinstance(topology, topologic.Topology):
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 isinstance(origin, topologic.Vertex):
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 isinstance(topology, topologic.Topology):
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 isinstance(topology, topologic.Graph):
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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.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
- topologic.Topology
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 topologic.Topology
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 isinstance(topology, topologic.Vertex):
3582
+ if Topology.IsInstance(topology, "Vertex"):
3833
3583
  d = getVertex(topology, uuidKey=uuidKey)
3834
- elif isinstance(topology, topologic.Edge):
3584
+ elif Topology.IsInstance(topology, "Edge"):
3835
3585
  d = getEdge(topology, uuidKey=uuidKey)
3836
- elif isinstance(topology, topologic.Wire):
3586
+ elif Topology.IsInstance(topology, "Wire"):
3837
3587
  d = getWire(topology, uuidKey=uuidKey)
3838
- elif isinstance(topology, topologic.Face):
3588
+ elif Topology.IsInstance(topology, "Face"):
3839
3589
  d = getFace(topology, uuidKey=uuidKey)
3840
- elif isinstance(topology, topologic.Shell):
3590
+ elif Topology.IsInstance(topology, "Shell"):
3841
3591
  d = getShell(topology, uuidKey=uuidKey)
3842
- elif isinstance(topology, topologic.Cell):
3592
+ elif Topology.IsInstance(topology, "Cell"):
3843
3593
  d = getCell(topology, uuidKey=uuidKey)
3844
- elif isinstance(topology, topologic.CellComplex):
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 isinstance(topology, topologic.Vertex):
3682
+ if Topology.IsInstance(topology, "Vertex"):
3933
3683
  d = getVertex(topology, uuidKey=uuidKey)
3934
- elif isinstance(topology, topologic.Edge):
3684
+ elif Topology.IsInstance(topology, "Edge"):
3935
3685
  d = getEdge(topology, uuidKey=uuidKey)
3936
- elif isinstance(topology, topologic.Wire):
3686
+ elif Topology.IsInstance(topology, "Wire"):
3937
3687
  d = getWire(topology, uuidKey=uuidKey)
3938
- elif isinstance(topology, topologic.Face):
3688
+ elif Topology.IsInstance(topology, "Face"):
3939
3689
  d = getFace(topology, uuidKey=uuidKey)
3940
- elif isinstance(topology, topologic.Shell):
3690
+ elif Topology.IsInstance(topology, "Shell"):
3941
3691
  d = getShell(topology, uuidKey=uuidKey)
3942
- elif isinstance(topology, topologic.Cell):
3692
+ elif Topology.IsInstance(topology, "Cell"):
3943
3693
  d = getCell(topology, uuidKey=uuidKey)
3944
- elif isinstance(topology, topologic.CellComplex):
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 isinstance(x, topologic.Topology)]
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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.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 isinstance(topology, topologic.Topology):
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 : topologic.Topology
3936
+ topology : topologic_core.Topology
4187
3937
  The input topology.
4188
- origin : topologic.Vertex , optional
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
- topologic.Topology
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 isinstance(topology, topologic.Topology):
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 : topologic.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.
@@ -4229,6 +3979,8 @@ class Topology():
4229
3979
 
4230
3980
  """
4231
3981
  from topologicpy.Vertex import Vertex
3982
+ from topologicpy.Face import Face
3983
+ from topologicpy.Vector import Vector
4232
3984
 
4233
3985
  def getSubTopologies(topology, subTopologyClass):
4234
3986
  topologies = []
@@ -4265,7 +4017,7 @@ class Topology():
4265
4017
  if topology == None:
4266
4018
  return [None, None, None]
4267
4019
  topVerts = []
4268
- if (topology.Type() == 1): #input is a vertex, just add it and process it
4020
+ if Topology.Type(topology) == Topology.TypeID("Vertex"): #input is a vertex, just add it and process it
4269
4021
  topVerts.append(topology)
4270
4022
  else:
4271
4023
  _ = topology.Vertices(None, topVerts)
@@ -4275,9 +4027,9 @@ class Topology():
4275
4027
  except:
4276
4028
  vertices.append(Vertex.Coordinates(aVertex, mantissa=mantissa)) # Vertex not in list, add it.
4277
4029
  topEdges = []
4278
- if (topology.Type() == 2): #Input is an Edge, just add it and process it
4030
+ if (Topology.Type(topology) == Topology.TypeID("Edge")): #Input is an Edge, just add it and process it
4279
4031
  topEdges.append(topology)
4280
- elif (topology.Type() > 2):
4032
+ elif (Topology.Type(topology) > Topology.TypeID("Vertex")):
4281
4033
  _ = topology.Edges(None, topEdges)
4282
4034
  for anEdge in topEdges:
4283
4035
  e = []
@@ -4298,11 +4050,12 @@ class Topology():
4298
4050
  if ([e[0], e[1]] not in edges) and ([e[1], e[0]] not in edges):
4299
4051
  edges.append(e)
4300
4052
  topFaces = []
4301
- if (topology.Type() == 8): # Input is a Face, just add it and process it
4053
+ if (Topology.Type(topology) == Topology.TypeID("Face")): # Input is a Face, just add it and process it
4302
4054
  topFaces.append(topology)
4303
- elif (topology.Type() > 8):
4055
+ elif (Topology.Type(topology) > Topology.TypeID("Face")):
4304
4056
  _ = topology.Faces(None, topFaces)
4305
4057
  for aFace in topFaces:
4058
+ f_dir = Face.Normal(aFace)
4306
4059
  ib = []
4307
4060
  _ = aFace.InternalBoundaries(ib)
4308
4061
  if(len(ib) > 0):
@@ -4310,6 +4063,10 @@ class Topology():
4310
4063
  for aTriFace in triFaces:
4311
4064
  wire = aTriFace.ExternalBoundary()
4312
4065
  faceVertices = getSubTopologies(wire, topologic.Vertex)
4066
+ temp_face = Face.ByWire(wire)
4067
+ temp_dir = Face.Normal(temp_face)
4068
+ if Vector.IsAntiParallel(f_dir, temp_dir):
4069
+ faceVertices.reverse()
4313
4070
  f = []
4314
4071
  for aVertex in faceVertices:
4315
4072
  try:
@@ -4323,6 +4080,10 @@ class Topology():
4323
4080
  wire = aFace.ExternalBoundary()
4324
4081
  #wire = topologic.WireUtility.RemoveCollinearEdges(wire, 0.1) #This is an angle Tolerance
4325
4082
  faceVertices = getSubTopologies(wire, topologic.Vertex)
4083
+ temp_face = Face.ByWire(wire)
4084
+ temp_dir = Face.Normal(temp_face)
4085
+ if Vector.IsAntiParallel(f_dir, temp_dir):
4086
+ faceVertices.reverse()
4326
4087
  f = []
4327
4088
  for aVertex in faceVertices:
4328
4089
  try:
@@ -4341,7 +4102,7 @@ class Topology():
4341
4102
 
4342
4103
  Parameters
4343
4104
  ----------
4344
- topology : topologic.Topology
4105
+ topology : topologic_core.Topology
4345
4106
  The input topology.
4346
4107
 
4347
4108
  Returns
@@ -4351,10 +4112,11 @@ class Topology():
4351
4112
 
4352
4113
  """
4353
4114
  from topologicpy.Cluster import Cluster
4354
- if (topology.Type() == topologic.Cluster.Type()):
4115
+
4116
+ if (Topology.Type(topology) == Topology.TypeID("Cluster")):
4355
4117
  return Cluster.HighestType(topology)
4356
4118
  else:
4357
- return(topology.Type())
4119
+ return Topology.Type(topology)
4358
4120
 
4359
4121
  @staticmethod
4360
4122
  def InternalVertex(topology, tolerance: float = 0.0001):
@@ -4363,14 +4125,14 @@ class Topology():
4363
4125
 
4364
4126
  Parameters
4365
4127
  ----------
4366
- topology : topologic.Topology
4128
+ topology : topologic_core.Topology
4367
4129
  The input topology.
4368
4130
  tolerance : float , ptional
4369
4131
  The desired tolerance. The default is 0.0001.
4370
4132
 
4371
4133
  Returns
4372
4134
  -------
4373
- topologic.Vertex
4135
+ topologic_core.Vertex
4374
4136
  A vertex guaranteed to be inside the input topology.
4375
4137
 
4376
4138
  """
@@ -4381,22 +4143,22 @@ class Topology():
4381
4143
  from topologicpy.CellComplex import CellComplex
4382
4144
  from topologicpy.Aperture import Aperture
4383
4145
 
4384
- if not isinstance(topology, topologic.Topology):
4146
+ if not Topology.IsInstance(topology, "Topology"):
4385
4147
  print("Topology.InternalVertex - Error: the input topology parameter is not a valid topology. Returning None.")
4386
4148
  return None
4387
4149
  vst = None
4388
4150
  top = Topology.Copy(topology)
4389
- if isinstance(top, topologic.CellComplex): #CellComplex
4151
+ if Topology.IsInstance(top, "CellComplex"): #CellComplex
4390
4152
  tempCell = Topology.Cells(top)[0]
4391
4153
  vst = Cell.InternalVertex(tempCell, tolerance=tolerance)
4392
- elif isinstance(top, topologic.Cell): #Cell
4154
+ elif Topology.IsInstance(top, "Cell"): #Cell
4393
4155
  vst = Cell.InternalVertex(top, tolerance=tolerance)
4394
- elif isinstance(top, topologic.Shell): #Shell
4156
+ elif Topology.IsInstance(top, "Shell"): #Shell
4395
4157
  tempFace = Topology.Faces(top)[0]
4396
4158
  vst = Face.InternalVertex(tempFace, tolerance=tolerance)
4397
- elif isinstance(top, topologic.Face): #Face
4159
+ elif Topology.IsInstance(top, "Face"): #Face
4398
4160
  vst = Face.InternalVertex(top, tolerance=tolerance)
4399
- elif isinstance(top, topologic.Wire): #Wire
4161
+ elif Topology.IsInstance(top, "Wire"): #Wire
4400
4162
  if top.IsClosed():
4401
4163
  internalBoundaries = []
4402
4164
  try:
@@ -4407,11 +4169,11 @@ class Topology():
4407
4169
  else:
4408
4170
  tempEdge = Topology.Edges(top)[0]
4409
4171
  vst = Edge.VertexByParameter(tempEdge, 0.5)
4410
- elif isinstance(top, topologic.Edge): #Edge
4172
+ elif Topology.IsInstance(top, "Edge"): #Edge
4411
4173
  vst = Edge.VertexByParameter(top, 0.5)
4412
- elif isinstance(top, topologic.Vertex): #Vertex
4174
+ elif Topology.IsInstance(top, "Vertex"): #Vertex
4413
4175
  vst = top
4414
- elif isinstance(topology, topologic.Aperture): #Aperture
4176
+ elif Topology.IsInstance(topology, "Aperture"): #Aperture
4415
4177
  vst = Face.InternalVertex(Aperture.Topology(top), tolerance)
4416
4178
  else:
4417
4179
  vst = Topology.Centroid(top)
@@ -4424,7 +4186,7 @@ class Topology():
4424
4186
 
4425
4187
  Parameters
4426
4188
  ----------
4427
- topology : topologic.Topology
4189
+ topology : topologic_core.Topology
4428
4190
  The input topology.
4429
4191
  type : string
4430
4192
  The topology type. This can be one of:
@@ -4485,7 +4247,7 @@ class Topology():
4485
4247
 
4486
4248
  Parameters
4487
4249
  ----------
4488
- topology : topologic.Topology
4250
+ topology : topologic_core.Topology
4489
4251
  The input topology.
4490
4252
  tolerance : float , optional
4491
4253
  The desired tolerance. The default is 0.0001.
@@ -4517,7 +4279,7 @@ class Topology():
4517
4279
  d = (- a * v1.X() - b * v1.Y() - c * v1.Z())
4518
4280
  return [a, b, c, d]
4519
4281
 
4520
- if not isinstance(topology, topologic.Topology):
4282
+ if not Topology.IsInstance(topology, "Topology"):
4521
4283
  print("Topology.IsPlanar - Error: the input topology parameter is not a valid topology. Returning None.")
4522
4284
  return None
4523
4285
  vertices = Topology.Vertices(topology)
@@ -4540,9 +4302,9 @@ class Topology():
4540
4302
 
4541
4303
  Parameters
4542
4304
  ----------
4543
- topologyA : topologic.Topology
4305
+ topologyA : topologic_core.Topology
4544
4306
  The first input topology.
4545
- topologyB : topologic.Topology
4307
+ topologyB : topologic_core.Topology
4546
4308
  The second input topology.
4547
4309
 
4548
4310
  Returns
@@ -4551,10 +4313,10 @@ class Topology():
4551
4313
  True of the input topologies are the same topology. False otherwise.
4552
4314
 
4553
4315
  """
4554
- if not isinstance(topologyA, topologic.Topology):
4316
+ if not Topology.IsInstance(topologyA, "Topology"):
4555
4317
  print("Topology.IsSame - Error: the input topologyA parameter is not a valid topology. Returning None.")
4556
4318
  return None
4557
- if not isinstance(topologyB, topologic.Topology):
4319
+ if not Topology.IsInstance(topologyB, "Topology"):
4558
4320
  print("Topology.IsSame - Error: the input topologyB parameter is not a valid topology. Returning None.")
4559
4321
  return None
4560
4322
  return topologic.Topology.IsSame(topologyA, topologyB)
@@ -4573,7 +4335,7 @@ class Topology():
4573
4335
 
4574
4336
  Returns
4575
4337
  -------
4576
- topologic.Topology
4338
+ topologic_core.Topology
4577
4339
  The resulting merged Topology
4578
4340
 
4579
4341
  """
@@ -4584,7 +4346,7 @@ class Topology():
4584
4346
  print("Topology.MergeAll - Error: the input topologies parameter is not a valid list. Returning None.")
4585
4347
  return None
4586
4348
 
4587
- topologyList = [t for t in topologies if isinstance(t, topologic.Topology)]
4349
+ topologyList = [t for t in topologies if Topology.IsInstance(t, "Topology")]
4588
4350
  if len(topologyList) < 1:
4589
4351
  print("Topology.MergeAll - Error: the input topologyList does not contain any valid topologies. Returning None.")
4590
4352
  return None
@@ -4597,16 +4359,16 @@ class Topology():
4597
4359
 
4598
4360
  Parameters
4599
4361
  ----------
4600
- topology : topologic.Topology
4362
+ topology : topologic_core.Topology
4601
4363
  The input topology.
4602
4364
 
4603
4365
  Returns
4604
4366
  -------
4605
- topologic.TopoDS_Shape
4367
+ topologic_core.TopoDS_Shape
4606
4368
  The OCCT Shape.
4607
4369
 
4608
4370
  """
4609
- if not isinstance(topology, topologic.Topology):
4371
+ if not Topology.IsInstance(topology, "Topology"):
4610
4372
  print("Topology.OCCTShape - Error: the input topology parameter is not a valid topology. Returning None.")
4611
4373
  return None
4612
4374
  return topology.GetOcctShape()
@@ -4618,9 +4380,9 @@ class Topology():
4618
4380
 
4619
4381
  Parameters
4620
4382
  ----------
4621
- topology : topologic.Topology
4383
+ topology : topologic_core.Topology
4622
4384
  The input topology.
4623
- hostTopology : topologic.Topology
4385
+ hostTopology : topologic_core.Topology
4624
4386
  The input host topology to which the input topology belongs
4625
4387
 
4626
4388
  Returns
@@ -4629,10 +4391,10 @@ class Topology():
4629
4391
  The degree of the topology (the number of immediate super topologies that use the input topology).
4630
4392
 
4631
4393
  """
4632
- if not isinstance(topology, topologic.Topology):
4394
+ if not Topology.IsInstance(topology, "Topology"):
4633
4395
  print("Topology.Degree - Error: the input topology parameter is not a valid topology. Returning None.")
4634
4396
  return None
4635
- if not isinstance(hostTopology, topologic.Topology):
4397
+ if not Topology.IsInstance(hostTopology, "Topology"):
4636
4398
  print("Topology.Degree - Error: the input hostTopology parameter is not a valid topology. Returning None.")
4637
4399
  return None
4638
4400
 
@@ -4659,7 +4421,7 @@ class Topology():
4659
4421
 
4660
4422
  Parameters
4661
4423
  ----------
4662
- topology : topologic.Topology
4424
+ topology : topologic_core.Topology
4663
4425
  The input topology.
4664
4426
  tolerance : float , optional
4665
4427
  The desired tolerance. The default is 0.0001.
@@ -4669,7 +4431,7 @@ class Topology():
4669
4431
  The list of nonplanar faces.
4670
4432
 
4671
4433
  """
4672
- if not isinstance(topology, topologic.Topology):
4434
+ if not Topology.IsInstance(topology, "Topology"):
4673
4435
  print("Topology.NonPlanarFaces - Error: the input topology parameter is not a valid topology. Returning None.")
4674
4436
  return None
4675
4437
  faces = Topology.SubTopologies(topology, subTopologyType="face")
@@ -4682,7 +4444,7 @@ class Topology():
4682
4444
 
4683
4445
  Parameters
4684
4446
  ----------
4685
- topology : topologic.Topology
4447
+ topology : topologic_core.Topology
4686
4448
  The input topology.
4687
4449
 
4688
4450
  Returns
@@ -4692,7 +4454,7 @@ class Topology():
4692
4454
 
4693
4455
  """
4694
4456
 
4695
- if not isinstance(topology, topologic.Topology):
4457
+ if not Topology.IsInstance(topology, "Topology"):
4696
4458
  print("Topology.OpenFaces - Error: the input topology parameter is not a valid topology. Returning None.")
4697
4459
  return None
4698
4460
 
@@ -4705,7 +4467,7 @@ class Topology():
4705
4467
 
4706
4468
  Parameters
4707
4469
  ----------
4708
- topology : topologic.Topology
4470
+ topology : topologic_core.Topology
4709
4471
  The input topology.
4710
4472
 
4711
4473
  Returns
@@ -4715,7 +4477,7 @@ class Topology():
4715
4477
 
4716
4478
  """
4717
4479
 
4718
- if not isinstance(topology, topologic.Topology):
4480
+ if not Topology.IsInstance(topology, "Topology"):
4719
4481
  print("Topology.OpenEdges - Error: the input topology parameter is not a valid topology. Returning None.")
4720
4482
  return None
4721
4483
 
@@ -4728,7 +4490,7 @@ class Topology():
4728
4490
 
4729
4491
  Parameters
4730
4492
  ----------
4731
- topology : topologic.Topology
4493
+ topology : topologic_core.Topology
4732
4494
  The input topology.
4733
4495
 
4734
4496
  Returns
@@ -4738,7 +4500,7 @@ class Topology():
4738
4500
 
4739
4501
  """
4740
4502
 
4741
- if not isinstance(topology, topologic.Topology):
4503
+ if not Topology.IsInstance(topology, "Topology"):
4742
4504
  print("Topology.OpenVertices - Error: the input topology parameter is not a valid topology. Returning None.")
4743
4505
  return None
4744
4506
 
@@ -4751,9 +4513,9 @@ class Topology():
4751
4513
 
4752
4514
  Parameters
4753
4515
  ----------
4754
- topology : topologic.Topology
4516
+ topology : topologic_core.Topology
4755
4517
  The input topology.
4756
- origin : topologic.Vertex , optional
4518
+ origin : topologic_core.Vertex , optional
4757
4519
  The input origin. If set to None, The object's centroid will be used to locate the input topology. The default is None.
4758
4520
  dirA : list , optional
4759
4521
  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 +4526,16 @@ class Topology():
4764
4526
 
4765
4527
  Returns
4766
4528
  -------
4767
- topologic.Topology
4529
+ topologic_core.Topology
4768
4530
  The flattened topology.
4769
4531
 
4770
4532
  """
4771
4533
  from topologicpy.Vertex import Vertex
4772
4534
  from topologicpy.Vector import Vector
4773
- if not isinstance(topology, topologic.Topology):
4535
+ if not Topology.IsInstance(topology, "Topology"):
4774
4536
  print("Topology.Orient - Error: the input topology parameter is not a valid topology. Returning None.")
4775
4537
  return None
4776
- if not isinstance(origin, topologic.Vertex):
4538
+ if not Topology.IsInstance(origin, "Vertex"):
4777
4539
  origin = Topology.Centroid(topology)
4778
4540
  return_topology = Topology.Place(topology, originA=origin, originB=Vertex.Origin())
4779
4541
  tran_mat = Vector.TransformationMatrix(dirA, dirB)
@@ -4788,25 +4550,25 @@ class Topology():
4788
4550
 
4789
4551
  Parameters
4790
4552
  ----------
4791
- topology : topologic.Topology
4553
+ topology : topologic_core.Topology
4792
4554
  The input topology.
4793
- originA : topologic.Vertex , optional
4555
+ originA : topologic_core.Vertex , optional
4794
4556
  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 : topologic.Vertex , optional
4557
+ originB : topologic_core.Vertex , optional
4796
4558
  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
4559
 
4798
4560
  Returns
4799
4561
  -------
4800
- topologic.Topology
4562
+ topologic_core.Topology
4801
4563
  The placed topology.
4802
4564
 
4803
4565
  """
4804
4566
  from topologicpy.Vertex import Vertex
4805
- if not isinstance(topology, topologic.Topology):
4567
+ if not Topology.IsInstance(topology, "Topology"):
4806
4568
  return None
4807
- if not isinstance(originA, topologic.Vertex):
4569
+ if not Topology.IsInstance(originA, "Vertex"):
4808
4570
  originA = Topology.Centroid(topology)
4809
- if not isinstance(originA, topologic.Vertex):
4571
+ if not Topology.IsInstance(originA, "Vertex"):
4810
4572
  originA = Vertex.ByCoordinates(0, 0, 0)
4811
4573
 
4812
4574
  x = originB.X() - originA.X()
@@ -4827,7 +4589,7 @@ class Topology():
4827
4589
 
4828
4590
  Parameters
4829
4591
  ----------
4830
- topology : topologic.Topology
4592
+ topology : topologic_core.Topology
4831
4593
  The input topology.
4832
4594
  angTolerance : float , optional
4833
4595
  The desired angular tolerance. The default is 0.1.
@@ -4836,7 +4598,7 @@ class Topology():
4836
4598
 
4837
4599
  Returns
4838
4600
  -------
4839
- topologic.Topology
4601
+ topologic_core.Topology
4840
4602
  The input topology with the collinear edges removed.
4841
4603
 
4842
4604
  """
@@ -4847,28 +4609,27 @@ class Topology():
4847
4609
  from topologicpy.CellComplex import CellComplex
4848
4610
  from topologicpy.Cluster import Cluster
4849
4611
 
4850
- if not isinstance(topology, topologic.Topology):
4612
+ if not Topology.IsInstance(topology, "Topology"):
4851
4613
  return None
4852
4614
  return_topology = topology
4853
- t = topology.Type()
4854
- if isinstance(topology, topologic.Vertex) or isinstance(topology, topologic.Edge): #Vertex or Edge or Cluster, return the original topology
4615
+ if Topology.IsInstance(topology, "Vertex") or Topology.IsInstance(topology, "Edge"): #Vertex or Edge or Cluster, return the original topology
4855
4616
  return return_topology
4856
- elif isinstance(topology, topologic.Wire):
4617
+ elif Topology.IsInstance(topology, "Wire"):
4857
4618
  return_topology = Wire.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
4858
4619
  return return_topology
4859
- elif isinstance(topology, topologic.Face):
4620
+ elif Topology.IsInstance(topology, "Face"):
4860
4621
  return_topology = Face.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
4861
4622
  return return_topology
4862
- elif isinstance(topology, topologic.Shell):
4623
+ elif Topology.IsInstance(topology, "Shell"):
4863
4624
  return_topology = Shell.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
4864
4625
  return return_topology
4865
- elif isinstance(topology, topologic.Cell):
4626
+ elif Topology.IsInstance(topology, "Cell"):
4866
4627
  return_topology = Cell.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
4867
4628
  return return_topology
4868
- elif isinstance(topology, topologic.CellComplex):
4629
+ elif Topology.IsInstance(topology, "CellComplex"):
4869
4630
  return_topology = CellComplex.RemoveCollinearEdges(topology, angTolerance=angTolerance, tolerance=tolerance)
4870
4631
  return return_topology
4871
- elif isinstance(topology, topologic.Cluster):
4632
+ elif Topology.IsInstance(topology, "Cluster"):
4872
4633
  topologies = []
4873
4634
  topologies += Cluster.FreeVertices(topology)
4874
4635
  topologies += Cluster.FreeEdges(topology)
@@ -4885,14 +4646,14 @@ class Topology():
4885
4646
 
4886
4647
  Parameters
4887
4648
  ----------
4888
- topology : topologic.Topology
4649
+ topology : topologic_core.Topology
4889
4650
  The input topology.
4890
4651
  contentList : list
4891
4652
  The input list of contents.
4892
4653
 
4893
4654
  Returns
4894
4655
  -------
4895
- topologic.Topology
4656
+ topologic_core.Topology
4896
4657
  The input topology with the input list of contents removed.
4897
4658
 
4898
4659
  """
@@ -4907,7 +4668,7 @@ class Topology():
4907
4668
 
4908
4669
  Parameters
4909
4670
  ----------
4910
- topology : topologic.Topology
4671
+ topology : topologic_core.Topology
4911
4672
  The input topology.
4912
4673
  angTolerance : float , optional
4913
4674
  The desired angular tolerance for removing coplanar faces. The default is 0.1.
@@ -4918,7 +4679,7 @@ class Topology():
4918
4679
 
4919
4680
  Returns
4920
4681
  -------
4921
- topologic.Topology
4682
+ topologic_core.Topology
4922
4683
  The input topology with coplanar faces merged into one face.
4923
4684
 
4924
4685
  """
@@ -4929,11 +4690,11 @@ class Topology():
4929
4690
  from topologicpy.CellComplex import CellComplex
4930
4691
  from topologicpy.Cluster import Cluster
4931
4692
 
4932
- if not isinstance(topology, topologic.Topology):
4933
- print("Topology.RemoveCoplanarFace - Error: The input topology parameter is not a valid topologic topology. Returning None.")
4693
+ if not Topology.IsInstance(topology, "Topology"):
4694
+ print("Topology.RemoveCoplanarFaces - Error: The input topology parameter is not a valid topologic topology. Returning None.")
4934
4695
  return None
4935
- t = topology.Type()
4936
- if (t == 1) or (t == 2) or (t == 4) or (t == 8):
4696
+ t = Topology.Type(topology)
4697
+ if (t == Topology.TypeID("Vertex")) or (t == Topology.TypeID("Edge")) or (t == Topology.TypeID("Wire")) or (t == Topology.TypeID("Face")):
4937
4698
  return topology
4938
4699
 
4939
4700
  def faces_on_same_plane(face1, face2, epsilon=1e-6):
@@ -4971,12 +4732,12 @@ class Topology():
4971
4732
  final_faces = []
4972
4733
  for face_cluster in face_clusters:
4973
4734
  t = Topology.SelfMerge(Cluster.ByTopologies(face_cluster), tolerance=tolerance)
4974
- if isinstance(t, topologic.Face):
4735
+ if Topology.IsInstance(t, "Face"):
4975
4736
  #final_faces.append(Face.RemoveCollinearEdges(t))
4976
4737
  final_faces.append(t)
4977
- elif isinstance(t, topologic.Shell):
4738
+ elif Topology.IsInstance(t, "Shell"):
4978
4739
  f = Face.ByShell(t)
4979
- if isinstance(f, topologic.Face):
4740
+ if Topology.IsInstance(f, "Face"):
4980
4741
  final_faces.append(f)
4981
4742
  else:
4982
4743
  print("Topology.RemoveCoplanarFaces - Warning: Could not remove some coplanar faces. Re-adding original faces.")
@@ -4985,7 +4746,7 @@ class Topology():
4985
4746
  shells = Topology.Shells(t)
4986
4747
  for shell in shells:
4987
4748
  f = Face.ByShell(shell)
4988
- if isinstance(f, topologic.Face):
4749
+ if Topology.IsInstance(f, "Face"):
4989
4750
  final_faces.append(f)
4990
4751
  else:
4991
4752
  print("Topology.RemoveCoplanarFaces - Warning: Could not remove some coplanar faces. Re-adding original faces.")
@@ -4996,16 +4757,16 @@ class Topology():
4996
4757
  faces = Cluster.FreeFaces(t)
4997
4758
  final_faces += faces
4998
4759
  return_topology = None
4999
- if isinstance(topology, topologic.CellComplex):
4760
+ if Topology.IsInstance(topology, "CellComplex"):
5000
4761
  return_topology = CellComplex.ByFaces(final_faces, tolerance=tolerance)
5001
- elif isinstance(topology, topologic.Cell):
4762
+ elif Topology.IsInstance(topology, "Cell"):
5002
4763
  return_topology = Cell.ByFaces(final_faces, tolerance=tolerance)
5003
- elif isinstance(topology, topologic.Shell):
4764
+ elif Topology.IsInstance(topology, "Shell"):
5004
4765
  if len(final_faces) == 1:
5005
4766
  return_topology = final_faces[0]
5006
4767
  else:
5007
4768
  return_topology = Shell.ByFaces(final_faces, tolerance=tolerance)
5008
- if not isinstance(return_topology, topologic.Topology):
4769
+ if not Topology.IsInstance(return_topology, "Topology"):
5009
4770
  return_topology = Cluster.ByTopologies(final_faces)
5010
4771
  return return_topology
5011
4772
 
@@ -5016,7 +4777,7 @@ class Topology():
5016
4777
 
5017
4778
  Parameters
5018
4779
  ----------
5019
- topology : topologic.Topology
4780
+ topology : topologic_core.Topology
5020
4781
  The input topology.
5021
4782
  edges : list
5022
4783
  The input list of edges.
@@ -5025,15 +4786,15 @@ class Topology():
5025
4786
 
5026
4787
  Returns
5027
4788
  -------
5028
- topologic.Topology
4789
+ topologic_core.Topology
5029
4790
  The input topology with the input list of edges removed.
5030
4791
 
5031
4792
  """
5032
4793
 
5033
4794
  from topologicpy.Cluster import Cluster
5034
- if not isinstance(topology, topologic.Topology):
4795
+ if not Topology.IsInstance(topology, "Topology"):
5035
4796
  return None
5036
- edges = [e for e in edges if isinstance(e, topologic.Edge)]
4797
+ edges = [e for e in edges if Topology.IsInstance(e, "Edge")]
5037
4798
  if len(edges) < 1:
5038
4799
  return topology
5039
4800
  t_edges = Topology.Edges(topology)
@@ -5076,7 +4837,7 @@ class Topology():
5076
4837
 
5077
4838
  Parameters
5078
4839
  ----------
5079
- topology : topologic.Topology
4840
+ topology : topologic_core.Topology
5080
4841
  The input topology.
5081
4842
  faces : list
5082
4843
  The input list of faces.
@@ -5085,15 +4846,15 @@ class Topology():
5085
4846
 
5086
4847
  Returns
5087
4848
  -------
5088
- topologic.Topology
4849
+ topologic_core.Topology
5089
4850
  The input topology with the input list of faces removed.
5090
4851
 
5091
4852
  """
5092
4853
 
5093
4854
  from topologicpy.Cluster import Cluster
5094
- if not isinstance(topology, topologic.Topology):
4855
+ if not Topology.IsInstance(topology, "Topology"):
5095
4856
  return None
5096
- faces = [f for f in faces if isinstance(f, topologic.Face)]
4857
+ faces = [f for f in faces if Topology.IsInstance(f, "Face")]
5097
4858
  if len(faces) < 1:
5098
4859
  return topology
5099
4860
  t_faces = Topology.Faces(topology)
@@ -5122,7 +4883,7 @@ class Topology():
5122
4883
 
5123
4884
  Parameters
5124
4885
  ----------
5125
- topology : topologic.Topology
4886
+ topology : topologic_core.Topology
5126
4887
  The input topology.
5127
4888
  selectors : list
5128
4889
  The input list of selectors (vertices).
@@ -5131,15 +4892,15 @@ class Topology():
5131
4892
 
5132
4893
  Returns
5133
4894
  -------
5134
- topologic.Topology
4895
+ topologic_core.Topology
5135
4896
  The input topology with the identified faces removed.
5136
4897
 
5137
4898
  """
5138
4899
  from topologicpy.Vertex import Vertex
5139
4900
 
5140
- if not isinstance(topology, topologic.Topology):
4901
+ if not Topology.IsInstance(topology, "Topology"):
5141
4902
  return None
5142
- selectors = [v for v in selectors if isinstance(v, topologic.Vertex)]
4903
+ selectors = [v for v in selectors if Topology.IsInstance(v, "Vertex")]
5143
4904
  if len(selectors) < 1:
5144
4905
  return topology
5145
4906
  t_faces = Topology.Faces(topology)
@@ -5164,7 +4925,7 @@ class Topology():
5164
4925
 
5165
4926
  Parameters
5166
4927
  ----------
5167
- topology : topologic.Topology
4928
+ topology : topologic_core.Topology
5168
4929
  The input topology.
5169
4930
  vertices : list
5170
4931
  The input list of vertices.
@@ -5173,15 +4934,15 @@ class Topology():
5173
4934
 
5174
4935
  Returns
5175
4936
  -------
5176
- topologic.Topology
4937
+ topologic_core.Topology
5177
4938
  The input topology with the input list of vertices removed.
5178
4939
 
5179
4940
  """
5180
4941
 
5181
4942
  from topologicpy.Cluster import Cluster
5182
- if not isinstance(topology, topologic.Topology):
4943
+ if not Topology.IsInstance(topology, "Topology"):
5183
4944
  return None
5184
- vertices = [v for v in vertices if isinstance(v, topologic.Vertex)]
4945
+ vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
5185
4946
  if len(vertices) < 1:
5186
4947
  return topology
5187
4948
  t_vertices = Topology.Vertices(topology)
@@ -5225,16 +4986,16 @@ class Topology():
5225
4986
 
5226
4987
  Parameters
5227
4988
  ----------
5228
- topology : topologic.Topology , optional
4989
+ topology : topologic_core.Topology , optional
5229
4990
  If specified the resources used by the input topology will be deleted. If not, ALL resources will be deleted.
5230
4991
 
5231
4992
  Returns
5232
4993
  -------
5233
- topologic.Topology
4994
+ topologic_core.Topology
5234
4995
  The input topology, but with its resources deleted or None.
5235
4996
  """
5236
4997
  if not topology == None:
5237
- if not isinstance(topology, topologic.Topology):
4998
+ if not Topology.IsInstance(topology, "Topology"):
5238
4999
  print("Topology.Cleanup - Error: The input topology parameter is not a valid topology. Returning None.")
5239
5000
  return None
5240
5001
  topologic.Topology.Cleanup(topology)
@@ -5247,7 +5008,7 @@ class Topology():
5247
5008
 
5248
5009
  Parameters
5249
5010
  ----------
5250
- topology : topologic.Topology
5011
+ topology : topologic_core.Topology
5251
5012
  The input topology.
5252
5013
  verticesA : list
5253
5014
  The first input list of vertices.
@@ -5260,7 +5021,7 @@ class Topology():
5260
5021
 
5261
5022
  Returns
5262
5023
  -------
5263
- topologic.Topology
5024
+ topologic_core.Topology
5264
5025
  The new topology.
5265
5026
 
5266
5027
  """
@@ -5289,9 +5050,9 @@ class Topology():
5289
5050
 
5290
5051
  Parameters
5291
5052
  ----------
5292
- topology : topologic.Topology
5053
+ topology : topologic_core.Topology
5293
5054
  The input topology.
5294
- origin : topologic.Vertex , optional
5055
+ origin : topologic_core.Vertex , optional
5295
5056
  The origin (center) of the rotation. If set to None, the world origin (0, 0, 0) is used. The default is None.
5296
5057
  axis : list , optional
5297
5058
  The vector representing the axis of rotation. The default is [0, 0, 1] which equates to the Z axis.
@@ -5304,7 +5065,7 @@ class Topology():
5304
5065
 
5305
5066
  Returns
5306
5067
  -------
5307
- topologic.Topology
5068
+ topologic_core.Topology
5308
5069
  The rotated topology.
5309
5070
 
5310
5071
  """
@@ -5335,12 +5096,12 @@ class Topology():
5335
5096
  rotated_vertex = [v for v in rotated_vertex]
5336
5097
  return rotated_vertex
5337
5098
 
5338
- if not isinstance(topology, topologic.Topology):
5099
+ if not Topology.IsInstance(topology, "Topology"):
5339
5100
  print("Topology.Rotate - Error: The input topology parameter is not a valid topologic topology. Returning None.")
5340
5101
  return None
5341
5102
  if not origin:
5342
5103
  origin = Vertex.ByCoordinates(0, 0, 0)
5343
- if not isinstance(origin, topologic.Vertex):
5104
+ if not Topology.IsInstance(origin, "Vertex"):
5344
5105
  print("Topology.Rotate - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
5345
5106
  return None
5346
5107
  returnTopology = topology
@@ -5368,9 +5129,9 @@ class Topology():
5368
5129
 
5369
5130
  Parameters
5370
5131
  ----------
5371
- topology : topologic.Topology
5132
+ topology : topologic_core.Topology
5372
5133
  The input topology.
5373
- origin : topologic.Vertex , optional
5134
+ origin : topologic_core.Vertex , optional
5374
5135
  The origin (center) of the scaling. If set to None, the world origin (0, 0, 0) is used. The default is None.
5375
5136
  x : float , optional
5376
5137
  The 'x' component of the scaling factor. The default is 1.
@@ -5381,16 +5142,16 @@ class Topology():
5381
5142
 
5382
5143
  Returns
5383
5144
  -------
5384
- topologic.Topology
5145
+ topologic_core.Topology
5385
5146
  The scaled topology.
5386
5147
 
5387
5148
  """
5388
5149
  from topologicpy.Vertex import Vertex
5389
- if not isinstance(topology, topologic.Topology):
5150
+ if not Topology.IsInstance(topology, "Topology"):
5390
5151
  return None
5391
5152
  if not origin:
5392
5153
  origin = Vertex.ByCoordinates(0, 0, 0)
5393
- if not isinstance(origin, topologic.Vertex):
5154
+ if not Topology.IsInstance(origin, "Vertex"):
5394
5155
  return None
5395
5156
  newTopology = None
5396
5157
  try:
@@ -5408,22 +5169,22 @@ class Topology():
5408
5169
 
5409
5170
  Parameters
5410
5171
  ----------
5411
- topology : topologic.Topology
5172
+ topology : topologic_core.Topology
5412
5173
  The input topology.
5413
- selector : topologic.Vertex
5174
+ selector : topologic_core.Vertex
5414
5175
  A vertex located on the desired subtopology.
5415
5176
  subTopologyType : str , optional.
5416
5177
  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
5178
 
5418
5179
  Returns
5419
5180
  -------
5420
- topologic.Topology
5181
+ topologic_core.Topology
5421
5182
  The selected subtopology.
5422
5183
 
5423
5184
  """
5424
- if not isinstance(topology, topologic.Topology):
5185
+ if not Topology.IsInstance(topology, "Topology"):
5425
5186
  return None
5426
- if not isinstance(selector, topologic.Vertex):
5187
+ if not Topology.IsInstance(selector, "Vertex"):
5427
5188
  return None
5428
5189
  t = 1
5429
5190
  if subTopologyType.lower() == "vertex":
@@ -5450,71 +5211,59 @@ class Topology():
5450
5211
 
5451
5212
  Parameters
5452
5213
  ----------
5453
- topology : topologic.Topology
5214
+ topology : topologic_core.Topology
5454
5215
  The input topology.
5455
5216
  tolerance : float , optional
5456
5217
  The desired tolerance. The default is 0.0001
5457
5218
 
5458
5219
  Returns
5459
5220
  -------
5460
- topologic.Topology
5221
+ topologic_core.Topology
5461
5222
  The self-merged topology.
5462
5223
 
5463
5224
  """
5464
5225
  from topologicpy.Cluster import Cluster
5465
- if not isinstance(topology, topologic.Topology):
5226
+
5227
+ if not Topology.IsInstance(topology, "Topology"):
5466
5228
  return None #return Silently
5467
- if topology.Type() != 128:
5229
+ if not Topology.Type(topology) == Topology.TypeID("Cluster"):
5468
5230
  topology = Cluster.ByTopologies([topology])
5469
5231
  resultingTopologies = []
5470
- topCC = []
5471
- _ = topology.CellComplexes(None, topCC)
5472
- topCells = []
5473
- _ = topology.Cells(None, topCells)
5474
- topShells = []
5475
- _ = topology.Shells(None, topShells)
5476
- topFaces = []
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)
5232
+ topCC = Topology.CellComplexes(topology)
5233
+ topCells = Topology.Cells(topology)
5234
+ topShells = Topology.Shells(topology)
5235
+ topFaces = Topology.Faces(topology)
5236
+ topWires = Topology.Wires(topology)
5237
+ topEdges = Topology.Edges(topology)
5238
+ topVertices = Topology.Vertices(topology)
5484
5239
  if len(topCC) == 1:
5485
5240
  cc = topCC[0]
5486
- ccVertices = []
5487
- _ = cc.Vertices(None, ccVertices)
5241
+ ccVertices = Topology.Vertices(cc)
5488
5242
  if len(topVertices) == len(ccVertices):
5489
5243
  resultingTopologies.append(cc)
5490
5244
  if len(topCC) == 0 and len(topCells) == 1:
5491
5245
  cell = topCells[0]
5492
- ccVertices = []
5493
- _ = cell.Vertices(None, ccVertices)
5246
+ ccVertices = Topology.Vertices(cell)
5494
5247
  if len(topVertices) == len(ccVertices):
5495
5248
  resultingTopologies.append(cell)
5496
5249
  if len(topCC) == 0 and len(topCells) == 0 and len(topShells) == 1:
5497
5250
  shell = topShells[0]
5498
- ccVertices = []
5499
- _ = shell.Vertices(None, ccVertices)
5251
+ ccVertices = Topology.Vertices(shell)
5500
5252
  if len(topVertices) == len(ccVertices):
5501
5253
  resultingTopologies.append(shell)
5502
5254
  if len(topCC) == 0 and len(topCells) == 0 and len(topShells) == 0 and len(topFaces) == 1:
5503
5255
  face = topFaces[0]
5504
- ccVertices = []
5505
- _ = face.Vertices(None, ccVertices)
5256
+ ccVertices = Topology.Vertices(face)
5506
5257
  if len(topVertices) == len(ccVertices):
5507
5258
  resultingTopologies.append(face)
5508
5259
  if len(topCC) == 0 and len(topCells) == 0 and len(topShells) == 0 and len(topFaces) == 0 and len(topWires) == 1:
5509
5260
  wire = topWires[0]
5510
- ccVertices = []
5511
- _ = wire.Vertices(None, ccVertices)
5261
+ ccVertices = Topology.Vertices(wire)
5512
5262
  if len(topVertices) == len(ccVertices):
5513
5263
  resultingTopologies.append(wire)
5514
5264
  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
5265
  edge = topEdges[0]
5516
- ccVertices = []
5517
- _ = edge.Vertices(None, ccVertices)
5266
+ ccVertices = Topology.Vertices(edge)
5518
5267
  if len(topVertices) == len(ccVertices):
5519
5268
  resultingTopologies.append(edge)
5520
5269
  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 +5275,7 @@ class Topology():
5526
5275
  return_topology = topology.SelfMerge()
5527
5276
  except:
5528
5277
  return_topology = None
5529
- if isinstance(return_topology, topologic.CellComplex):
5278
+ if Topology.IsInstance(return_topology, "CellComplex"):
5530
5279
  cells = Topology.Cells(return_topology)
5531
5280
  if isinstance(cells, list):
5532
5281
  if len(cells) > 1:
@@ -5544,25 +5293,25 @@ class Topology():
5544
5293
 
5545
5294
  Parameters
5546
5295
  ----------
5547
- topology : topologic.Topology
5296
+ topology : topologic_core.Topology
5548
5297
  The input topology.
5549
- dictionary : topologic.Dictionary
5298
+ dictionary : topologic_core.Dictionary
5550
5299
  The input dictionary.
5551
5300
 
5552
5301
  Returns
5553
5302
  -------
5554
- topologic.Topology
5303
+ topologic_core.Topology
5555
5304
  The input topology with the input dictionary set in it.
5556
5305
 
5557
5306
  """
5558
5307
  from topologicpy.Dictionary import Dictionary
5559
5308
 
5560
- if not isinstance(topology, topologic.Topology) and not isinstance(topology, topologic.Graph):
5309
+ if not Topology.IsInstance(topology, "Topology") and not Topology.IsInstance(topology, "Graph"):
5561
5310
  print("Topology.SetDictionary - Error: the input topology parameter is not a valid topology or graph. Returning None.")
5562
5311
  return None
5563
5312
  if isinstance(dictionary, dict):
5564
5313
  dictionary = Dictionary.ByPythonDictionary(dictionary)
5565
- if not isinstance(dictionary, topologic.Dictionary):
5314
+ if not Topology.IsInstance(dictionary, "Dictionary"):
5566
5315
  print("Topology.SetDictionary - Warning: the input dictionary parameter is not a valid dictionary. Returning original input.")
5567
5316
  return topology
5568
5317
  if len(dictionary.Keys()) < 1:
@@ -5573,6 +5322,7 @@ class Topology():
5573
5322
 
5574
5323
  @staticmethod
5575
5324
  def SetSnapshot(topology, snapshot=None, timestamp=None, key="timestamp", silent=False):
5325
+ from topologicpy.Dictionary import Dictionary
5576
5326
  from datetime import datetime
5577
5327
  def is_valid_timestamp(timestamp):
5578
5328
  if isinstance(timestamp, datetime):
@@ -5596,13 +5346,13 @@ class Topology():
5596
5346
  else:
5597
5347
  return False
5598
5348
 
5599
- if not isinstance(topology, topologic.Topology):
5349
+ if not Topology.IsInstance(topology, "Topology"):
5600
5350
  if not silent:
5601
5351
  print("Topology.SetSnapshot - Error: The input topology parameter is not a valid topology. Returning None.")
5602
5352
  return None
5603
- if not isinstance(snapshot, topologic.Topology):
5353
+ if not Topology.IsInstance(snapshot, "Topology"):
5604
5354
  snapshot = Topology.Copy(topology)
5605
- if not isinstance(snapshot, topologic.Topology):
5355
+ if not Topology.IsInstance(snapshot, "Topology"):
5606
5356
  if not silent:
5607
5357
  print("Topology.SetSnapshot - Error: The input snapshot parameter is not a valid topology. Returning None.")
5608
5358
  return None
@@ -5626,9 +5376,9 @@ class Topology():
5626
5376
 
5627
5377
  Parameters
5628
5378
  ----------
5629
- topologyA : topologic.Topology
5379
+ topologyA : topologic_core.Topology
5630
5380
  The first input topology.
5631
- topologyB : topologic.Topology
5381
+ topologyB : topologic_core.Topology
5632
5382
  The second input topology.
5633
5383
 
5634
5384
  Returns
@@ -5638,10 +5388,10 @@ class Topology():
5638
5388
 
5639
5389
  """
5640
5390
 
5641
- if not isinstance(topologyA, topologic.Topology):
5391
+ if not Topology.IsInstance(topologyA, "Topology"):
5642
5392
  print("Topology.SharedTopologies - Error: the input topologyA parameter is not a valid topology. Returning None.")
5643
5393
  return None
5644
- if not isinstance(topologyB, topologic.Topology):
5394
+ if not Topology.IsInstance(topologyB, "Topology"):
5645
5395
  print("Topology.SharedTopologies - Error: the input topologyB parameter is not a valid topology. Returning None.")
5646
5396
  return None
5647
5397
  vOutput = []
@@ -5661,9 +5411,9 @@ class Topology():
5661
5411
 
5662
5412
  Parameters
5663
5413
  ----------
5664
- topologyA : topologic.Topology
5414
+ topologyA : topologic_core.Topology
5665
5415
  The first input topology.
5666
- topologyB : topologic.Topology
5416
+ topologyB : topologic_core.Topology
5667
5417
  The second input topology.
5668
5418
 
5669
5419
  Returns
@@ -5689,9 +5439,9 @@ class Topology():
5689
5439
 
5690
5440
  Parameters
5691
5441
  ----------
5692
- topologyA : topologic.Topology
5442
+ topologyA : topologic_core.Topology
5693
5443
  The first input topology.
5694
- topologyB : topologic.Topology
5444
+ topologyB : topologic_core.Topology
5695
5445
  The second input topology.
5696
5446
 
5697
5447
  Returns
@@ -5716,9 +5466,9 @@ class Topology():
5716
5466
 
5717
5467
  Parameters
5718
5468
  ----------
5719
- topologyA : topologic.Topology
5469
+ topologyA : topologic_core.Topology
5720
5470
  The first input topology.
5721
- topologyB : topologic.Topology
5471
+ topologyB : topologic_core.Topology
5722
5472
  The second input topology.
5723
5473
 
5724
5474
  Returns
@@ -5744,9 +5494,9 @@ class Topology():
5744
5494
 
5745
5495
  Parameters
5746
5496
  ----------
5747
- topologyA : topologic.Topology
5497
+ topologyA : topologic_core.Topology
5748
5498
  The first input topology.
5749
- topologyB : topologic.Topology
5499
+ topologyB : topologic_core.Topology
5750
5500
  The second input topology.
5751
5501
 
5752
5502
  Returns
@@ -5799,7 +5549,7 @@ class Topology():
5799
5549
 
5800
5550
  Parameters
5801
5551
  ----------
5802
- topologies : topologic.Topology or list
5552
+ topologies : topologic_core.Topology or list
5803
5553
  The input topology. This must contain faces and or edges. If the input is a list, a cluster is first created
5804
5554
 
5805
5555
  showVertices : bool , optional
@@ -5973,8 +5723,8 @@ class Topology():
5973
5723
  if isinstance(topologies, tuple):
5974
5724
  topologies = Helper.Flatten(list(topologies))
5975
5725
  if isinstance(topologies, list):
5976
- new_topologies = [t for t in topologies if isinstance(t, topologic.Topology)]
5977
- graphs = [Graph.Topology(g) for g in topologies if isinstance(g, topologic.Graph)]
5726
+ new_topologies = [t for t in topologies if Topology.IsInstance(t, "Topology")]
5727
+ graphs = [Graph.Topology(g) for g in topologies if Topology.IsInstance(g, "Graph")]
5978
5728
  new_topologies += graphs
5979
5729
  if len(new_topologies) == 0:
5980
5730
  print("Topology.Show - Error: the input topologies parameter does not contain any valid topology. Returning None.")
@@ -5983,7 +5733,7 @@ class Topology():
5983
5733
  topology = new_topologies[0]
5984
5734
  else:
5985
5735
  topology = Cluster.ByTopologies(new_topologies)
5986
- if not isinstance(topology, topologic.Topology):
5736
+ if not Topology.IsInstance(topology, "Topology"):
5987
5737
  print("Topology.Show - Error: the input topology parameter is not a valid topology. Returning None.")
5988
5738
  return None
5989
5739
  data = Plotly.DataByTopology(topology=topology,
@@ -6062,6 +5812,7 @@ class Topology():
6062
5812
 
6063
5813
  @staticmethod
6064
5814
  def Snapshots(topology, key="timestamp", start=None, end=None, silent=False):
5815
+ from topologicpy.Dictionary import Dictionary
6065
5816
  from datetime import datetime
6066
5817
  def is_valid_timestamp(timestamp):
6067
5818
  if isinstance(timestamp, datetime):
@@ -6084,7 +5835,7 @@ class Topology():
6084
5835
  else:
6085
5836
  return False
6086
5837
 
6087
- if not isinstance(topology, topologic.Topology):
5838
+ if not Topology.IsInstance(topology, "Topology"):
6088
5839
  if not silent:
6089
5840
  print("Topology.Snapshots - Error: The input topology parameter is not a valid topology. Returning None.")
6090
5841
  return None
@@ -6119,9 +5870,9 @@ class Topology():
6119
5870
 
6120
5871
  Parameters
6121
5872
  ----------
6122
- topology : topologic.Topology
5873
+ topology : topologic_core.Topology
6123
5874
  The input topology.
6124
- origin : topologic.Vertex
5875
+ origin : topologic_core.Vertex
6125
5876
  The origin (center) of the spin.
6126
5877
  triangulate : bool , optional
6127
5878
  If set to True, the result will be triangulated. The default is True.
@@ -6136,7 +5887,7 @@ class Topology():
6136
5887
 
6137
5888
  Returns
6138
5889
  -------
6139
- topologic.Topology
5890
+ topologic_core.Topology
6140
5891
  The spun topology.
6141
5892
 
6142
5893
  """
@@ -6149,11 +5900,11 @@ class Topology():
6149
5900
 
6150
5901
  if not origin:
6151
5902
  origin = Vertex.ByCoordinates(0, 0, 0)
6152
- if not isinstance(topology, topologic.Topology):
5903
+ if not Topology.IsInstance(topology, "Topology"):
6153
5904
  if not silent:
6154
5905
  print("Topology.Spin - Error: the input topology parameter is not a valid topology. Returning None.")
6155
5906
  return None
6156
- if not isinstance(origin, topologic.Vertex):
5907
+ if not Topology.IsInstance(origin, "Vertex"):
6157
5908
  if not silent:
6158
5909
  print("Topology.Spin - Error: the input origin parameter is not a valid vertex. Returning None.")
6159
5910
  return None
@@ -6164,9 +5915,9 @@ class Topology():
6164
5915
  if tempTopology:
6165
5916
  topologies.append(tempTopology)
6166
5917
  returnTopology = None
6167
- if topology.Type() == topologic.Vertex.Type():
5918
+ if Topology.Type(topology) == Topology.TypeID("Vertex"):
6168
5919
  returnTopology = Wire.ByVertices(topologies, False)
6169
- elif topology.Type() == topologic.Edge.Type():
5920
+ elif Topology.Type(topology) == Topology.TypeID("Edge"):
6170
5921
  try:
6171
5922
  returnTopology = Shell.ByWires(topologies,triangulate=triangulate, tolerance=tolerance, silent=True)
6172
5923
  except:
@@ -6174,7 +5925,7 @@ class Topology():
6174
5925
  returnTopology = Cluster.ByTopologies(topologies)
6175
5926
  except:
6176
5927
  returnTopology = None
6177
- elif topology.Type() == topologic.Wire.Type():
5928
+ elif Topology.Type(topology) == Topology.TypeID("Wire"):
6178
5929
  if topology.IsClosed():
6179
5930
  #returnTopology = Cell.ByWires(topologies, triangulate=triangulate, tolerance=tolerance, silent=True)
6180
5931
  try:
@@ -6205,7 +5956,7 @@ class Topology():
6205
5956
  returnTopology = Cluster.ByTopologies(topologies)
6206
5957
  except:
6207
5958
  returnTopology = None
6208
- elif topology.Type() == topologic.Face.Type():
5959
+ elif Topology.IsInstance(topology, "Face"):
6209
5960
  external_wires = []
6210
5961
  for t in topologies:
6211
5962
  external_wires.append(topologic.Face.ExternalBoundary(t))
@@ -6223,7 +5974,7 @@ class Topology():
6223
5974
  returnTopology = Topology.SelfMerge(Cluster.ByTopologies(topologies), tolerance=tolerance)
6224
5975
  if not returnTopology:
6225
5976
  return Cluster.ByTopologies(topologies)
6226
- if returnTopology.Type() == topologic.Shell.Type():
5977
+ if Topology.Type(returnTopology) == Topology.TypeID("Shell"):
6227
5978
  try:
6228
5979
  new_t = Cell.ByShell(returnTopology)
6229
5980
  if new_t:
@@ -6239,9 +5990,9 @@ class Topology():
6239
5990
 
6240
5991
  Parameters
6241
5992
  ----------
6242
- topology : topologic.Topology
5993
+ topology : topologic_core.Topology
6243
5994
  The input topology.
6244
- origin : topologic.Vertex , optional
5995
+ origin : topologic_core.Vertex , optional
6245
5996
  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
5997
  ratioRange : list , optional
6247
5998
  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 +6003,7 @@ class Topology():
6252
6003
 
6253
6004
  Returns
6254
6005
  -------
6255
- topologic.Topology
6006
+ topologic_core.Topology
6256
6007
  The tapered topology.
6257
6008
 
6258
6009
  """
@@ -6295,9 +6046,9 @@ class Topology():
6295
6046
 
6296
6047
  Parameters
6297
6048
  ----------
6298
- topology : topologic.Topology
6049
+ topology : topologic_core.Topology
6299
6050
  The input topology.
6300
- origin : topologic.Vertex , optional
6051
+ origin : topologic_core.Vertex , optional
6301
6052
  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
6053
  angleRange : list , optional
6303
6054
  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 +6057,7 @@ class Topology():
6306
6057
 
6307
6058
  Returns
6308
6059
  -------
6309
- topologic.Topology
6060
+ topologic_core.Topology
6310
6061
  The twisted topology.
6311
6062
 
6312
6063
  """
@@ -6341,23 +6092,23 @@ class Topology():
6341
6092
 
6342
6093
  Parameters
6343
6094
  ----------
6344
- topology : topologic.Topology
6095
+ topology : topologic_core.Topology
6345
6096
  The input topology.
6346
- origin : topologic.Vertex , optional
6097
+ origin : topologic_core.Vertex , optional
6347
6098
  The input origin. If set to None, The object's centroid will be used to translate the world origin. The default is None.
6348
6099
  vector : list , optional
6349
6100
  The input direction vector. The input topology will be rotated such that this vector is pointed in the positive Z axis.
6350
6101
 
6351
6102
  Returns
6352
6103
  -------
6353
- topologic.Topology
6104
+ topologic_core.Topology
6354
6105
  The flattened topology.
6355
6106
 
6356
6107
  """
6357
6108
  from topologicpy.Vertex import Vertex
6358
6109
  from topologicpy.Vector import Vector
6359
6110
 
6360
- if not isinstance(topology, topologic.Topology):
6111
+ if not Topology.IsInstance(topology, "Topology"):
6361
6112
  print("Topology.Unflatten - Error: the input topology parameter is not a valid topology. Returning None.")
6362
6113
  return None
6363
6114
  if origin == None:
@@ -6375,7 +6126,7 @@ class Topology():
6375
6126
 
6376
6127
  Parameters
6377
6128
  ----------
6378
- topology : topologic.Topology
6129
+ topology : topologic_core.Topology
6379
6130
  The input topology.
6380
6131
 
6381
6132
  Returns
@@ -6393,7 +6144,7 @@ class Topology():
6393
6144
 
6394
6145
  Parameters
6395
6146
  ----------
6396
- topology : topologic.Topology
6147
+ topology : topologic_core.Topology
6397
6148
  The input topology.
6398
6149
 
6399
6150
  Returns
@@ -6402,7 +6153,7 @@ class Topology():
6402
6153
  The list of edges.
6403
6154
 
6404
6155
  """
6405
- if isinstance(topology, topologic.Edge) or isinstance(topology, topologic.Vertex):
6156
+ if Topology.IsInstance(topology, "Edge") or Topology.IsInstance(topology, "Vertex"):
6406
6157
  return []
6407
6158
  return Topology.SubTopologies(topology=topology, subTopologyType="edge")
6408
6159
 
@@ -6413,7 +6164,7 @@ class Topology():
6413
6164
 
6414
6165
  Parameters
6415
6166
  ----------
6416
- topology : topologic.Topology
6167
+ topology : topologic_core.Topology
6417
6168
  The input topology.
6418
6169
 
6419
6170
  Returns
@@ -6422,7 +6173,7 @@ class Topology():
6422
6173
  The list of wires.
6423
6174
 
6424
6175
  """
6425
- if isinstance(topology, topologic.Wire) or isinstance(topology, topologic.Edge) or isinstance(topology, topologic.Vertex):
6176
+ if Topology.IsInstance(topology, "Wire") or Topology.IsInstance(topology, "Edge") or Topology.IsInstance(topology, "Vertex"):
6426
6177
  return []
6427
6178
  return Topology.SubTopologies(topology=topology, subTopologyType="wire")
6428
6179
 
@@ -6433,7 +6184,7 @@ class Topology():
6433
6184
 
6434
6185
  Parameters
6435
6186
  ----------
6436
- topology : topologic.Topology
6187
+ topology : topologic_core.Topology
6437
6188
  The input topology.
6438
6189
 
6439
6190
  Returns
@@ -6442,7 +6193,7 @@ class Topology():
6442
6193
  The list of faces.
6443
6194
 
6444
6195
  """
6445
- if isinstance(topology, topologic.Face) or isinstance(topology, topologic.Wire) or isinstance(topology, topologic.Edge) or isinstance(topology, topologic.Vertex):
6196
+ if Topology.IsInstance(topology, "Face") or Topology.IsInstance(topology, "Wire") or Topology.IsInstance(topology, "Edge") or Topology.IsInstance(topology, "Vertex"):
6446
6197
  return []
6447
6198
  return Topology.SubTopologies(topology=topology, subTopologyType="face")
6448
6199
 
@@ -6453,7 +6204,7 @@ class Topology():
6453
6204
 
6454
6205
  Parameters
6455
6206
  ----------
6456
- topology : topologic.Topology
6207
+ topology : topologic_core.Topology
6457
6208
  The input topology.
6458
6209
 
6459
6210
  Returns
@@ -6462,7 +6213,7 @@ class Topology():
6462
6213
  The list of shells.
6463
6214
 
6464
6215
  """
6465
- if isinstance(topology, topologic.Shell) or isinstance(topology, topologic.Face) or isinstance(topology, topologic.Wire) or isinstance(topology, topologic.Edge) or isinstance(topology, topologic.Vertex):
6216
+ 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
6217
  return []
6467
6218
  return Topology.SubTopologies(topology=topology, subTopologyType="shell")
6468
6219
 
@@ -6473,7 +6224,7 @@ class Topology():
6473
6224
 
6474
6225
  Parameters
6475
6226
  ----------
6476
- topology : topologic.Topology
6227
+ topology : topologic_core.Topology
6477
6228
  The input topology.
6478
6229
 
6479
6230
  Returns
@@ -6482,7 +6233,7 @@ class Topology():
6482
6233
  The list of cells.
6483
6234
 
6484
6235
  """
6485
- if isinstance(topology, topologic.Cell) or isinstance(topology, topologic.Shell) or isinstance(topology, topologic.Face) or isinstance(topology, topologic.Wire) or isinstance(topology, topologic.Edge) or isinstance(topology, topologic.Vertex):
6236
+ 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
6237
  return []
6487
6238
  return Topology.SubTopologies(topology=topology, subTopologyType="cell")
6488
6239
 
@@ -6493,7 +6244,7 @@ class Topology():
6493
6244
 
6494
6245
  Parameters
6495
6246
  ----------
6496
- topology : topologic.Topology
6247
+ topology : topologic_core.Topology
6497
6248
  The input topology.
6498
6249
 
6499
6250
  Returns
@@ -6502,7 +6253,7 @@ class Topology():
6502
6253
  The list of cellcomplexes.
6503
6254
 
6504
6255
  """
6505
- if isinstance(topology, topologic.CellComplex) or isinstance(topology, topologic.Cell) or isinstance(topology, topologic.Shell) or isinstance(topology, topologic.Face) or isinstance(topology, topologic.Wire) or isinstance(topology, topologic.Edge) or isinstance(topology, topologic.Vertex):
6256
+ 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
6257
  return []
6507
6258
  return Topology.SubTopologies(topology=topology, subTopologyType="cellcomplex")
6508
6259
 
@@ -6513,7 +6264,7 @@ class Topology():
6513
6264
 
6514
6265
  Parameters
6515
6266
  ----------
6516
- topology : topologic.Topology
6267
+ topology : topologic_core.Topology
6517
6268
  The input topology.
6518
6269
 
6519
6270
  Returns
@@ -6522,7 +6273,7 @@ class Topology():
6522
6273
  The list of clusters.
6523
6274
 
6524
6275
  """
6525
- if not isinstance(topology, topologic.Cluster):
6276
+ if not Topology.IsInstance(topology, "Cluster"):
6526
6277
  return []
6527
6278
  return Topology.SubTopologies(topology=topology, subTopologyType="cluster")
6528
6279
 
@@ -6533,7 +6284,7 @@ class Topology():
6533
6284
 
6534
6285
  Parameters
6535
6286
  ----------
6536
- topology : topologic.Topology
6287
+ topology : topologic_core.Topology
6537
6288
  The input topology.
6538
6289
  subTopologyType : str , optional
6539
6290
  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 +6295,7 @@ class Topology():
6544
6295
  The list of subtopologies.
6545
6296
 
6546
6297
  """
6547
- if not isinstance(topology, topologic.Topology):
6298
+ if not Topology.IsInstance(topology, "Topology"):
6548
6299
  print("Topology.SubTopologies - Error: the input topology parameter is not a valid topology. Returning None.")
6549
6300
  return None
6550
6301
  if Topology.TypeAsString(topology).lower() == subTopologyType.lower():
@@ -6574,15 +6325,15 @@ class Topology():
6574
6325
 
6575
6326
 
6576
6327
  @staticmethod
6577
- def SuperTopologies(topology, hostTopology, topologyType = None):
6328
+ def SuperTopologies(topology, hostTopology, topologyType: str = None) -> list:
6578
6329
  """
6579
6330
  Returns the supertopologies connected to the input topology.
6580
6331
 
6581
6332
  Parameters
6582
6333
  ----------
6583
- topology : topologic.Topology
6334
+ topology : topologic_core.Topology
6584
6335
  The input topology.
6585
- hostTopology : topologic.Topology
6336
+ hostTopology : topologic_core.Topology
6586
6337
  The host to topology in which to search for ther supertopologies.
6587
6338
  topologyType : str , optional
6588
6339
  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 +6345,35 @@ class Topology():
6594
6345
 
6595
6346
  """
6596
6347
 
6597
- if not isinstance(topology, topologic.Topology):
6348
+ if not Topology.IsInstance(topology, "Topology"):
6598
6349
  print("Topology.SuperTopologies - Error: the input topology parameter is not a valid topology. Returning None.")
6599
6350
  return None
6600
- if not isinstance(hostTopology, topologic.Topology):
6351
+ if not Topology.IsInstance(hostTopology, "Topology"):
6601
6352
  print("Topology.SuperTopologies - Error: the input hostTopology parameter is not a valid topology. Returning None.")
6602
6353
  return None
6603
6354
 
6604
6355
  superTopologies = []
6605
6356
 
6606
- if not topologyType:
6357
+ if topologyType == None:
6607
6358
  typeID = 2*Topology.TypeID(topology)
6608
6359
  else:
6609
6360
  typeID = Topology.TypeID(topologyType)
6610
- if topology.Type() >= typeID:
6361
+ if Topology.Type(topology) >= typeID:
6611
6362
  print("Topology.SuperTopologies - Error: The input topologyType parameter is not a valid type for a super topology of the input topology. Returning None.")
6612
6363
  return None #The user has asked for a topology type lower than the input topology
6613
- elif typeID == topologic.Edge.Type():
6364
+ elif typeID == Topology.TypeID("Edge"):
6614
6365
  topology.Edges(hostTopology, superTopologies)
6615
- elif typeID == topologic.Wire.Type():
6366
+ elif typeID == Topology.TypeID("Wire"):
6616
6367
  topology.Wires(hostTopology, superTopologies)
6617
- elif typeID == topologic.Face.Type():
6368
+ elif typeID == Topology.TypeID("Face"):
6618
6369
  topology.Faces(hostTopology, superTopologies)
6619
- elif typeID == topologic.Shell.Type():
6370
+ elif typeID == Topology.TypeID("Shell"):
6620
6371
  topology.Shells(hostTopology, superTopologies)
6621
- elif typeID == topologic.Cell.Type():
6372
+ elif typeID == Topology.TypeID("Cell"):
6622
6373
  topology.Cells(hostTopology, superTopologies)
6623
- elif typeID == topologic.CellComplex.Type():
6374
+ elif typeID == Topology.TypeID("CellComplex"):
6624
6375
  topology.CellComplexes(hostTopology, superTopologies)
6625
- elif typeID == topologic.Cluster.Type():
6376
+ elif typeID == Topology.TypeID("Cluster"):
6626
6377
  topology.Cluster(hostTopology, superTopologies)
6627
6378
  else:
6628
6379
  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 +6414,8 @@ class Topology():
6663
6414
  if numWorkers == None:
6664
6415
  import multiprocessing
6665
6416
  numWorkers = multiprocessing.cpu_count()*2
6666
- sources = [x for x in sources if isinstance(x, topologic.Topology)]
6667
- sinks = [x for x in sinks if isinstance(x, topologic.Topology)]
6417
+ sources = [x for x in sources if Topology.IsInstance(x, "Topology")]
6418
+ sinks = [x for x in sinks if Topology.IsInstance(x, "Topology")]
6668
6419
  so_dicts = [Dictionary.PythonDictionary(Topology.Dictionary(s)) for s in sources]
6669
6420
  if len(sources) < 1:
6670
6421
  print("Topology.TransferDictionaries - Error: The input sources does not contain any valid topologies. Returning None.")
@@ -6701,7 +6452,7 @@ class Topology():
6701
6452
 
6702
6453
  Parameters
6703
6454
  ----------
6704
- topology : topologic.Topology
6455
+ topology : topologic_core.Topology
6705
6456
  The input topology.
6706
6457
  selectors : list
6707
6458
  The list of input selectors from which to transfer the dictionaries.
@@ -6720,13 +6471,12 @@ class Topology():
6720
6471
 
6721
6472
  Returns
6722
6473
  -------
6723
- topology.Topology
6474
+ Topology
6724
6475
  The input topology with the dictionaries transferred to its subtopologies.
6725
6476
 
6726
6477
  """
6727
- from topologicpy.Vertex import Vertex
6728
- from topologicpy.Dictionary import Dictionary
6729
- if not isinstance(topology, topologic.Topology):
6478
+
6479
+ if not Topology.IsInstance(topology, "Topology"):
6730
6480
  print("Topology.TransferDictionariesBySelectors - Error: The input topology parameter is not a valid topology. Returning None.")
6731
6481
  return None
6732
6482
  if not isinstance(selectors, list):
@@ -6735,7 +6485,7 @@ class Topology():
6735
6485
  if numWorkers == None:
6736
6486
  import multiprocessing
6737
6487
  numWorkers = multiprocessing.cpu_count()*2
6738
- selectors_tmp = [x for x in selectors if isinstance(x, topologic.Vertex)]
6488
+ selectors_tmp = [x for x in selectors if Topology.IsInstance(x, "Vertex")]
6739
6489
  if len(selectors_tmp) < 1:
6740
6490
  print("Topology.TransferDictionariesBySelectors - Error: The input selectors do not contain any valid topologies. Returning None.")
6741
6491
  return None
@@ -6745,30 +6495,30 @@ class Topology():
6745
6495
  hidimSink = Topology.HighestType(topology)
6746
6496
  if tranVertices == True:
6747
6497
  sinkVertices = []
6748
- if topology.Type() == topologic.Vertex.Type():
6498
+ if Topology.Type(topology) == Topology.TypeID("Vertex"):
6749
6499
  sinkVertices.append(topology)
6750
- elif hidimSink >= topologic.Vertex.Type():
6500
+ elif hidimSink >= Topology.TypeID("Vertex"):
6751
6501
  topology.Vertices(None, sinkVertices)
6752
6502
  _ = Topology.TransferDictionaries(selectors, sinkVertices, tolerance=tolerance, numWorkers=numWorkers)
6753
6503
  if tranEdges == True:
6754
6504
  sinkEdges = []
6755
- if topology.Type() == topologic.Edge.Type():
6505
+ if Topology.Type(topology) == Topology.TypeID("Edge"):
6756
6506
  sinkEdges.append(topology)
6757
- elif hidimSink >= topologic.Edge.Type():
6507
+ elif hidimSink >= Topology.TypeID("Edge"):
6758
6508
  topology.Edges(None, sinkEdges)
6759
6509
  _ = Topology.TransferDictionaries(selectors, sinkEdges, tolerance=tolerance, numWorkers=numWorkers)
6760
6510
  if tranFaces == True:
6761
6511
  sinkFaces = []
6762
- if topology.Type() == topologic.Face.Type():
6512
+ if Topology.Type(topology) == Topology.TypeID("Face"):
6763
6513
  sinkFaces.append(topology)
6764
- elif hidimSink >= topologic.Face.Type():
6514
+ elif hidimSink >= Topology.TypeID("Face"):
6765
6515
  topology.Faces(None, sinkFaces)
6766
6516
  _ = Topology.TransferDictionaries(selectors, sinkFaces, tolerance=tolerance, numWorkers=numWorkers)
6767
6517
  if tranCells == True:
6768
6518
  sinkCells = []
6769
- if topology.Type() == topologic.Cell.Type():
6519
+ if Topology.Type(topology) == Topology.TypeID("Cell"):
6770
6520
  sinkCells.append(topology)
6771
- elif hidimSink >= topologic.Cell.Type():
6521
+ elif hidimSink >= Topology.TypeID("Cell"):
6772
6522
  topology.Cells(None, sinkCells)
6773
6523
  _ = Topology.TransferDictionaries(selectors, sinkCells, tolerance=tolerance, numWorkers=numWorkers)
6774
6524
  return topology
@@ -6781,14 +6531,14 @@ class Topology():
6781
6531
 
6782
6532
  Parameters
6783
6533
  ----------
6784
- topology : topologic.Topology
6534
+ topology : topologic_core.Topology
6785
6535
  The input topology.
6786
6536
  matrix : list
6787
6537
  The input 4x4 transformation matrix.
6788
6538
 
6789
6539
  Returns
6790
6540
  -------
6791
- topologic.Topology
6541
+ topologic_core.Topology
6792
6542
  The transformed topology.
6793
6543
 
6794
6544
  """
@@ -6805,9 +6555,7 @@ class Topology():
6805
6555
  kRotation32 = 0.0
6806
6556
  kRotation33 = 1.0
6807
6557
 
6808
- kTranslationX = matrix[0][3]
6809
- kTranslationY = matrix[1][3]
6810
- kTranslationZ = matrix[2][3]
6558
+
6811
6559
  kRotation11 = matrix[0][0]
6812
6560
  kRotation12 = matrix[0][1]
6813
6561
  kRotation13 = matrix[0][2]
@@ -6817,6 +6565,9 @@ class Topology():
6817
6565
  kRotation31 = matrix[2][0]
6818
6566
  kRotation32 = matrix[2][1]
6819
6567
  kRotation33 = matrix[2][2]
6568
+ kTranslationX = matrix[3][0]
6569
+ kTranslationY = matrix[3][1]
6570
+ kTranslationZ = matrix[3][2]
6820
6571
 
6821
6572
  return topologic.TopologyUtility.Transform(topology, kTranslationX, kTranslationY, kTranslationZ, kRotation11, kRotation12, kRotation13, kRotation21, kRotation22, kRotation23, kRotation31, kRotation32, kRotation33)
6822
6573
 
@@ -6827,7 +6578,7 @@ class Topology():
6827
6578
 
6828
6579
  Parameters
6829
6580
  ----------
6830
- topology : topologic.topology
6581
+ topology : topologic_core.topology
6831
6582
  The input topology.
6832
6583
  x : float , optional
6833
6584
  The x translation value. The default is 0.
@@ -6838,11 +6589,11 @@ class Topology():
6838
6589
 
6839
6590
  Returns
6840
6591
  -------
6841
- topologic.Topology
6592
+ topologic_core.Topology
6842
6593
  The translated topology.
6843
6594
 
6844
6595
  """
6845
- if not isinstance(topology, topologic.Topology):
6596
+ if not Topology.IsInstance(topology, "Topology"):
6846
6597
  print("Topology.Translate - Error: The input topology parameter is not a valid topology. Returning None.")
6847
6598
  return None
6848
6599
  try:
@@ -6857,7 +6608,7 @@ class Topology():
6857
6608
 
6858
6609
  Parameters
6859
6610
  ----------
6860
- topology : topologic.topology
6611
+ topology : topologic_core.topology
6861
6612
  The input topology.
6862
6613
  direction : list , optional
6863
6614
  The direction vector in which the topology should be moved. The default is [0, 0, 0]
@@ -6866,12 +6617,12 @@ class Topology():
6866
6617
 
6867
6618
  Returns
6868
6619
  -------
6869
- topologic.Topology
6620
+ topologic_core.Topology
6870
6621
  The translated topology.
6871
6622
 
6872
6623
  """
6873
6624
  from topologicpy.Vector import Vector
6874
- if not isinstance(topology, topologic.Topology):
6625
+ if not Topology.IsInstance(topology, "Topology"):
6875
6626
  print("Topology.TranslateByDirectionDistance - Error: The input topology parameter is not a valid topology. Returning None.")
6876
6627
  return None
6877
6628
  v = Vector.SetMagnitude(direction, distance)
@@ -6885,7 +6636,7 @@ class Topology():
6885
6636
 
6886
6637
  Parameters
6887
6638
  ----------
6888
- topology : topologic.Topology
6639
+ topology : topologic_core.Topology
6889
6640
  The input topologgy.
6890
6641
  transferDictionaries : bool , optional
6891
6642
  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 +6660,7 @@ class Topology():
6909
6660
 
6910
6661
  Returns
6911
6662
  -------
6912
- topologic.Topology
6663
+ topologic_core.Topology
6913
6664
  The triangulated topology.
6914
6665
 
6915
6666
  """
@@ -6919,13 +6670,13 @@ class Topology():
6919
6670
  from topologicpy.CellComplex import CellComplex
6920
6671
  from topologicpy.Cluster import Cluster
6921
6672
 
6922
- if not isinstance(topology, topologic.Topology):
6673
+ if not Topology.IsInstance(topology, "Topology"):
6923
6674
  print("Topology.Triangulate - Error: The input parameter is not a valid topology. Returning None.")
6924
6675
  return None
6925
- t = topology.Type()
6926
- if (t == 1) or (t == 2) or (t == 4):
6676
+ t = Topology.Type(topology)
6677
+ if (t == Topology.TypeID("Vertex")) or (t == Topology.TypeID("Edge")) or (t == Topology.TypeID("Wire")):
6927
6678
  return topology
6928
- elif t == 128:
6679
+ elif t == Topology.TypeID("Cluster"):
6929
6680
  temp_topologies = []
6930
6681
  cellComplexes = Topology.SubTopologies(topology, subTopologyType="cellcomplex") or []
6931
6682
  for cc in cellComplexes:
@@ -6956,15 +6707,15 @@ class Topology():
6956
6707
  if transferDictionaries:
6957
6708
  selectors.append(Topology.SetDictionary(Face.Centroid(triFace), Topology.Dictionary(aFace)))
6958
6709
  faceTriangles.append(triFace)
6959
- if t == 8 or t == 16: # Face or Shell
6710
+ if t == Topology.TypeID("Face") or t == Topology.TypeID("Shell"): # Face or Shell
6960
6711
  return_topology = Shell.ByFaces(faceTriangles, tolerance=tolerance)
6961
6712
  if transferDictionaries and not return_topology == None:
6962
6713
  return_topology = Topology.TransferDictionariesBySelectors(return_topology, selectors, tranFaces=True, tolerance=tolerance)
6963
- elif t == 32: # Cell
6714
+ elif t == Topology.TypeID("Cell"): # Cell
6964
6715
  return_topology = Cell.ByFaces(faceTriangles, tolerance=tolerance)
6965
6716
  if transferDictionaries and not return_topology == None:
6966
6717
  return_topology = Topology.TransferDictionariesBySelectors(return_topology, selectors, tranFaces=True, tolerance=tolerance)
6967
- elif t == 64: #CellComplex
6718
+ elif t == Topology.TypeID("CellComplex"): #CellComplex
6968
6719
  return_topology = CellComplex.ByFaces(faceTriangles, tolerance=tolerance)
6969
6720
  if transferDictionaries and not return_topology == None:
6970
6721
  return_topology = Topology.TransferDictionariesBySelectors(return_topology, selectors, tranFaces=True, tolerance=tolerance)
@@ -6984,7 +6735,7 @@ class Topology():
6984
6735
 
6985
6736
  Parameters
6986
6737
  ----------
6987
- topology : topologic.Topology
6738
+ topology : topologic_core.Topology
6988
6739
  The input topology.
6989
6740
 
6990
6741
  Returns
@@ -6993,9 +6744,9 @@ class Topology():
6993
6744
  The type of the input topology.
6994
6745
 
6995
6746
  """
6996
- if not isinstance(topology, topologic.Topology):
6997
- print("Topology.Type - Error: The input topology parameter is not a valid topology. Returning None.")
6998
- return None
6747
+ #if not Topology.IsInstance(topology, "Topology"):
6748
+ #print("Topology.Type - Error: The input topology parameter is not a valid topology. Returning None.")
6749
+ #return None
6999
6750
  return topology.Type()
7000
6751
 
7001
6752
  @staticmethod
@@ -7005,7 +6756,7 @@ class Topology():
7005
6756
 
7006
6757
  Parameters
7007
6758
  ----------
7008
- topology : topologic.Topology
6759
+ topology : topologic_core.Topology
7009
6760
  The input topology.
7010
6761
 
7011
6762
  Returns
@@ -7014,20 +6765,35 @@ class Topology():
7014
6765
  The type of the topology as a string.
7015
6766
 
7016
6767
  """
7017
- if not isinstance(topology, topologic.Topology):
6768
+ if not Topology.IsInstance(topology, "Topology"):
7018
6769
  print("Topology.TypeAsString - Error: The input topology parameter is not a valid topology. Returning None.")
7019
6770
  return None
7020
6771
  return topology.GetTypeAsString()
7021
6772
 
7022
6773
  @staticmethod
7023
- def TypeID(topologyType=None):
6774
+ def TypeID(name : str = None) -> int:
7024
6775
  """
7025
- Returns the type id of the input topologyType string.
6776
+ Returns the type id of the input name string.
7026
6777
 
7027
6778
  Parameters
7028
6779
  ----------
7029
- topologyType : str , optional
7030
- The input topology type string. This could be one of "vertex", "edge", "wire", "face", "shell", "cell", "cellcomplex", "cluster". It is case insensitive. The default is None.
6780
+ name : str , optional
6781
+ The input class name string. This could be one of:
6782
+ "vertex",
6783
+ "edge",
6784
+ "wire",
6785
+ "face",
6786
+ "shell",
6787
+ "cell",
6788
+ "cellcomplex",
6789
+ "cluster",
6790
+ "aperture",
6791
+ "context",
6792
+ "dictionary",
6793
+ "graph",
6794
+ "topology"
6795
+
6796
+ It is case insensitive. The default is None.
7031
6797
 
7032
6798
  Returns
7033
6799
  -------
@@ -7036,28 +6802,41 @@ class Topology():
7036
6802
 
7037
6803
  """
7038
6804
 
7039
- if not isinstance(topologyType, str):
6805
+ if not isinstance(name, str):
7040
6806
  print("Topology.TypeID - Error: The input topologyType parameter is not a valid string. Returning None.")
7041
6807
  return None
7042
- topologyType = topologyType.lower()
7043
- if not topologyType in ["vertex", "edge", "wire", "face", "shell", "cell", "cellcomplex", "cluster"]:
7044
- print("Topology.TypeID - Error: The input topologyType parameter is not a recognized string. Returning None.")
6808
+ name = name.lower()
6809
+ if not name in ["vertex", "edge", "wire",
6810
+ "face", "shell", "cell",
6811
+ "cellcomplex", "cluster", "aperture",
6812
+ "context", "dictionary", "graph", "topology"]:
6813
+ print("Topology.TypeID - Error: The input name parameter is not a recognized string. Returning None.")
7045
6814
  return None
7046
6815
  typeID = None
7047
- if topologyType == "vertex":
7048
- typeID = topologic.Vertex.Type()
7049
- elif topologyType == "edge":
7050
- typeID = topologic.Edge.Type()
7051
- elif topologyType == "wire":
7052
- typeID = topologic.Wire.Type()
7053
- elif topologyType == "face":
7054
- typeID = topologic.Face.Type()
7055
- elif topologyType == "shell":
7056
- typeID = topologic.Shell.Type()
7057
- elif topologyType == "cell":
7058
- typeID = topologic.Cell.Type()
7059
- elif topologyType == "cellComplex":
7060
- typeID = topologic.CellComplex.Type()
7061
- elif topologyType == "cluster":
7062
- typeID = topologic.Cluster.Type()
6816
+ if name == "vertex":
6817
+ typeID = 1
6818
+ elif name == "edge":
6819
+ typeID = 2
6820
+ elif name == "wire":
6821
+ typeID = 4
6822
+ elif name == "face":
6823
+ typeID = 8
6824
+ elif name == "shell":
6825
+ typeID = 16
6826
+ elif name == "cell":
6827
+ typeID = 32
6828
+ elif name == "cellComplex":
6829
+ typeID = 64
6830
+ elif name == "cluster":
6831
+ typeID = 128
6832
+ elif name == "aperture":
6833
+ typeID = 256
6834
+ elif name == "context":
6835
+ typeID = 512
6836
+ elif name == "dictionary":
6837
+ typeID = 1024
6838
+ elif name == "graph":
6839
+ typeID = 2048
6840
+ elif name == "topology":
6841
+ typeID = 4096
7063
6842
  return typeID