topologicpy 0.4.38__py3-none-any.whl → 0.4.40__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
@@ -1280,26 +1280,6 @@ class Topology():
1280
1280
  return None
1281
1281
  return Topology.ByBREPFile(file)
1282
1282
 
1283
- @staticmethod
1284
- def ByImportedBRep(path):
1285
- """
1286
- DEPRECATED. DO NOT USE. Instead use Topology.ByBREPPath or Topology.ByBREPFile
1287
- IMportes a topology from a BRep file path.
1288
-
1289
- Parameters
1290
- ----------
1291
- path : str
1292
- The path to the BRep file.
1293
-
1294
- Returns
1295
- -------
1296
- topologic.Topology
1297
- The imported topology.
1298
-
1299
- """
1300
- print("Topology.ByImportedBRep - WARNING: This method is DEPRECATED. DO NOT USE. Instead use Topology.ByBREPPath or Topology.ByBREPFile")
1301
- return Topology.ByBREPPath(path=path)
1302
-
1303
1283
  @staticmethod
1304
1284
  def ByIFCFile(file, transferDictionaries=False):
1305
1285
  """
@@ -1422,28 +1402,6 @@ class Topology():
1422
1402
  print("Topology.ByIFCPath - Error: the input file is not a valid file. Returning None.")
1423
1403
  return None
1424
1404
  return Topology.ByIFCFile(file, transferDictionaries=transferDictionaries)
1425
-
1426
- @staticmethod
1427
- def ByImportedIFC(path, transferDictionaries=False):
1428
- """
1429
- DEPRECATED. DO NOT USE. Instead use Topology.ByIFCPath or Topology.ByIFCFile
1430
- Create a topology by importing it from an IFC file path.
1431
-
1432
- Parameters
1433
- ----------
1434
- path : str
1435
- The path to the IFC file.
1436
- transferDictionaries : bool , optional
1437
- If set to True, the dictionaries from the IFC file will be transfered to the topology. Otherwise, they won't. The default is False.
1438
-
1439
- Returns
1440
- -------
1441
- list
1442
- The created list of topologies.
1443
-
1444
- """
1445
- print("Topology.ByImportedIFC - WARNING: This method is DEPRECATED. DO NOT USE. Instead use Topology.ByIFCPath or Topology.ByIFCFile")
1446
- return Topology.ByIFCPath(path=path, transferDictionaries=transferDictionaries)
1447
1405
 
1448
1406
  '''
1449
1407
  @staticmethod
@@ -1471,7 +1429,7 @@ class Topology():
1471
1429
  url = '/dns/'+url+'/tcp/'+port+'/https'
1472
1430
  client = ipfshttpclient.connect(url)
1473
1431
  brepString = client.cat(hash_).decode("utf-8")
1474
- topology = Topology.ByString(brepString)
1432
+ topology = Topology.ByBREPString(brepString)
1475
1433
  return topology
1476
1434
  '''
1477
1435
  @staticmethod
@@ -1892,12 +1850,10 @@ class Topology():
1892
1850
  if not path:
1893
1851
  print("Topology.ByJSONPath - Error: the input path is not a valid path. Returning None.")
1894
1852
  return None
1895
- try:
1896
- file = open(path)
1897
- except:
1898
- print("Topology.ByJSONPath - Error: the JSON file is not a valid file. Returning None.")
1899
- return None
1900
- return Topology.ByJSONFile(file=file, tolerance=tolerance)
1853
+ data = None
1854
+ with open(path) as file:
1855
+ data = Topology.ByJSONFile(file=file, tolerance=tolerance)
1856
+ return data
1901
1857
 
1902
1858
  @staticmethod
1903
1859
  def ByOBJString(string, transposeAxes = True, progressBar=False, renderer="notebook", tolerance=0.0001):
@@ -2031,30 +1987,6 @@ class Topology():
2031
1987
  print("Topology.ByOBJPath - Error: the OBJ file is not a valid file. Returning None.")
2032
1988
  return None
2033
1989
  return Topology.ByOBJFile(file, transposeAxes=transposeAxes, progressBar=progressBar, renderer=renderer, tolerance=tolerance)
2034
-
2035
- @staticmethod
2036
- def ByImportedOBJ(path, transposeAxes = True, progressBar=False, renderer="notebook", tolerance=0.0001):
2037
- """
2038
- DEPRECATED. DO NOT USE. Instead use Topology.ByOBJPath or Topology.ByOBJFile
2039
- Imports the topology from a Weverfront OBJ file path. This is a very experimental method and only works with simple planar solids. Materials and Colors are ignored.
2040
-
2041
- Parameters
2042
- ----------
2043
- path : str
2044
- The file path to the OBJ file.
2045
- transposeAxes : bool , optional
2046
- If set to True the Z and Y coordinates are transposed so that Y points "up"
2047
- tolerance : float , optional
2048
- The desired tolerance. The default is 0.0001.
2049
-
2050
- Returns
2051
- -------
2052
- topology
2053
- The imported topology.
2054
-
2055
- """
2056
- print("Topology.ByImportedOBJ - WARNING: This method is DEPRECATED. DO NOT USE. Instead use Topology.ByOBJPath or Topology.ByOBJFile")
2057
- return Topology.ByOBJPath(path, transposeAxes=transposeAxes, progressBar=progressBar, renderer=renderer, tolerance=tolerance)
2058
1990
 
2059
1991
  @staticmethod
2060
1992
  def ByOCCTShape(occtShape):
@@ -2074,33 +2006,6 @@ class Topology():
2074
2006
  """
2075
2007
  return topologic.Topology.ByOcctShape(occtShape, "")
2076
2008
 
2077
- @staticmethod
2078
- def ByString(string):
2079
- """
2080
- DEPRECATED! Do not Use. Use ByBREPString instead.
2081
-
2082
- Parameters
2083
- ----------
2084
- string : str
2085
- The input brep string.
2086
-
2087
- Returns
2088
- -------
2089
- topologic.Topology
2090
- The created topology.
2091
-
2092
- """
2093
- print("WARNING! Topology.ByString method is DEPRECATED. Do NOT use. Instead use Topology.ByBREPString.")
2094
- if not isinstance(string, str):
2095
- print("Topology.ByString - Error: the input string is not a valid string. Returning None.")
2096
- return None
2097
- returnTopology = None
2098
- try:
2099
- returnTopology = topologic.Topology.ByString(string)
2100
- except:
2101
- returnTopology = None
2102
- return returnTopology
2103
-
2104
2009
  @staticmethod
2105
2010
  def ByBREPString(string):
2106
2011
  """
@@ -2820,32 +2725,6 @@ class Topology():
2820
2725
  newTopology = Topology.Translate(aTopology, xT, yT, zT)
2821
2726
  newTopologies.append(newTopology)
2822
2727
  return Cluster.ByTopologies(newTopologies)
2823
-
2824
- @staticmethod
2825
- def ExportToBRep(topology, path, overwrite=False, version=3):
2826
- """
2827
- DEPRECTATED. DO NOT USE. INSTEAD USE Topology.ExportToBREP.
2828
- Exports the input topology to a BREP file. See https://dev.opencascade.org/doc/occt-6.7.0/overview/html/occt_brep_format.html.
2829
-
2830
- Parameters
2831
- ----------
2832
- topology : topologic.Topology
2833
- The input topology.
2834
- path : str
2835
- The input file path.
2836
- overwrite : bool , optional
2837
- If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won't. The default is False.
2838
- version : int , optional
2839
- The desired version number for the BREP file. The default is 3.
2840
-
2841
- Returns
2842
- -------
2843
- bool
2844
- True if the export operation is successful. False otherwise.
2845
-
2846
- """
2847
- print("Topology.ExportToBRep - WARNING: This method is deprecated. Please use instead Topology.ExportToBREP.")
2848
- return Topology.ExportToBREP(topology=topology, path=path, overwrite=overwrite, version=version)
2849
2728
 
2850
2729
  @staticmethod
2851
2730
  def ExportToBREP(topology, path, overwrite=False, version=3):
@@ -2892,7 +2771,7 @@ class Topology():
2892
2771
  except:
2893
2772
  raise Exception("Error: Could not create a new file at the following location: "+path)
2894
2773
  if (f):
2895
- s = topology.String(version)
2774
+ s = Topology.BREPString(topology, version)
2896
2775
  f.write(s)
2897
2776
  f.close()
2898
2777
  return True
@@ -2939,7 +2818,7 @@ class Topology():
2939
2818
  except:
2940
2819
  raise Exception("Error: Could not create a new file at the following location: "+path)
2941
2820
  if (f):
2942
- topString = topology.String()
2821
+ topString = topology.BREPString()
2943
2822
  f.write(topString)
2944
2823
  f.close()
2945
2824
  return True
@@ -4115,7 +3994,7 @@ class Topology():
4115
3994
  try:
4116
3995
  newTopology = Topology.Translate(topology, x, y, z)
4117
3996
  except:
4118
- print("ERROR: (Topologic>TopologyUtility.Place) operation failed. Returning None.")
3997
+ print("Topology.Place - ERROR: (Topologic>TopologyUtility.Place) operation failed. Returning None.")
4119
3998
  newTopology = None
4120
3999
  return newTopology
4121
4000
 
@@ -4669,7 +4548,7 @@ class Topology():
4669
4548
  return new_topology
4670
4549
 
4671
4550
  @staticmethod
4672
- def Rotate(topology, origin=None, x=0, y=0, z=1, degree=0):
4551
+ def Rotate(topology, origin=None, x=0, y=0, z=1, degree=0, angTolerance=0.001):
4673
4552
  """
4674
4553
  Rotates the input topology
4675
4554
 
@@ -4687,6 +4566,8 @@ class Topology():
4687
4566
  The 'z' component of the rotation axis. The default is 0.
4688
4567
  degree : float , optional
4689
4568
  The angle of rotation in degrees. The default is 0.
4569
+ angTolerance : float , optional
4570
+ The angle tolerance in degrees under which no rotation is carried out. The default is 0.001 degrees.
4690
4571
 
4691
4572
  Returns
4692
4573
  -------
@@ -4695,13 +4576,21 @@ class Topology():
4695
4576
 
4696
4577
  """
4697
4578
  from topologicpy.Vertex import Vertex
4579
+ from topologicpy.Topology import Topology
4698
4580
  if not isinstance(topology, topologic.Topology):
4699
4581
  return None
4700
4582
  if not origin:
4701
4583
  origin = Vertex.ByCoordinates(0,0,0)
4702
4584
  if not isinstance(origin, topologic.Vertex):
4703
4585
  return None
4704
- return topologic.TopologyUtility.Rotate(topology, origin, x, y, z, degree)
4586
+ returnTopology = topology
4587
+ if abs(degree) >= angTolerance:
4588
+ try:
4589
+ returnTopology = topologic.TopologyUtility.Rotate(topology, origin, x, y, z, degree)
4590
+ except:
4591
+ print("Topology.Rotate - Error: (topologic.TopologyUtility.Rotate) operation failed. Returning None.")
4592
+ return None
4593
+ return returnTopology
4705
4594
 
4706
4595
  @staticmethod
4707
4596
  def Scale(topology, origin=None, x=1, y=1, z=1):
@@ -4738,7 +4627,7 @@ class Topology():
4738
4627
  try:
4739
4628
  newTopology = topologic.TopologyUtility.Scale(topology, origin, x, y, z)
4740
4629
  except:
4741
- print("ERROR: (Topologic>TopologyUtility.Scale) operation failed. Returning None.")
4630
+ print("Topology.Scale - ERROR: (Topologic>TopologyUtility.Scale) operation failed. Returning None.")
4742
4631
  newTopology = None
4743
4632
  return newTopology
4744
4633
 
@@ -5346,7 +5235,9 @@ class Topology():
5346
5235
  topologies = []
5347
5236
  unit_degree = degree / float(sides)
5348
5237
  for i in range(sides+1):
5349
- topologies.append(topologic.TopologyUtility.Rotate(topology, origin, direction[0], direction[1], direction[2], unit_degree*i))
5238
+ tempTopology = Topology.Rotate(topology, origin, direction[0], direction[1], direction[2], unit_degree*i)
5239
+ if tempTopology:
5240
+ topologies.append(tempTopology)
5350
5241
  returnTopology = None
5351
5242
  if topology.Type() == topologic.Vertex.Type():
5352
5243
  returnTopology = Wire.ByVertices(topologies, False)
@@ -5437,31 +5328,15 @@ class Topology():
5437
5328
  if not isinstance(topology, topologic.Topology):
5438
5329
  print("Topology.BREPString - Error: the input topology is not a valid topology. Returning None.")
5439
5330
  return None
5440
- return topologic.Topology.String(topology, version)
5441
-
5442
- @staticmethod
5443
- def String(topology, version=3):
5444
- """
5445
- DEPRECATED. Do not use. Instead use BREPString.
5446
-
5447
- Parameters
5448
- ----------
5449
- topology : topologic.Topology
5450
- The input topology.
5451
- version : int , optional
5452
- The desired BRep version number. The default is 3.
5453
-
5454
- Returns
5455
- -------
5456
- str
5457
- The BRep string.
5458
-
5459
- """
5460
- print("WARNING! Topology.String is deprecated. Do not use. Instead use Topology.BREPString")
5461
- if not isinstance(topology, topologic.Topology):
5462
- print("Topology.String - Error: the input topology is not a valid topology. Returning None.")
5463
- return None
5464
- return topologic.Topology.String(topology, version)
5331
+ st = None
5332
+ try:
5333
+ st = topologic.Topology.String(topology, version)
5334
+ except:
5335
+ try:
5336
+ st = topologic.Topology.BREPString(topology, version)
5337
+ except:
5338
+ st = None
5339
+ return st
5465
5340
 
5466
5341
  @staticmethod
5467
5342
  def Vertices(topology):
topologicpy/Vertex.py CHANGED
@@ -296,9 +296,9 @@ class Vertex(Topology):
296
296
  return vertices
297
297
 
298
298
  @staticmethod
299
- def Distance(vertex: topologic.Vertex, topology: topologic.Topology, mantissa: int = 4) -> float:
299
+ def Distance(vertex: topologic.Vertex, topology: topologic.Topology, includeCentroid: bool =True, mantissa: int = 4) -> float:
300
300
  """
301
- Returns the distance between the input vertex and the input topology.
301
+ Returns the distance between the input vertex and the input topology. This method returns the distance to the closest sub-topology in the input topology, optionally including its centroid.
302
302
 
303
303
  Parameters
304
304
  ----------
@@ -306,6 +306,8 @@ class Vertex(Topology):
306
306
  The input vertex.
307
307
  topology : topologic.Topology
308
308
  The input topology.
309
+ includeCentroid : bool
310
+ If set to True, the centroid of the input topology will be considered in finding the nearest subTopology to the input vertex. The default is True.
309
311
  mantissa: int , optional
310
312
  The desired length of the mantissa. The default is 4.
311
313
 
@@ -315,9 +317,126 @@ class Vertex(Topology):
315
317
  The distance between the input vertex and the input topology.
316
318
 
317
319
  """
320
+ import numpy as np
321
+ from topologicpy.Edge import Edge
322
+ from topologicpy.Wire import Wire
323
+ from topologicpy.Face import Face
324
+ from topologicpy.Shell import Shell
325
+ from topologicpy.Cell import Cell
326
+ from topologicpy.Cluster import Cluster
327
+
328
+ def distance_point_to_point(point1, point2):
329
+ # Convert input points to NumPy arrays
330
+ point1 = np.array(point1)
331
+ point2 = np.array(point2)
332
+
333
+ # Calculate the Euclidean distance
334
+ distance = np.linalg.norm(point1 - point2)
335
+
336
+ return distance
337
+
338
+ def distance_point_to_line(point, line_start, line_end):
339
+ # Convert input points to NumPy arrays for vector operations
340
+ point = np.array(point)
341
+ line_start = np.array(line_start)
342
+ line_end = np.array(line_end)
343
+
344
+ # Calculate the direction vector of the edge
345
+ line_direction = line_end - line_start
346
+
347
+ # Vector from the edge's starting point to the point
348
+ point_to_start = point - line_start
349
+
350
+ # Calculate the parameter 't' where the projection of the point onto the edge occurs
351
+ t = np.dot(point_to_start, line_direction) / np.dot(line_direction, line_direction)
352
+
353
+ # Check if 't' is outside the range [0, 1], and if so, calculate distance to closest endpoint
354
+ if t < 0:
355
+ return np.linalg.norm(point - line_start)
356
+ elif t > 1:
357
+ return np.linalg.norm(point - line_end)
358
+
359
+ # Calculate the closest point on the edge to the given point
360
+ closest_point = line_start + t * line_direction
361
+
362
+ # Calculate the distance between the closest point and the given point
363
+ distance = np.linalg.norm(point - closest_point)
364
+
365
+ return distance
366
+
367
+ def distance_point_to_plane(point, plane_point, plane_normal):
368
+ # Convert input points and normal vector to NumPy arrays
369
+ point = np.array(point)
370
+ plane_point = np.array(plane_point)
371
+ plane_normal = np.array(plane_normal)
372
+
373
+ # Calculate the vector from the plane point to the given point
374
+ point_to_plane = point - plane_point
375
+
376
+ # Calculate the distance as the projection of the point-to-plane vector onto the plane's normal
377
+ distance = np.abs(np.dot(point_to_plane, plane_normal) / np.linalg.norm(plane_normal))
378
+
379
+ return distance
380
+
381
+ def distance_to_vertex(vertexA, vertexB):
382
+ a = (Vertex.X(vertexA), Vertex.Y(vertexA), Vertex.Z(vertexA))
383
+ b = (Vertex.X(vertexB), Vertex.Y(vertexB), Vertex.Z(vertexB))
384
+ return distance_point_to_point(a,b)
385
+
386
+ def distance_to_edge(vertex, edge):
387
+ a = (Vertex.X(vertex), Vertex.Y(vertex), Vertex.Z(vertex))
388
+ sv = Edge.StartVertex(edge)
389
+ ev = Edge.EndVertex(edge)
390
+ svp = (Vertex.X(sv), Vertex.Y(sv), Vertex.Z(sv))
391
+ evp = (Vertex.X(ev), Vertex.Y(ev), Vertex.Z(ev))
392
+ return distance_point_to_line(a,svp, evp)
393
+
394
+ def distance_to_face(vertex, face):
395
+ a = (Vertex.X(vertex), Vertex.Y(vertex), Vertex.Z(vertex))
396
+ c = Topology.Centroid(face)
397
+ c = (Vertex.X(c), Vertex.Y(c), Vertex.Z(c))
398
+ n = Face.Normal(face)
399
+ n = (n[0], n[1], n[2])
400
+ return distance_point_to_plane(a, c, n)
401
+
318
402
  if not isinstance(vertex, topologic.Vertex) or not isinstance(topology, topologic.Topology):
319
403
  return None
320
- return round(topologic.VertexUtility.Distance(vertex, topology), mantissa)
404
+ if isinstance(topology, topologic.Vertex):
405
+ return round(distance_to_vertex(vertex,topology), mantissa)
406
+ elif isinstance(topology, topologic.Edge):
407
+ return round(distance_to_edge(vertex,topology), mantissa)
408
+ elif isinstance(topology, topologic.Wire):
409
+ vertices = Topology.Vertices(topology)
410
+ distances = [distance_to_vertex(vertex, v) for v in vertices]
411
+ edges = Topology.Edges(topology)
412
+ distances += [distance_to_edge(vertex, e) for e in edges]
413
+ if includeCentroid:
414
+ distances.append(distance_to_vertex(vertex, Topology.Centroid(topology)))
415
+ return round(min(distances), mantissa)
416
+ elif isinstance(topology, topologic.Face):
417
+ vertices = Topology.Vertices(topology)
418
+ distances = [distance_to_vertex(vertex, v) for v in vertices]
419
+ edges = Topology.Edges(topology)
420
+ distances += [distance_to_edge(vertex, e) for e in edges]
421
+ distances.append(distance_to_face(vertex,topology))
422
+ if includeCentroid:
423
+ distances.append(distance_to_vertex(vertex, Topology.Centroid(topology)))
424
+ return round(min(distances), mantissa)
425
+ elif isinstance(topology, topologic.Shell) or isinstance(topology, topologic.Cell) or isinstance(topology, topologic.CellComplex) or isinstance(topology, topologic.Cluster):
426
+ vertices = Topology.Vertices(topology)
427
+ distances = [distance_to_vertex(vertex, v) for v in vertices]
428
+ edges = Topology.Edges(topology)
429
+ distances += [distance_to_edge(vertex, e) for e in edges]
430
+ faces = Topology.Faces(topology)
431
+ distances += [distance_to_face(vertex, f) for f in faces]
432
+ edges = Topology.Edges(topology)
433
+ distances += [distance_to_edge(vertex, e) for e in edges]
434
+ if includeCentroid:
435
+ distances.append(distance_to_vertex(vertex, Topology.Centroid(topology)))
436
+ return round(min(distances), mantissa)
437
+ else:
438
+ print("Vertex.Distance - Error: Could not recognize the input topology. Returning None.")
439
+ return None
321
440
 
322
441
  @staticmethod
323
442
  def EnclosingCell(vertex: topologic.Vertex, topology: topologic.Topology, exclusive: bool = True, tolerance: float = 0.0001) -> list:
@@ -545,6 +664,7 @@ class Vertex(Topology):
545
664
 
546
665
  """
547
666
  from topologicpy.Wire import Wire
667
+ from topologicpy.Face import Face
548
668
  from topologicpy.Shell import Shell
549
669
  from topologicpy.CellComplex import CellComplex
550
670
  from topologicpy.Cluster import Cluster
@@ -555,7 +675,7 @@ class Vertex(Topology):
555
675
  return None
556
676
 
557
677
  if isinstance(topology, topologic.Vertex):
558
- return topologic.VertexUtility.Distance(vertex, topology) < tolerance
678
+ return Vertex.Distance(vertex, topology) < tolerance
559
679
  elif isinstance(topology, topologic.Edge):
560
680
  try:
561
681
  parameter = topologic.EdgeUtility.ParameterAtPoint(topology, vertex)
@@ -569,7 +689,7 @@ class Vertex(Topology):
569
689
  return True
570
690
  return False
571
691
  elif isinstance(topology, topologic.Face):
572
- return topologic.FaceUtility.IsInside(topology, vertex, tolerance)
692
+ return Face.IsInside(topology, vertex, tolerance)
573
693
  elif isinstance(topology, topologic.Shell):
574
694
  faces = Shell.Faces(topology)
575
695
  for face in faces:
@@ -813,16 +933,16 @@ class Vertex(Topology):
813
933
  return None
814
934
  if not direction:
815
935
  direction = Vector.Reverse(Face.NormalAtParameters(face, 0.5, 0.5, "XYZ", mantissa))
816
- if topologic.FaceUtility.IsInside(face, vertex, tolerance):
936
+ if Face.IsInside(face, vertex, tolerance):
817
937
  return vertex
818
- d = topologic.VertexUtility.Distance(vertex, face)*10
819
- far_vertex = topologic.TopologyUtility.Translate(vertex, direction[0]*d, direction[1]*d, direction[2]*d)
820
- if topologic.VertexUtility.Distance(vertex, far_vertex) > tolerance:
938
+ d = Vertex.Distance(vertex, face)*10
939
+ far_vertex = Topology.Translate(vertex, direction[0]*d, direction[1]*d, direction[2]*d)
940
+ if Vertex.Distance(vertex, far_vertex) > tolerance:
821
941
  e = topologic.Edge.ByStartVertexEndVertex(vertex, far_vertex)
822
942
  pv = face.Intersect(e, False)
823
943
  if not pv:
824
- far_vertex = topologic.TopologyUtility.Translate(vertex, -direction[0]*d, -direction[1]*d, -direction[2]*d)
825
- if topologic.VertexUtility.Distance(vertex, far_vertex) > tolerance:
944
+ far_vertex = Topology.Translate(vertex, -direction[0]*d, -direction[1]*d, -direction[2]*d)
945
+ if Vertex.Distance(vertex, far_vertex) > tolerance:
826
946
  e = topologic.Edge.ByStartVertexEndVertex(vertex, far_vertex)
827
947
  pv = face.Intersect(e, False)
828
948
  return pv
topologicpy/Wire.py CHANGED
@@ -504,6 +504,8 @@ class Wire(topologic.Wire):
504
504
  The created circle.
505
505
 
506
506
  """
507
+ from topologicpy.Topology import Topology
508
+
507
509
  if not origin:
508
510
  origin = topologic.Vertex.ByCoordinates(0,0,0)
509
511
  if not isinstance(origin, topologic.Vertex):
@@ -540,13 +542,13 @@ class Wire(topologic.Wire):
540
542
  baseWire = Wire.ByVertices(baseV[::-1], close) #reversing the list so that the normal points up in Blender
541
543
 
542
544
  if placement.lower() == "lowerleft":
543
- baseWire = topologic.TopologyUtility.Translate(baseWire, radius, radius, 0)
545
+ baseWire = Topology.Translate(baseWire, radius, radius, 0)
544
546
  elif placement.lower() == "upperleft":
545
- baseWire = topologic.TopologyUtility.Translate(baseWire, radius, -radius, 0)
547
+ baseWire = Topology.Translate(baseWire, radius, -radius, 0)
546
548
  elif placement.lower() == "lowerright":
547
- baseWire = topologic.TopologyUtility.Translate(baseWire, -radius, radius, 0)
549
+ baseWire = Topology.Translate(baseWire, -radius, radius, 0)
548
550
  elif placement.lower() == "upperright":
549
- baseWire = topologic.TopologyUtility.Translate(baseWire, -radius, -radius, 0)
551
+ baseWire = Topology.Translate(baseWire, -radius, -radius, 0)
550
552
  x1 = origin.X()
551
553
  y1 = origin.Y()
552
554
  z1 = origin.Z()
@@ -562,8 +564,8 @@ class Wire(topologic.Wire):
562
564
  theta = 0
563
565
  else:
564
566
  theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
565
- baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 1, 0, theta)
566
- baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 0, 1, phi)
567
+ baseWire = Topology.Rotate(baseWire, origin, 0, 1, 0, theta)
568
+ baseWire = Topology.Rotate(baseWire, origin, 0, 0, 1, phi)
567
569
  return baseWire
568
570
 
569
571
  @staticmethod
@@ -1012,6 +1014,8 @@ class Wire(topologic.Wire):
1012
1014
  8. "length" : The length
1013
1015
 
1014
1016
  """
1017
+ from topologicpy.Topology import Topology
1018
+
1015
1019
  if not origin:
1016
1020
  origin = topologic.Vertex.ByCoordinates(0,0,0)
1017
1021
  if not isinstance(origin, topologic.Vertex):
@@ -1086,7 +1090,7 @@ class Wire(topologic.Wire):
1086
1090
  ellipse = Wire.ByVertices(baseV[::-1], close) #reversing the list so that the normal points up in Blender
1087
1091
 
1088
1092
  if placement.lower() == "lowerleft":
1089
- ellipse = topologic.TopologyUtility.Translate(ellipse, a, b, 0)
1093
+ ellipse = Topology.Translate(ellipse, a, b, 0)
1090
1094
  x1 = origin.X()
1091
1095
  y1 = origin.Y()
1092
1096
  z1 = origin.Z()
@@ -1102,17 +1106,17 @@ class Wire(topologic.Wire):
1102
1106
  theta = 0
1103
1107
  else:
1104
1108
  theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1105
- ellipse = topologic.TopologyUtility.Rotate(ellipse, origin, 0, 1, 0, theta)
1106
- ellipse = topologic.TopologyUtility.Rotate(ellipse, origin, 0, 0, 1, phi)
1109
+ ellipse = Topology.Rotate(ellipse, origin, 0, 1, 0, theta)
1110
+ ellipse = Topology.Rotate(ellipse, origin, 0, 0, 1, phi)
1107
1111
 
1108
1112
  # Create a Cluster of the two foci
1109
1113
  v1 = topologic.Vertex.ByCoordinates(c+origin.X(), 0+origin.Y(),0)
1110
1114
  v2 = topologic.Vertex.ByCoordinates(-c+origin.X(), 0+origin.Y(),0)
1111
1115
  foci = topologic.Cluster.ByTopologies([v1, v2])
1112
1116
  if placement.lower() == "lowerleft":
1113
- foci = topologic.TopologyUtility.Translate(foci, a, b, 0)
1114
- foci = topologic.TopologyUtility.Rotate(foci, origin, 0, 1, 0, theta)
1115
- foci = topologic.TopologyUtility.Rotate(foci, origin, 0, 0, 1, phi)
1117
+ foci = Topology.Translate(foci, a, b, 0)
1118
+ foci = Topology.Rotate(foci, origin, 0, 1, 0, theta)
1119
+ foci = Topology.Rotate(foci, origin, 0, 0, 1, phi)
1116
1120
  d = {}
1117
1121
  d['ellipse'] = ellipse
1118
1122
  d['foci'] = foci
@@ -1417,7 +1421,8 @@ class Wire(topologic.Wire):
1417
1421
  A list of faces representing the isovist projection from the input viewpoint.
1418
1422
 
1419
1423
  """
1420
-
1424
+ from topologicpy.Topology import Topology
1425
+
1421
1426
  def vertexPartofFace(vertex, face, tolerance):
1422
1427
  vertices = []
1423
1428
  _ = face.Vertices(None, vertices)
@@ -1450,7 +1455,7 @@ class Wire(topologic.Wire):
1450
1455
  d = topologic.VertexUtility.Distance(viewPoint, aVertex)
1451
1456
  if d > tolerance:
1452
1457
  scaleFactor = maxDistance/d
1453
- newV = topologic.TopologyUtility.Scale(aVertex, viewPoint, scaleFactor, scaleFactor, scaleFactor)
1458
+ newV = Topology.Scale(aVertex, viewPoint, scaleFactor, scaleFactor, scaleFactor)
1454
1459
  try:
1455
1460
  ray = topologic.Edge.ByStartVertexEndVertex(viewPoint, newV)
1456
1461
  topologyC = ray.Intersect(wire, False)
@@ -2122,7 +2127,9 @@ class Wire(topologic.Wire):
2122
2127
 
2123
2128
  """
2124
2129
  from topologicpy.Vertex import Vertex
2130
+ from topologicpy.Topology import Topology
2125
2131
  import math
2132
+
2126
2133
  if not origin:
2127
2134
  origin = topologic.Vertex.ByCoordinates(0,0,0)
2128
2135
  if not isinstance(origin, topologic.Vertex):
@@ -2192,15 +2199,15 @@ class Wire(topologic.Wire):
2192
2199
  radius = radiusA + radiusB*turns*0.5
2193
2200
  baseWire = Wire.ByVertices(vertices, close=False)
2194
2201
  if placement.lower() == "center":
2195
- baseWire = topologic.TopologyUtility.Translate(baseWire, 0, 0, -height*0.5)
2202
+ baseWire = Topology.Translate(baseWire, 0, 0, -height*0.5)
2196
2203
  if placement.lower() == "lowerleft":
2197
- baseWire = topologic.TopologyUtility.Translate(baseWire, -minX, -minY, 0)
2204
+ baseWire = Topology.Translate(baseWire, -minX, -minY, 0)
2198
2205
  elif placement.lower() == "upperleft":
2199
- baseWire = topologic.TopologyUtility.Translate(baseWire, -minX, -maxY, 0)
2206
+ baseWire = Topology.Translate(baseWire, -minX, -maxY, 0)
2200
2207
  elif placement.lower() == "lowerright":
2201
- baseWire = topologic.TopologyUtility.Translate(baseWire, -maxX, -minY, 0)
2208
+ baseWire = Topology.Translate(baseWire, -maxX, -minY, 0)
2202
2209
  elif placement.lower() == "upperright":
2203
- baseWire = topologic.TopologyUtility.Translate(baseWire, -maxX, -maxY, 0)
2210
+ baseWire = Topology.Translate(baseWire, -maxX, -maxY, 0)
2204
2211
  x1 = origin.X()
2205
2212
  y1 = origin.Y()
2206
2213
  z1 = origin.Z()
@@ -2216,8 +2223,8 @@ class Wire(topologic.Wire):
2216
2223
  theta = 0
2217
2224
  else:
2218
2225
  theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
2219
- baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 1, 0, theta)
2220
- baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 0, 1, phi)
2226
+ baseWire = Topology.Rotate(baseWire, origin, 0, 1, 0, theta)
2227
+ baseWire = Topology.Rotate(baseWire, origin, 0, 0, 1, phi)
2221
2228
  return baseWire
2222
2229
 
2223
2230
  @staticmethod
@@ -2352,6 +2359,7 @@ class Wire(topologic.Wire):
2352
2359
  The created star.
2353
2360
 
2354
2361
  """
2362
+ from topologicpy.Topology import Topology
2355
2363
 
2356
2364
  if not origin:
2357
2365
  origin = topologic.Vertex.ByCoordinates(0,0,0)
@@ -2428,8 +2436,8 @@ class Wire(topologic.Wire):
2428
2436
  theta = 0
2429
2437
  else:
2430
2438
  theta = math.degrees(math.acos(dz/dist)) # Rotation around Y-Axis
2431
- baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 1, 0, theta)
2432
- baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 0, 1, phi)
2439
+ baseWire = Topology.Rotate(baseWire, origin, 0, 1, 0, theta)
2440
+ baseWire = Topology.Rotate(baseWire, origin, 0, 0, 1, phi)
2433
2441
  return baseWire
2434
2442
 
2435
2443
  @staticmethod
@@ -2464,6 +2472,8 @@ class Wire(topologic.Wire):
2464
2472
  The created trapezoid.
2465
2473
 
2466
2474
  """
2475
+ from topologicpy.Topology import Topology
2476
+
2467
2477
  if not origin:
2468
2478
  origin = topologic.Vertex.ByCoordinates(0,0,0)
2469
2479
  if not isinstance(origin, topologic.Vertex):
@@ -2514,8 +2524,8 @@ class Wire(topologic.Wire):
2514
2524
  theta = 0
2515
2525
  else:
2516
2526
  theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
2517
- baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 1, 0, theta)
2518
- baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 0, 1, phi)
2527
+ baseWire = Topology.Rotate(baseWire, origin, 0, 1, 0, theta)
2528
+ baseWire = Topology.Rotate(baseWire, origin, 0, 0, 1, phi)
2519
2529
  return baseWire
2520
2530
 
2521
2531
  @staticmethod