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/Shell.py CHANGED
@@ -15,7 +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.Topology import Topology
19
18
  import math
20
19
  import os
21
20
  import warnings
@@ -49,7 +48,7 @@ except:
49
48
  except:
50
49
  warnings.warn("Shell - Error: Could not import scipy.")
51
50
 
52
- class Shell(Topology):
51
+ class Shell():
53
52
  @staticmethod
54
53
  def ByDisjointFaces(externalBoundary, faces, maximumGap=0.5, mergeJunctions=False, threshold=0.5, uSides=1, vSides=1, transferDictionaries=False, tolerance=0.0001):
55
54
  """
@@ -57,7 +56,7 @@ class Shell(Topology):
57
56
 
58
57
  Parameters
59
58
  ----------
60
- externalBoundary : topologic.Face
59
+ externalBoundary : topologic_core.Face
61
60
  The input external boundary of the faces. This resembles a ribbon (face with hole) where its interior boundary touches the edges of the input list of faces.
62
61
  faces : list
63
62
  The input list of faces.
@@ -78,7 +77,7 @@ class Shell(Topology):
78
77
 
79
78
  Returns
80
79
  -------
81
- topologic.Shell
80
+ topologic_core.Shell
82
81
  The created Shell.
83
82
 
84
83
  """
@@ -160,7 +159,7 @@ class Shell(Topology):
160
159
  if len(skeletons) > 0:
161
160
  skeleton_cluster = Cluster.ByTopologies(skeletons+[internalBoundary])
162
161
  skEdges = Topology.SelfMerge(Cluster.ByTopologies(removeShards(Topology.Edges(skeleton_cluster), skeleton_cluster, maximumGap=maximumGap)), tolerance=tolerance)
163
- if isinstance(skEdges, topologic.Edge):
162
+ if Topology.IsInstance(skEdges, "Edge"):
164
163
  skEdges = extendEdges([skEdges], skEdges, maximumGap=maximumGap)
165
164
  else:
166
165
  skEdges = extendEdges(Topology.Edges(skEdges), skEdges, maximumGap=maximumGap)
@@ -240,7 +239,7 @@ class Shell(Topology):
240
239
  cluster = Cluster.ByTopologies(new_edges)
241
240
  eb = Face.ByWire(Shell.ExternalBoundary(shell), tolerance=tolerance)
242
241
  shell = Topology.Slice(eb, cluster, tolerance=tolerance)
243
- if not isinstance(shell, topologic.Shell):
242
+ if not Topology.IsInstance(shell, "Shell"):
244
243
  try:
245
244
  temp_wires = [Wire.RemoveCollinearEdges(w, angTolerance=1.0) for w in Topology.Wires(shell)]
246
245
  temp_faces = [Face.ByWire(w, tolerance=tolerance) for w in temp_wires]
@@ -259,7 +258,7 @@ class Shell(Topology):
259
258
  return None
260
259
 
261
260
  @staticmethod
262
- def ByFaces(faces: list, tolerance: float = 0.0001) -> topologic.Shell:
261
+ def ByFaces(faces: list, tolerance: float = 0.0001):
263
262
  """
264
263
  Creates a shell from the input list of faces.
265
264
 
@@ -272,7 +271,7 @@ class Shell(Topology):
272
271
 
273
272
  Returns
274
273
  -------
275
- topologic.Shell
274
+ topologic_core.Shell
276
275
  The created Shell.
277
276
 
278
277
  """
@@ -280,14 +279,14 @@ class Shell(Topology):
280
279
 
281
280
  if not isinstance(faces, list):
282
281
  return None
283
- faceList = [x for x in faces if isinstance(x, topologic.Face)]
282
+ faceList = [x for x in faces if Topology.IsInstance(x, "Face")]
284
283
  if len(faceList) == 0:
285
284
  print("Shell.ByFaces - Error: The input faces list does not contain any valid faces. Returning None.")
286
285
  return None
287
- shell = topologic.Shell.ByFaces(faceList, tolerance)
288
- if not isinstance(shell, topologic.Shell):
286
+ shell = topologic.Shell.ByFaces(faceList, tolerance) # Hook to Core
287
+ if not Topology.IsInstance(shell, "Shell"):
289
288
  shell = Topology.SelfMerge(shell, tolerance=tolerance)
290
- if isinstance(shell, topologic.Shell):
289
+ if Topology.IsInstance(shell, "Shell"):
291
290
  return shell
292
291
  else:
293
292
  print("Shell.ByFaces - Error: Could not create shell. Returning None.")
@@ -296,31 +295,33 @@ class Shell(Topology):
296
295
  return shell
297
296
 
298
297
  @staticmethod
299
- def ByFacesCluster(cluster: topologic.Cluster, tolerance: float = 0.0001) -> topologic.Shell:
298
+ def ByFacesCluster(cluster, tolerance: float = 0.0001):
300
299
  """
301
300
  Creates a shell from the input cluster of faces.
302
301
 
303
302
  Parameters
304
303
  ----------
305
- cluster : topologic.Cluster
304
+ cluster : topologic_core.Cluster
306
305
  The input cluster of faces.
307
306
  tolerance : float , optional
308
307
  The desired tolerance. The default is 0.0001.
309
308
 
310
309
  Returns
311
310
  -------
312
- topologic.Shell
311
+ topologic_core.Shell
313
312
  The created shell.
314
313
 
315
314
  """
316
- if not isinstance(cluster, topologic.Cluster):
315
+ from topologicpy.Topology import Topology
316
+
317
+ if not Topology.IsInstance(cluster, "Cluster"):
317
318
  return None
318
319
  faces = []
319
320
  _ = cluster.Faces(None, faces)
320
321
  return Shell.ByFaces(faces, tolerance=tolerance)
321
322
 
322
323
  @staticmethod
323
- def ByWires(wires: list, triangulate: bool = True, tolerance: float = 0.0001, silent: bool = False) -> topologic.Shell:
324
+ def ByWires(wires: list, triangulate: bool = True, tolerance: float = 0.0001, silent: bool = False):
324
325
  """
325
326
  Creates a shell by lofting through the input wires
326
327
  Parameters
@@ -336,31 +337,31 @@ class Shell(Topology):
336
337
 
337
338
  Returns
338
339
  -------
339
- topologic.Shell
340
+ topologic_core.Shell
340
341
  The creates shell.
341
342
  """
342
343
  from topologicpy.Edge import Edge
343
344
  from topologicpy.Wire import Wire
344
345
  from topologicpy.Face import Face
346
+ from topologicpy.Topology import Topology
347
+
345
348
  if not isinstance(wires, list):
346
349
  return None
347
- wireList = [x for x in wires if isinstance(x, topologic.Wire)]
350
+ wireList = [x for x in wires if Topology.IsInstance(x, "Wire")]
348
351
  faces = []
349
352
  for i in range(len(wireList)-1):
350
353
  wire1 = wireList[i]
351
354
  wire2 = wireList[i+1]
352
- if wire1.Type() < topologic.Edge.Type() or wire2.Type() < topologic.Edge.Type():
355
+ if Topology.Type(wire1) < Topology.TypeID("Edge") or Topology.Type(wire2) < Topology.TypeID("Edge"):
353
356
  return None
354
- if wire1.Type() == topologic.Edge.Type():
357
+ if Topology.Type(wire1) == Topology.TypeID("Edge"):
355
358
  w1_edges = [wire1]
356
359
  else:
357
- w1_edges = []
358
- _ = wire1.Edges(None, w1_edges)
359
- if wire2.Type() == topologic.Edge.Type():
360
+ w1_edges = Topology.Edges(wire1)
361
+ if Topology.Type(wire2) == Topology.TypeID("Edge"):
360
362
  w2_edges = [wire2]
361
363
  else:
362
- w2_edges = []
363
- _ = wire2.Edges(None, w2_edges)
364
+ w2_edges = Topology.Edges(wire2)
364
365
  if len(w1_edges) != len(w2_edges):
365
366
  return None
366
367
  if triangulate == True:
@@ -415,13 +416,13 @@ class Shell(Topology):
415
416
  return Shell.ByFaces(faces, tolerance=tolerance)
416
417
 
417
418
  @staticmethod
418
- def ByWiresCluster(cluster: topologic.Cluster, triangulate: bool = True, tolerance: float = 0.0001, silent: bool = False) -> topologic.Shell:
419
+ def ByWiresCluster(cluster, triangulate: bool = True, tolerance: float = 0.0001, silent: bool = False):
419
420
  """
420
421
  Creates a shell by lofting through the input cluster of wires
421
422
 
422
423
  Parameters
423
424
  ----------
424
- wires : topologic.Cluster
425
+ wires : topologic_core.Cluster
425
426
  The input cluster of wires.
426
427
  triangulate : bool , optional
427
428
  If set to True, the faces will be triangulated. The default is True.
@@ -432,26 +433,28 @@ class Shell(Topology):
432
433
 
433
434
  Returns
434
435
  -------
435
- topologic.Shell
436
+ topologic_core.Shell
436
437
  The creates shell.
437
438
 
438
439
  """
439
440
  from topologicpy.Cluster import Cluster
441
+ from topologicpy.Topology import Topology
442
+
440
443
  if not cluster:
441
444
  return None
442
- if not isinstance(cluster, topologic.Cluster):
445
+ if not Topology.IsInstance(cluster, "Cluster"):
443
446
  return None
444
447
  wires = Cluster.Wires(cluster)
445
448
  return Shell.ByWires(wires, triangulate=triangulate, tolerance=tolerance, silent=silent)
446
449
 
447
450
  @staticmethod
448
- def Circle(origin: topologic.Vertex = None, radius: float = 0.5, sides: int = 32, fromAngle: float = 0.0, toAngle: float = 360.0, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
451
+ def Circle(origin= None, radius: float = 0.5, sides: int = 32, fromAngle: float = 0.0, toAngle: float = 360.0, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001):
449
452
  """
450
453
  Creates a circle.
451
454
 
452
455
  Parameters
453
456
  ----------
454
- origin : topologic.Vertex , optional
457
+ origin : topologic_core.Vertex , optional
455
458
  The location of the origin of the circle. The default is None which results in the circle being placed at (0, 0, 0).
456
459
  radius : float , optional
457
460
  The radius of the circle. The default is 0.5.
@@ -470,13 +473,13 @@ class Shell(Topology):
470
473
 
471
474
  Returns
472
475
  -------
473
- topologic.Shell
476
+ topologic_core.Shell
474
477
  The created circle.
475
478
  """
476
479
  return Shell.Pie(origin=origin, radiusA=radius, radiusB=0, sides=sides, rings=1, fromAngle=fromAngle, toAngle=toAngle, direction=direction, placement=placement, tolerance=tolerance)
477
480
 
478
481
  @staticmethod
479
- def Delaunay(vertices: list, face: topologic.Face = None, tolerance: float = 0.0001) -> topologic.Shell:
482
+ def Delaunay(vertices: list, face= None, tolerance: float = 0.0001):
480
483
  """
481
484
  Returns a delaunay partitioning of the input vertices. The vertices must be coplanar. See https://en.wikipedia.org/wiki/Delaunay_triangulation.
482
485
 
@@ -484,7 +487,7 @@ class Shell(Topology):
484
487
  ----------
485
488
  vertices : list
486
489
  The input list of vertices.
487
- face : topologic.Face , optional
490
+ face : topologic_core.Face , optional
488
491
  The input face. If specified, the delaunay triangulation is clipped to the face.
489
492
  tolerance : float , optional
490
493
  The desired tolerance. The default is 0.0001.
@@ -507,14 +510,14 @@ class Shell(Topology):
507
510
 
508
511
  if not isinstance(vertices, list):
509
512
  return None
510
- vertices = [x for x in vertices if isinstance(x, topologic.Vertex)]
513
+ vertices = [x for x in vertices if Topology.IsInstance(x, "Vertex")]
511
514
  if len(vertices) < 3:
512
515
  return None
513
516
 
514
517
  # Create a Vertex at the world's origin (0, 0, 0)
515
518
  world_origin = Vertex.Origin()
516
519
 
517
- if isinstance(face, topologic.Face):
520
+ if Topology.IsInstance(face, "Face"):
518
521
  # Flatten the face
519
522
  origin = Topology.Centroid(face)
520
523
  normal = Face.Normal(face)
@@ -548,7 +551,7 @@ class Shell(Topology):
548
551
  if shell == None:
549
552
  shell = Cluster.ByTopologies(faces)
550
553
 
551
- if isinstance(face, topologic.Face):
554
+ if Topology.IsInstance(face, "Face"):
552
555
  edges = Topology.Edges(shell)
553
556
  shell = Topology.Slice(flatFace, Cluster.ByTopologies(edges))
554
557
  # Get the internal boundaries of the face
@@ -562,13 +565,13 @@ class Shell(Topology):
562
565
  return shell
563
566
 
564
567
  @staticmethod
565
- def Edges(shell: topologic.Shell) -> list:
568
+ def Edges(shell) -> list:
566
569
  """
567
570
  Returns the edges of the input shell.
568
571
 
569
572
  Parameters
570
573
  ----------
571
- shell : topologic.Shell
574
+ shell : topologic_core.Shell
572
575
  The input shell.
573
576
 
574
577
  Returns
@@ -576,36 +579,37 @@ class Shell(Topology):
576
579
  list
577
580
  The list of edges.
578
581
 
579
- """
580
- if not isinstance(shell, topologic.Shell):
582
+ """
583
+ from topologicpy.Topology import Topology
584
+
585
+ if not Topology.IsInstance(shell, "Shell"):
581
586
  return None
582
587
  edges = []
583
588
  _ = shell.Edges(None, edges)
584
589
  return edges
585
590
 
586
591
  @staticmethod
587
- def ExternalBoundary(shell: topologic.Shell, tolerance: float = 0.0001) -> topologic.Wire:
592
+ def ExternalBoundary(shell, tolerance: float = 0.0001):
588
593
  """
589
594
  Returns the external boundary of the input shell.
590
595
 
591
596
  Parameters
592
597
  ----------
593
- shell : topologic.Shell
598
+ shell : topologic_core.Shell
594
599
  The input shell.
595
600
  tolerance : float , optional
596
601
  The desired tolerance. The default is 0.0001.
597
602
 
598
603
  Returns
599
604
  -------
600
- topologic.Wire or topologic.Cluster
605
+ topologic_core.Wire or topologic_core.Cluster
601
606
  The external boundary of the input shell. If the shell has holes, the return value will be a cluster of wires.
602
607
 
603
608
  """
604
- from topologicpy.Wire import Wire
605
609
  from topologicpy.Cluster import Cluster
606
610
  from topologicpy.Topology import Topology
607
611
 
608
- if not isinstance(shell, topologic.Shell):
612
+ if not Topology.IsInstance(shell, "Shell"):
609
613
  return None
610
614
  edges = []
611
615
  _ = shell.Edges(None, edges)
@@ -618,13 +622,13 @@ class Shell(Topology):
618
622
  return Topology.SelfMerge(Cluster.ByTopologies(obEdges), tolerance=tolerance)
619
623
 
620
624
  @staticmethod
621
- def Faces(shell: topologic.Shell) -> list:
625
+ def Faces(shell) -> list:
622
626
  """
623
627
  Returns the faces of the input shell.
624
628
 
625
629
  Parameters
626
630
  ----------
627
- shell : topologic.Shell
631
+ shell : topologic_core.Shell
628
632
  The input shell.
629
633
 
630
634
  Returns
@@ -633,22 +637,24 @@ class Shell(Topology):
633
637
  The list of faces.
634
638
 
635
639
  """
636
- if not isinstance(shell, topologic.Shell):
640
+ from topologicpy.Topology import Topology
641
+
642
+ if not Topology.IsInstance(shell, "Shell"):
637
643
  return None
638
644
  faces = []
639
645
  _ = shell.Faces(None, faces)
640
646
  return faces
641
647
 
642
648
  @staticmethod
643
- def IsOnBoundary(shell: topologic.Shell, vertex: topologic.Vertex, tolerance: float = 0.0001) -> bool:
649
+ def IsOnBoundary(shell, vertex, tolerance: float = 0.0001) -> bool:
644
650
  """
645
651
  Returns True if the input vertex is on the boundary of the input shell. Returns False otherwise. On the boundary is defined as being on the boundary of one of the shell's external or internal boundaries
646
652
 
647
653
  Parameters
648
654
  ----------
649
- shell : topologic.Shell
655
+ shell : topologic_core.Shell
650
656
  The input shell.
651
- vertex : topologic.Vertex
657
+ vertex : topologic_core.Vertex
652
658
  The input vertex.
653
659
  tolerance : float , optional
654
660
  The desired tolerance. The default is 0.0001.
@@ -659,12 +665,12 @@ class Shell(Topology):
659
665
  Returns True if the input vertex is inside the input shell. Returns False otherwise.
660
666
 
661
667
  """
662
-
663
668
  from topologicpy.Vertex import Vertex
669
+ from topologicpy.Topology import Topology
664
670
 
665
- if not isinstance(shell, topologic.Shell):
671
+ if not Topology.IsInstance(shell, "Shell"):
666
672
  return None
667
- if not isinstance(vertex, topologic.Vertex):
673
+ if not Topology.IsInstance(vertex, "Vertex"):
668
674
  return None
669
675
  boundary = Shell.ExternalBoundary(shell, tolerance=tolerance)
670
676
  if Vertex.IsInternal(vertex, boundary, tolerance=tolerance):
@@ -676,22 +682,22 @@ class Shell(Topology):
676
682
  return False
677
683
 
678
684
  @staticmethod
679
- def HyperbolicParaboloidRectangularDomain(origin: topologic.Vertex = None, llVertex: topologic.Vertex = None, lrVertex: topologic.Vertex =None, ulVertex: topologic.Vertex =None, urVertex: topologic.Vertex = None,
680
- uSides: int = 10, vSides: int = 10, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
685
+ def HyperbolicParaboloidRectangularDomain(origin= None, llVertex= None, lrVertex= None, ulVertex= None, urVertex= None,
686
+ uSides: int = 10, vSides: int = 10, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001):
681
687
  """
682
688
  Creates a hyperbolic paraboloid with a rectangular domain.
683
689
 
684
690
  Parameters
685
691
  ----------
686
- origin : topologic.Vertex , optional
692
+ origin : topologic_core.Vertex , optional
687
693
  The origin of the hyperbolic parabolid. If set to None, it will be placed at the (0, 0, 0) origin. The default is None.
688
- llVertex : topologic.Vertex , optional
694
+ llVertex : topologic_core.Vertex , optional
689
695
  The lower left corner of the hyperbolic parabolid. If set to None, it will be set to (-0.5, -0.5, -0.5).
690
- lrVertex : topologic.Vertex , optional
696
+ lrVertex : topologic_core.Vertex , optional
691
697
  The lower right corner of the hyperbolic parabolid. If set to None, it will be set to (0.5, -0.5, 0.5).
692
- ulVertex : topologic.Vertex , optional
698
+ ulVertex : topologic_core.Vertex , optional
693
699
  The upper left corner of the hyperbolic parabolid. If set to None, it will be set to (-0.5, 0.5, 0.5).
694
- urVertex : topologic.Vertex , optional
700
+ urVertex : topologic_core.Vertex , optional
695
701
  The upper right corner of the hyperbolic parabolid. If set to None, it will be set to (0.5, 0.5, -0.5).
696
702
  uSides : int , optional
697
703
  The number of segments along the X axis. The default is 10.
@@ -705,7 +711,7 @@ class Shell(Topology):
705
711
  The desired tolerance. The default is 0.0001.
706
712
  Returns
707
713
  -------
708
- topologic.Shell
714
+ topologic_core.Shell
709
715
  The created hyperbolic paraboloid.
710
716
 
711
717
  """
@@ -713,15 +719,15 @@ class Shell(Topology):
713
719
  from topologicpy.Edge import Edge
714
720
  from topologicpy.Face import Face
715
721
  from topologicpy.Topology import Topology
716
- if not isinstance(origin, topologic.Vertex):
722
+ if not Topology.IsInstance(origin, "Vertex"):
717
723
  origin = Vertex.ByCoordinates(0, 0, 0)
718
- if not isinstance(llVertex, topologic.Vertex):
724
+ if not Topology.IsInstance(llVertex, "Vertex"):
719
725
  llVertex = Vertex.ByCoordinates(-0.5, -0.5, -0.5)
720
- if not isinstance(lrVertex, topologic.Vertex):
726
+ if not Topology.IsInstance(lrVertex, "Vertex"):
721
727
  lrVertex = Vertex.ByCoordinates(0.5, -0.5, 0.5)
722
- if not isinstance(ulVertex, topologic.Vertex):
728
+ if not Topology.IsInstance(ulVertex, "Vertex"):
723
729
  ulVertex = Vertex.ByCoordinates(-0.5, 0.5, 0.5)
724
- if not isinstance(urVertex, topologic.Vertex):
730
+ if not Topology.IsInstance(urVertex, "Vertex"):
725
731
  urVertex = Vertex.ByCoordinates(0.5, 0.5, -0.5)
726
732
  e1 = Edge.ByVertices([llVertex, lrVertex], tolerance=tolerance)
727
733
  e3 = Edge.ByVertices([urVertex, ulVertex], tolerance=tolerance)
@@ -769,15 +775,15 @@ class Shell(Topology):
769
775
  return returnTopology
770
776
 
771
777
  @staticmethod
772
- def HyperbolicParaboloidCircularDomain(origin: topologic.Vertex = None, radius: float = 0.5, sides: int = 36, rings: int = 10,
778
+ def HyperbolicParaboloidCircularDomain(origin= None, radius: float = 0.5, sides: int = 36, rings: int = 10,
773
779
  A: float = 2.0, B: float = -2.0, direction: list = [0, 0, 1],
774
- placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
780
+ placement: str = "center", tolerance: float = 0.0001):
775
781
  """
776
782
  Creates a hyperbolic paraboloid with a circular domain. See https://en.wikipedia.org/wiki/Compactness_measure_of_a_shape
777
783
 
778
784
  Parameters
779
785
  ----------
780
- origin : topologic.Vertex , optional
786
+ origin : topologic_core.Vertex , optional
781
787
  The origin of the hyperbolic parabolid. If set to None, it will be placed at the (0, 0, 0) origin. The default is None.
782
788
  radius : float , optional
783
789
  The desired radius of the hyperbolic paraboloid. The default is 0.5.
@@ -797,14 +803,16 @@ class Shell(Topology):
797
803
  The desired tolerance. The default is 0.0001.
798
804
  Returns
799
805
  -------
800
- topologic.Shell
806
+ topologic_core.Shell
801
807
  The created hyperboloic paraboloid.
802
808
 
803
809
  """
804
810
  from topologicpy.Vertex import Vertex
805
811
  from topologicpy.Face import Face
812
+ from topologicpy.Cluster import Cluster
806
813
  from topologicpy.Topology import Topology
807
- if not isinstance(origin, topologic.Vertex):
814
+
815
+ if not Topology.IsInstance(origin, "Vertex"):
808
816
  origin = Vertex.ByCoordinates(0, 0, 0)
809
817
  uOffset = float(360)/float(sides)
810
818
  vOffset = float(radius)/float(rings)
@@ -827,10 +835,10 @@ class Shell(Topology):
827
835
  x4 = math.sin(a2)*r1
828
836
  y4 = math.cos(a2)*r1
829
837
  z4 = A*x4*x4 + B*y4*y4
830
- v1 = topologic.Vertex.ByCoordinates(x1,y1,z1)
831
- v2 = topologic.Vertex.ByCoordinates(x2,y2,z2)
832
- v3 = topologic.Vertex.ByCoordinates(x3,y3,z3)
833
- v4 = topologic.Vertex.ByCoordinates(x4,y4,z4)
838
+ v1 = Vertex.ByCoordinates(x1,y1,z1)
839
+ v2 = Vertex.ByCoordinates(x2,y2,z2)
840
+ v3 = Vertex.ByCoordinates(x3,y3,z3)
841
+ v4 = Vertex.ByCoordinates(x4,y4,z4)
834
842
  f1 = Face.ByVertices([v1,v2,v4])
835
843
  f2 = Face.ByVertices([v4,v2,v3])
836
844
  faces.append(f1)
@@ -849,10 +857,10 @@ class Shell(Topology):
849
857
  x4 = math.sin(a2)*r1
850
858
  y4 = math.cos(a2)*r1
851
859
  z4 = A*x4*x4 + B*y4*y4
852
- v1 = topologic.Vertex.ByCoordinates(x1,y1,z1)
853
- v2 = topologic.Vertex.ByCoordinates(x2,y2,z2)
854
- v3 = topologic.Vertex.ByCoordinates(x3,y3,z3)
855
- v4 = topologic.Vertex.ByCoordinates(x4,y4,z4)
860
+ v1 = Vertex.ByCoordinates(x1,y1,z1)
861
+ v2 = Vertex.ByCoordinates(x2,y2,z2)
862
+ v3 = Vertex.ByCoordinates(x3,y3,z3)
863
+ v4 = Vertex.ByCoordinates(x4,y4,z4)
856
864
  f1 = Face.ByVertices([v1,v2,v4])
857
865
  f2 = Face.ByVertices([v4,v2,v3])
858
866
  faces.append(f1)
@@ -862,7 +870,7 @@ class Shell(Topology):
862
870
  x1 = 0
863
871
  y1 = 0
864
872
  z1 = 0
865
- v1 = topologic.Vertex.ByCoordinates(x1,y1,z1)
873
+ v1 = Vertex.ByCoordinates(x1,y1,z1)
866
874
  for j in range(sides-1):
867
875
  a1 = math.radians(uOffset)*j
868
876
  a2 = math.radians(uOffset)*(j+1)
@@ -874,8 +882,8 @@ class Shell(Topology):
874
882
  y3 = math.cos(a2)*r
875
883
  z3 = A*x3*x3 + B*y3*y3
876
884
  #z3 = 0
877
- v2 = topologic.Vertex.ByCoordinates(x2,y2,z2)
878
- v3 = topologic.Vertex.ByCoordinates(x3,y3,z3)
885
+ v2 = Vertex.ByCoordinates(x2,y2,z2)
886
+ v3 = Vertex.ByCoordinates(x3,y3,z3)
879
887
  f1 = Face.ByVertices([v2,v1,v3])
880
888
  faces.append(f1)
881
889
  a1 = math.radians(uOffset)*(sides-1)
@@ -886,13 +894,13 @@ class Shell(Topology):
886
894
  x3 = math.sin(a2)*r
887
895
  y3 = math.cos(a2)*r
888
896
  z3 = A*x3*x3 + B*y3*y3
889
- v2 = topologic.Vertex.ByCoordinates(x2,y2,z2)
890
- v3 = topologic.Vertex.ByCoordinates(x3,y3,z3)
897
+ v2 = Vertex.ByCoordinates(x2,y2,z2)
898
+ v3 = Vertex.ByCoordinates(x3,y3,z3)
891
899
  f1 = Face.ByVertices([v2,v1,v3])
892
900
  faces.append(f1)
893
- returnTopology = topologic.Shell.ByFaces(faces, tolerance)
901
+ returnTopology = Shell.ByFaces(faces, tolerance)
894
902
  if not returnTopology:
895
- returnTopology = topologic.Cluster.ByTopologies(faces)
903
+ returnTopology = Cluster.ByTopologies(faces)
896
904
  vertices = []
897
905
  _ = returnTopology.Vertices(None, vertices)
898
906
  xList = []
@@ -929,13 +937,13 @@ class Shell(Topology):
929
937
  return returnTopology
930
938
 
931
939
  @staticmethod
932
- def InternalBoundaries(shell: topologic.Shell, tolerance=0.0001) -> topologic.Topology:
940
+ def InternalBoundaries(shell, tolerance=0.0001):
933
941
  """
934
942
  Returns the internal boundaries (closed wires) of the input shell. Internal boundaries are considered holes.
935
943
 
936
944
  Parameters
937
945
  ----------
938
- shell : topologic.Shell
946
+ shell : topologic_core.Shell
939
947
  The input shell.
940
948
  tolerance : float , optional
941
949
  The desired tolerance. The default is 0.0001.
@@ -962,13 +970,13 @@ class Shell(Topology):
962
970
 
963
971
 
964
972
  @staticmethod
965
- def IsClosed(shell: topologic.Shell) -> bool:
973
+ def IsClosed(shell) -> bool:
966
974
  """
967
975
  Returns True if the input shell is closed. Returns False otherwise.
968
976
 
969
977
  Parameters
970
978
  ----------
971
- shell : topologic.Shell
979
+ shell : topologic_core.Shell
972
980
  The input shell.
973
981
 
974
982
  Returns
@@ -980,13 +988,13 @@ class Shell(Topology):
980
988
  return shell.IsClosed()
981
989
 
982
990
  @staticmethod
983
- def Pie(origin: topologic.Vertex = None, radiusA: float = 0.5, radiusB: float = 0.0, sides: int = 32, rings: int = 1, fromAngle: float = 0.0, toAngle: float = 360.0, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
991
+ def Pie(origin= None, radiusA: float = 0.5, radiusB: float = 0.0, sides: int = 32, rings: int = 1, fromAngle: float = 0.0, toAngle: float = 360.0, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001):
984
992
  """
985
993
  Creates a pie shape.
986
994
 
987
995
  Parameters
988
996
  ----------
989
- origin : topologic.Vertex , optional
997
+ origin : topologic_core.Vertex , optional
990
998
  The location of the origin of the pie. The default is None which results in the pie being placed at (0, 0, 0).
991
999
  radiusA : float , optional
992
1000
  The outer radius of the pie. The default is 0.5.
@@ -1009,7 +1017,7 @@ class Shell(Topology):
1009
1017
 
1010
1018
  Returns
1011
1019
  -------
1012
- topologic.Shell
1020
+ topologic_core.Shell
1013
1021
  The created pie.
1014
1022
 
1015
1023
  """
@@ -1018,7 +1026,7 @@ class Shell(Topology):
1018
1026
  from topologicpy.Topology import Topology
1019
1027
  if not origin:
1020
1028
  origin = Vertex.ByCoordinates(0, 0, 0)
1021
- if not isinstance(origin, topologic.Vertex):
1029
+ if not Topology.IsInstance(origin, "Vertex"):
1022
1030
  return None
1023
1031
  if toAngle < fromAngle:
1024
1032
  toAngle += 360
@@ -1105,24 +1113,24 @@ class Shell(Topology):
1105
1113
 
1106
1114
 
1107
1115
  @staticmethod
1108
- def Planarize(shell: topologic.Shell, origin: topologic.Vertex = None, mantissa: int = 6, tolerance: float = 0.0001) -> topologic.Shell:
1116
+ def Planarize(shell, origin= None, mantissa: int = 6, tolerance: float = 0.0001):
1109
1117
  """
1110
1118
  Returns a planarized version of the input shell.
1111
1119
 
1112
1120
  Parameters
1113
1121
  ----------
1114
- shell : topologic.Shell
1122
+ shell : topologic_core.Shell
1115
1123
  The input shell.
1116
1124
  tolerance : float, optional
1117
1125
  The desired tolerance. The default is 0.0001.
1118
- origin : topologic.Vertex , optional
1126
+ origin : topologic_core.Vertex , optional
1119
1127
  The desired origin of the plane unto which the planar shell will be projected. If set to None, the centroid of the input shell will be chosen. The default is None.
1120
1128
  mantissa : int , optional
1121
1129
  The desired length of the mantissa. The default is 6.
1122
1130
 
1123
1131
  Returns
1124
1132
  -------
1125
- topologic.Shell
1133
+ topologic_core.Shell
1126
1134
  The planarized shell.
1127
1135
 
1128
1136
  """
@@ -1131,12 +1139,12 @@ class Shell(Topology):
1131
1139
  from topologicpy.Cluster import Cluster
1132
1140
  from topologicpy.Topology import Topology
1133
1141
 
1134
- if not isinstance(shell, topologic.Shell):
1142
+ if not Topology.IsInstance(shell, "Shell"):
1135
1143
  print("Shell.Planarize - Error: The input wire parameter is not a valid topologic shell. Returning None.")
1136
1144
  return None
1137
1145
  if origin == None:
1138
1146
  origin = Vertex.Origin()
1139
- if not isinstance(origin, topologic.Vertex):
1147
+ if not Topology.IsInstance(origin, "Vertex"):
1140
1148
  print("Shell.Planarize - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1141
1149
  return None
1142
1150
 
@@ -1150,15 +1158,15 @@ class Shell(Topology):
1150
1158
  return Topology.SelfMerge(Cluster.ByTopologies(new_faces), tolerance=tolerance)
1151
1159
 
1152
1160
  @staticmethod
1153
- def Rectangle(origin: topologic.Vertex = None, width: float = 1.0, length: float = 1.0,
1161
+ def Rectangle(origin= None, width: float = 1.0, length: float = 1.0,
1154
1162
  uSides: int = 2, vSides: int = 2, direction: list = [0, 0, 1],
1155
- placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
1163
+ placement: str = "center", tolerance: float = 0.0001):
1156
1164
  """
1157
1165
  Creates a rectangle.
1158
1166
 
1159
1167
  Parameters
1160
1168
  ----------
1161
- origin : topologic.Vertex , optional
1169
+ origin : topologic_core.Vertex , optional
1162
1170
  The location of the origin of the rectangle. The default is None which results in the rectangle being placed at (0, 0, 0).
1163
1171
  width : float , optional
1164
1172
  The width of the rectangle. The default is 1.0.
@@ -1177,16 +1185,18 @@ class Shell(Topology):
1177
1185
 
1178
1186
  Returns
1179
1187
  -------
1180
- topologic.Shell
1188
+ topologic_core.Shell
1181
1189
  The created shell.
1182
1190
 
1183
1191
  """
1184
1192
  from topologicpy.Vertex import Vertex
1185
1193
  from topologicpy.Wire import Wire
1186
1194
  from topologicpy.Face import Face
1195
+ from topologicpy.Topology import Topology
1196
+
1187
1197
  if not origin:
1188
1198
  origin = Vertex.ByCoordinates(0, 0, 0)
1189
- if not isinstance(origin, topologic.Vertex):
1199
+ if not Topology.IsInstance(origin, "Vertex"):
1190
1200
  return None
1191
1201
  uOffset = float(width)/float(uSides)
1192
1202
  vOffset = float(length)/float(vSides)
@@ -1209,13 +1219,13 @@ class Shell(Topology):
1209
1219
  return shell
1210
1220
 
1211
1221
  @staticmethod
1212
- def RemoveCollinearEdges(shell: topologic.Shell, angTolerance: float = 0.1, tolerance: float = 0.0001) -> topologic.Wire:
1222
+ def RemoveCollinearEdges(shell, angTolerance: float = 0.1, tolerance: float = 0.0001):
1213
1223
  """
1214
1224
  Removes any collinear edges in the input shell.
1215
1225
 
1216
1226
  Parameters
1217
1227
  ----------
1218
- shell : topologic.Shell
1228
+ shell : topologic_core.Shell
1219
1229
  The input shell.
1220
1230
  angTolerance : float , optional
1221
1231
  The desired angular tolerance. The default is 0.1.
@@ -1224,13 +1234,14 @@ class Shell(Topology):
1224
1234
 
1225
1235
  Returns
1226
1236
  -------
1227
- topologic.Shell
1237
+ topologic_core.Shell
1228
1238
  The created shell without any collinear edges.
1229
1239
 
1230
1240
  """
1231
1241
  from topologicpy.Face import Face
1242
+ from topologicpy.Topology import Topology
1232
1243
 
1233
- if not isinstance(shell, topologic.Shell):
1244
+ if not Topology.IsInstance(shell, "Shell"):
1234
1245
  print("Shell.RemoveCollinearEdges - Error: The input shell parameter is not a valid shell. Returning None.")
1235
1246
  return None
1236
1247
  faces = Shell.Faces(shell)
@@ -1247,7 +1258,7 @@ class Shell(Topology):
1247
1258
 
1248
1259
  Parameters
1249
1260
  ----------
1250
- face : topologic.Face
1261
+ face : topologic_core.Face
1251
1262
  The input face.
1252
1263
  angle : float , optioal
1253
1264
  The desired angle in degrees of the roof. The default is 45.
@@ -1258,7 +1269,7 @@ class Shell(Topology):
1258
1269
 
1259
1270
  Returns
1260
1271
  -------
1261
- topologic.Shell
1272
+ topologic_core.Shell
1262
1273
  The created roof.
1263
1274
 
1264
1275
  """
@@ -1282,7 +1293,7 @@ class Shell(Topology):
1282
1293
  return vertex
1283
1294
  return None
1284
1295
 
1285
- if not isinstance(face, topologic.Face):
1296
+ if not Topology.IsInstance(face, "Face"):
1286
1297
  return None
1287
1298
  angle = abs(angle)
1288
1299
  if angle >= 90-tolerance:
@@ -1345,13 +1356,13 @@ class Shell(Topology):
1345
1356
  return shell
1346
1357
 
1347
1358
  @staticmethod
1348
- def SelfMerge(shell: topologic.Shell, angTolerance: float = 0.1, tolerance: float = 0.0001) -> topologic.Face:
1359
+ def SelfMerge(shell, angTolerance: float = 0.1, tolerance: float = 0.0001):
1349
1360
  """
1350
1361
  Creates a face by merging the faces of the input shell. The shell must be planar within the input angular tolerance.
1351
1362
 
1352
1363
  Parameters
1353
1364
  ----------
1354
- shell : topologic.Shell
1365
+ shell : topologic_core.Shell
1355
1366
  The input shell.
1356
1367
  angTolerance : float , optional
1357
1368
  The desired angular tolerance. The default is 0.1.
@@ -1360,7 +1371,7 @@ class Shell(Topology):
1360
1371
 
1361
1372
  Returns
1362
1373
  -------
1363
- topologic.Face
1374
+ topologic_core.Face
1364
1375
  The created face.
1365
1376
 
1366
1377
  """
@@ -1374,26 +1385,26 @@ class Shell(Topology):
1374
1385
  for aWire in wireList:
1375
1386
  returnList.append(Wire.Planarize(aWire))
1376
1387
  return returnList
1377
- if not isinstance(shell, topologic.Shell):
1388
+ if not Topology.IsInstance(shell, "Shell"):
1378
1389
  return None
1379
1390
  ext_boundary = Shell.ExternalBoundary(shell, tolerance=tolerance)
1380
- if isinstance(ext_boundary, topologic.Wire):
1391
+ if Topology.IsInstance(ext_boundary, "Wire"):
1381
1392
  f = Face.ByWire(Topology.RemoveCollinearEdges(ext_boundary, angTolerance), tolerance=tolerance) or Face.ByWire(Wire.Planarize(Topology.RemoveCollinearEdges(ext_boundary, angTolerance), tolerance=tolerance))
1382
1393
  if not f:
1383
1394
  print("FaceByPlanarShell - Error: The input Wire is not planar and could not be fixed. Returning None.")
1384
1395
  return None
1385
1396
  else:
1386
1397
  return f
1387
- elif isinstance(ext_boundary, topologic.Cluster):
1398
+ elif Topology.IsInstance(ext_boundary, "Cluster"):
1388
1399
  wires = []
1389
1400
  _ = ext_boundary.Wires(None, wires)
1390
1401
  faces = []
1391
1402
  areas = []
1392
1403
  for aWire in wires:
1393
1404
  try:
1394
- aFace = topologic.Face.ByExternalBoundary(Topology.RemoveCollinearEdges(aWire, angTolerance))
1405
+ aFace = Face.ByWire(Topology.RemoveCollinearEdges(aWire, angTolerance))
1395
1406
  except:
1396
- aFace = topologic.Face.ByExternalBoundary(Wire.Planarize(Topology.RemoveCollinearEdges(aWire, angTolerance)))
1407
+ aFace = Face.ByWire(Wire.Planarize(Topology.RemoveCollinearEdges(aWire, angTolerance)))
1397
1408
  anArea = Face.Area(aFace)
1398
1409
  faces.append(aFace)
1399
1410
  areas.append(anArea)
@@ -1422,14 +1433,14 @@ class Shell(Topology):
1422
1433
 
1423
1434
  Parameters
1424
1435
  ----------
1425
- face : topologic.Face
1436
+ face : topologic_core.Face
1426
1437
  The input face.
1427
1438
  tolerance : float , optional
1428
1439
  The desired tolerance. The default is 0.001. (This is set to a larger number as it was found to work better)
1429
1440
 
1430
1441
  Returns
1431
1442
  -------
1432
- topologic.Shell
1443
+ topologic_core.Shell
1433
1444
  The created straight skeleton.
1434
1445
 
1435
1446
  """
@@ -1439,7 +1450,7 @@ class Shell(Topology):
1439
1450
  import topologic_core as topologic
1440
1451
  import math
1441
1452
 
1442
- if not isinstance(face, topologic.Face):
1453
+ if not Topology.IsInstance(face, "Face"):
1443
1454
  return None
1444
1455
  roof = Wire.Skeleton(face, tolerance=tolerance)
1445
1456
  if not roof:
@@ -1469,7 +1480,7 @@ class Shell(Topology):
1469
1480
 
1470
1481
  Parameters
1471
1482
  ----------
1472
- shell : topologic.Shell
1483
+ shell : topologic_core.Shell
1473
1484
  The input shell.
1474
1485
  simplifyBoundary : bool , optional
1475
1486
  If set to True, the external boundary of the shell will be simplified as well. Otherwise, it will not be simplified. The default is True.
@@ -1478,7 +1489,7 @@ class Shell(Topology):
1478
1489
 
1479
1490
  Returns
1480
1491
  -------
1481
- topologic.Shell
1492
+ topologic_core.Shell
1482
1493
  The simplified shell.
1483
1494
 
1484
1495
  """
@@ -1537,7 +1548,7 @@ class Shell(Topology):
1537
1548
 
1538
1549
  # Merge the two simplified segments
1539
1550
  return first_segment[:-1] + second_segment
1540
- if not isinstance(shell, topologic.Shell):
1551
+ if not Topology.IsInstance(shell, "Shell"):
1541
1552
  print("Shell.Simplify - Error: The input shell parameter is not a valid topologic shell. Returning None.")
1542
1553
  return None
1543
1554
  # Get the external boundary of the shell. This can be simplified as well, but might cause issues at the end.
@@ -1561,18 +1572,18 @@ class Shell(Topology):
1561
1572
  separators = []
1562
1573
  wires = []
1563
1574
  for component in components:
1564
- if isinstance(component, topologic.Cluster):
1575
+ if Topology.IsInstance(component, "Cluster"):
1565
1576
  component = Topology.SelfMerge(component, tolerance=tolerance)
1566
- if isinstance(component, topologic.Cluster):
1577
+ if Topology.IsInstance(component, "Cluster"):
1567
1578
  separators.append(Cluster.FreeEdges(component, tolerance=tolerance))
1568
1579
  wires.append(Cluster.FreeWires(component, tolerance=tolerance))
1569
- if isinstance(component, topologic.Edge):
1580
+ if Topology.IsInstance(component, "Edge"):
1570
1581
  separators.append(component)
1571
- if isinstance(component, topologic.Wire):
1582
+ if Topology.IsInstance(component, "Wire"):
1572
1583
  wires.append(component)
1573
- if isinstance(component, topologic.Edge):
1584
+ if Topology.IsInstance(component, "Edge"):
1574
1585
  separators.append(component)
1575
- if isinstance(component, topologic.Wire):
1586
+ if Topology.IsInstance(component, "Wire"):
1576
1587
  wires.append(component)
1577
1588
  wires = Helper.Flatten(wires)
1578
1589
  separators = Helper.Flatten(separators)
@@ -1607,13 +1618,13 @@ class Shell(Topology):
1607
1618
 
1608
1619
 
1609
1620
  @staticmethod
1610
- def Vertices(shell: topologic.Shell) -> list:
1621
+ def Vertices(shell) -> list:
1611
1622
  """
1612
1623
  Returns the vertices of the input shell.
1613
1624
 
1614
1625
  Parameters
1615
1626
  ----------
1616
- shell : topologic.Shell
1627
+ shell : topologic_core.Shell
1617
1628
  The input shell.
1618
1629
 
1619
1630
  Returns
@@ -1622,14 +1633,16 @@ class Shell(Topology):
1622
1633
  The list of vertices.
1623
1634
 
1624
1635
  """
1625
- if not isinstance(shell, topologic.Shell):
1636
+ from topologicpy.Topology import Topology
1637
+
1638
+ if not Topology.IsInstance(shell, "Shell"):
1626
1639
  return None
1627
1640
  vertices = []
1628
1641
  _ = shell.Vertices(None, vertices)
1629
1642
  return vertices
1630
1643
 
1631
1644
  @staticmethod
1632
- def Voronoi(vertices: list, face: topologic.Face = None, tolerance: float = 0.0001) -> topologic.Shell:
1645
+ def Voronoi(vertices: list, face= None, tolerance: float = 0.0001):
1633
1646
  """
1634
1647
  Returns a voronoi partitioning of the input face based on the input vertices. The vertices must be coplanar and within the face. See https://en.wikipedia.org/wiki/Voronoi_diagram.
1635
1648
 
@@ -1637,7 +1650,7 @@ class Shell(Topology):
1637
1650
  ----------
1638
1651
  vertices : list
1639
1652
  The input list of vertices.
1640
- face : topologic.Face , optional
1653
+ face : topologic_core.Face , optional
1641
1654
  The input face. If the face is not set an optimised bounding rectangle of the input vertices is used instead. The default is None.
1642
1655
  tolerance : float , optional
1643
1656
  The desired tolerance. The default is 0.0001.
@@ -1656,13 +1669,13 @@ class Shell(Topology):
1656
1669
  from topologicpy.Topology import Topology
1657
1670
  from topologicpy.Dictionary import Dictionary
1658
1671
 
1659
- if not isinstance(face, topologic.Face):
1672
+ if not Topology.IsInstance(face, "Face"):
1660
1673
  cluster = Cluster.ByTopologies(vertices)
1661
1674
  br = Wire.BoundingRectangle(cluster, optimize=5)
1662
1675
  face = Face.ByWire(br, tolerance=tolerance)
1663
1676
  if not isinstance(vertices, list):
1664
1677
  return None
1665
- vertices = [x for x in vertices if isinstance(x, topologic.Vertex)]
1678
+ vertices = [x for x in vertices if Topology.IsInstance(x, "Vertex")]
1666
1679
  if len(vertices) < 2:
1667
1680
  return None
1668
1681
 
@@ -1741,13 +1754,13 @@ class Shell(Topology):
1741
1754
  return shell
1742
1755
 
1743
1756
  @staticmethod
1744
- def Wires(shell: topologic.Shell) -> list:
1757
+ def Wires(shell) -> list:
1745
1758
  """
1746
1759
  Returns the wires of the input shell.
1747
1760
 
1748
1761
  Parameters
1749
1762
  ----------
1750
- shell : topologic.Shell
1763
+ shell : topologic_core.Shell
1751
1764
  The input shell.
1752
1765
 
1753
1766
  Returns
@@ -1756,7 +1769,9 @@ class Shell(Topology):
1756
1769
  The list of wires.
1757
1770
 
1758
1771
  """
1759
- if not isinstance(shell, topologic.Shell):
1772
+ from topologicpy.Topology import Topology
1773
+
1774
+ if not Topology.IsInstance(shell, "Shell"):
1760
1775
  return None
1761
1776
  wires = []
1762
1777
  _ = shell.Wires(None, wires)