topologicpy 0.7.24__py3-none-any.whl → 0.7.27__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/ANN.py +8 -2
- topologicpy/Cell.py +2 -2
- topologicpy/Cluster.py +2 -1
- topologicpy/Dictionary.py +1 -1
- topologicpy/Edge.py +15 -12
- topologicpy/Face.py +66 -57
- topologicpy/Graph.py +3 -3
- topologicpy/Shell.py +3 -3
- topologicpy/Topology.py +264 -44
- topologicpy/Vector.py +6 -0
- topologicpy/Vertex.py +3 -3
- topologicpy/Wire.py +209 -175
- topologicpy/version.py +1 -1
- {topologicpy-0.7.24.dist-info → topologicpy-0.7.27.dist-info}/METADATA +1 -1
- topologicpy-0.7.27.dist-info/RECORD +34 -0
- {topologicpy-0.7.24.dist-info → topologicpy-0.7.27.dist-info}/WHEEL +1 -1
- topologicpy-0.7.24.dist-info/RECORD +0 -34
- {topologicpy-0.7.24.dist-info → topologicpy-0.7.27.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.24.dist-info → topologicpy-0.7.27.dist-info}/top_level.txt +0 -0
topologicpy/ANN.py
CHANGED
@@ -110,7 +110,7 @@ import numpy as np
|
|
110
110
|
class _ANN(nn.Module):
|
111
111
|
def __init__(self, input_size, hyperparameters, dataset=None):
|
112
112
|
super(_ANN, self).__init__()
|
113
|
-
self.title =
|
113
|
+
self.title = hyperparameters.get('title', 'Untitled')
|
114
114
|
self.task_type = hyperparameters['task_type']
|
115
115
|
self.cross_val_type = hyperparameters['cross_val_type']
|
116
116
|
self.k_folds = hyperparameters.get('k_folds', 5)
|
@@ -576,6 +576,10 @@ class ANN():
|
|
576
576
|
interval = 1,
|
577
577
|
mantissa = 6):
|
578
578
|
"""
|
579
|
+
Returns a Hyperparameters dictionary based on the input parameters.
|
580
|
+
|
581
|
+
Parameters
|
582
|
+
----------
|
579
583
|
title : str , optional
|
580
584
|
The desired title for the dataset. The default is "Untitled".
|
581
585
|
taskType : str , optional
|
@@ -623,6 +627,7 @@ class ANN():
|
|
623
627
|
-------
|
624
628
|
dict
|
625
629
|
Returns a dictionary with the following keys:
|
630
|
+
'title'
|
626
631
|
'task_type'
|
627
632
|
'test_ratio'
|
628
633
|
'validation_ratio'
|
@@ -632,13 +637,14 @@ class ANN():
|
|
632
637
|
'batch_size'
|
633
638
|
'early_stopping'
|
634
639
|
'patience'
|
635
|
-
'
|
640
|
+
'random_state'
|
636
641
|
'cross_val_type'
|
637
642
|
'kFolds'
|
638
643
|
'interval'
|
639
644
|
'mantissa'
|
640
645
|
"""
|
641
646
|
return {
|
647
|
+
'title': title,
|
642
648
|
'task_type': taskType,
|
643
649
|
'test_ratio': testRatio,
|
644
650
|
'validation_ratio': validationRatio,
|
topologicpy/Cell.py
CHANGED
@@ -99,7 +99,7 @@ class Cell():
|
|
99
99
|
tolerance : float , optional
|
100
100
|
The desired tolerance. The default is 0.0001.
|
101
101
|
silent : bool , optional
|
102
|
-
If set to
|
102
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
103
103
|
|
104
104
|
Returns
|
105
105
|
-------
|
@@ -384,7 +384,7 @@ class Cell():
|
|
384
384
|
tolerance : float , optional
|
385
385
|
The desired tolerance. The default is 0.0001.
|
386
386
|
silent : bool , optional
|
387
|
-
If set to
|
387
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
388
388
|
|
389
389
|
Raises
|
390
390
|
------
|
topologicpy/Cluster.py
CHANGED
@@ -154,7 +154,8 @@ class Cluster():
|
|
154
154
|
transferDictionaries : bool , optional
|
155
155
|
If set to True, the dictionaries from the input topologies are merged and transferred to the cluster. Otherwise they are not. The default is False.
|
156
156
|
silent : bool , optional
|
157
|
-
If set to True, error and warning messages are
|
157
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
158
|
+
|
158
159
|
Returns
|
159
160
|
-------
|
160
161
|
topologic_core.Cluster
|
topologicpy/Dictionary.py
CHANGED
@@ -162,7 +162,7 @@ class Dictionary():
|
|
162
162
|
dictionaries : list or comma separated dictionaries
|
163
163
|
The input list of dictionaries to be merged.
|
164
164
|
silent : bool , optional
|
165
|
-
If set to True, error and warning messages are
|
165
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
166
166
|
|
167
167
|
Returns
|
168
168
|
-------
|
topologicpy/Edge.py
CHANGED
@@ -232,7 +232,7 @@ class Edge():
|
|
232
232
|
tolerance : float , optional
|
233
233
|
The desired tolerance to decide if an Edge can be created. The default is 0.0001.
|
234
234
|
silent : bool , optional
|
235
|
-
If set to
|
235
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
236
236
|
|
237
237
|
Returns
|
238
238
|
-------
|
@@ -280,7 +280,7 @@ class Edge():
|
|
280
280
|
tolerance : float , optional
|
281
281
|
The desired tolerance to decide if an edge can be created. The default is 0.0001.
|
282
282
|
silent : bool , optional
|
283
|
-
If set to True, error and warning messages are printed. Otherwise, they are
|
283
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
284
284
|
|
285
285
|
Returns
|
286
286
|
-------
|
@@ -475,10 +475,12 @@ class Edge():
|
|
475
475
|
The first input edge. This edge will be extended to meet edgeB.
|
476
476
|
edgeB : topologic_core.Edge
|
477
477
|
The second input edge. This edge will be used to extend edgeA.
|
478
|
+
mantissa : int , optional
|
479
|
+
The desired length of the mantissa. The default is 6.
|
478
480
|
tolerance : float , optional
|
479
481
|
The desired tolerance. The default is 0.0001.
|
480
482
|
silent : bool , optional
|
481
|
-
If set to True,
|
483
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
482
484
|
|
483
485
|
Returns
|
484
486
|
-------
|
@@ -530,7 +532,8 @@ class Edge():
|
|
530
532
|
intVertex = Topology.Intersect(new_edge, edgeB, tolerance=tolerance)
|
531
533
|
if intVertex:
|
532
534
|
return Edge.ByVertices([v1, intVertex], tolerance=tolerance, silent=True)
|
533
|
-
|
535
|
+
if not silent:
|
536
|
+
print("Edge.ExtendToEdge - Error: The operation failed. Returning None.")
|
534
537
|
return None
|
535
538
|
|
536
539
|
@staticmethod
|
@@ -764,8 +767,8 @@ class Edge():
|
|
764
767
|
The second input edge.
|
765
768
|
mantissa : int , optional
|
766
769
|
The desired length of the mantissa. The default is 6.
|
767
|
-
|
768
|
-
The
|
770
|
+
tolerance : float , optional
|
771
|
+
The desired tolerance. The default is 0.0001.
|
769
772
|
|
770
773
|
Returns
|
771
774
|
-------
|
@@ -934,11 +937,11 @@ class Edge():
|
|
934
937
|
if not Topology.IsInstance(edge, "Edge"):
|
935
938
|
print("Edge.Normal - Error: The input edge parameter is not a valid edge. Returning None.")
|
936
939
|
return None
|
937
|
-
normal_edge = Edge.
|
940
|
+
normal_edge = Edge.NormalEdge(edge, length=1.0, u=0.5, angle=angle)
|
938
941
|
return Edge.Direction(normal_edge)
|
939
942
|
|
940
943
|
@staticmethod
|
941
|
-
def
|
944
|
+
def NormalEdge(edge, length: float = 1.0, u: float = 0.5, angle: float = 0.0):
|
942
945
|
"""
|
943
946
|
Returns the normal (perpendicular) vector to the input edge as an edge.
|
944
947
|
|
@@ -994,10 +997,10 @@ class Edge():
|
|
994
997
|
return start_vertex, list(normal_end_vertex)
|
995
998
|
|
996
999
|
if not Topology.IsInstance(edge, "Edge"):
|
997
|
-
print("Edge.
|
1000
|
+
print("Edge.NormalEdge - Error: The input edge parameter is not a valid edge. Returning None.")
|
998
1001
|
return None
|
999
1002
|
if length <= 0.0:
|
1000
|
-
print("Edge.
|
1003
|
+
print("Edge.NormalEdge - Error: The input length parameter is not a positive number greater than zero. Returning None.")
|
1001
1004
|
return None
|
1002
1005
|
edge_direction = Edge.Direction(edge)
|
1003
1006
|
x, y, z = edge_direction
|
@@ -1060,7 +1063,7 @@ class Edge():
|
|
1060
1063
|
mantissa : int , optional
|
1061
1064
|
The desired length of the mantissa. The default is 6.
|
1062
1065
|
silent : bool , optional
|
1063
|
-
If set to
|
1066
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
1064
1067
|
|
1065
1068
|
Returns
|
1066
1069
|
-------
|
@@ -1236,7 +1239,7 @@ class Edge():
|
|
1236
1239
|
tolerance : float , optional
|
1237
1240
|
The desired tolerance. The default is 0.0001.
|
1238
1241
|
silent : bool , optional
|
1239
|
-
If set to True,
|
1242
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
1240
1243
|
|
1241
1244
|
Returns
|
1242
1245
|
-------
|
topologicpy/Face.py
CHANGED
@@ -133,6 +133,10 @@ class Face():
|
|
133
133
|
return None
|
134
134
|
dirA = Face.Normal(faceA, outputType="xyz", mantissa=3)
|
135
135
|
dirB = Face.Normal(faceB, outputType="xyz", mantissa=3)
|
136
|
+
if dirA == None or dirB == None:
|
137
|
+
Topology.Show(faceA, faceB)
|
138
|
+
print("Face.Angle - Error: Could not compute the angle between the two input faces. Returning None.")
|
139
|
+
return None
|
136
140
|
return round((Vector.Angle(dirA, dirB)), mantissa)
|
137
141
|
|
138
142
|
@staticmethod
|
@@ -559,8 +563,8 @@ class Face():
|
|
559
563
|
The input wire.
|
560
564
|
tolerance : float , optional
|
561
565
|
The desired tolerance. The default is 0.0001.
|
562
|
-
|
563
|
-
If set to
|
566
|
+
silent : bool , optional
|
567
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
564
568
|
|
565
569
|
Returns
|
566
570
|
-------
|
@@ -648,7 +652,7 @@ class Face():
|
|
648
652
|
tolerance : float , optional
|
649
653
|
The desired tolerance. The default is 0.0001.
|
650
654
|
silent : bool , optional
|
651
|
-
If set to
|
655
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
652
656
|
|
653
657
|
Returns
|
654
658
|
-------
|
@@ -691,7 +695,7 @@ class Face():
|
|
691
695
|
tolerance : float , optional
|
692
696
|
The desired tolerance. The default is 0.0001.
|
693
697
|
silent : bool , optional
|
694
|
-
If set to
|
698
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
695
699
|
|
696
700
|
Returns
|
697
701
|
-------
|
@@ -1119,7 +1123,7 @@ class Face():
|
|
1119
1123
|
tolerance : float , optional
|
1120
1124
|
The desired tolerance. The default is 0.0001.
|
1121
1125
|
silent : bool , optional
|
1122
|
-
If set to
|
1126
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
1123
1127
|
|
1124
1128
|
Returns
|
1125
1129
|
-------
|
@@ -1684,6 +1688,7 @@ class Face():
|
|
1684
1688
|
from topologicpy.Vertex import Vertex
|
1685
1689
|
import os
|
1686
1690
|
import warnings
|
1691
|
+
|
1687
1692
|
try:
|
1688
1693
|
import numpy as np
|
1689
1694
|
except:
|
@@ -1703,60 +1708,64 @@ class Face():
|
|
1703
1708
|
print("Face.Normal - Error: The input face parameter is not a valid face. Returning None.")
|
1704
1709
|
return None
|
1705
1710
|
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1711
|
+
return_normal = None
|
1712
|
+
try:
|
1713
|
+
return_normal = list(topologic.FaceUtility.NormalAtParameters(face, 0.5, 0.5))
|
1714
|
+
except:
|
1715
|
+
vertices = Topology.Vertices(face)+Topology.Centroid(face)
|
1716
|
+
#v1 = Face.VertexByParameters(face, u=0, v=0)
|
1717
|
+
#v2 = Face.VertexByParameters(face, u=1, v=0)
|
1718
|
+
#v3 = Face.VertexByParameters(face, u=1, v=1)
|
1719
|
+
#vertices = [v1, v2, v3]
|
1720
|
+
vertices = [Vertex.Coordinates(v, mantissa=mantissa) for v in vertices]
|
1721
|
+
|
1722
|
+
if len(vertices) < 3:
|
1723
|
+
print("Face.Normal - Error: At least three vertices are required to define a plane. Returning None.")
|
1724
|
+
return None
|
1725
|
+
|
1726
|
+
# Convert vertices to numpy array for easier manipulation
|
1727
|
+
vertices = np.array(vertices)
|
1728
|
+
|
1729
|
+
# Try to find two non-collinear edge vectors
|
1730
|
+
vec1 = None
|
1731
|
+
vec2 = None
|
1732
|
+
for i in range(1, len(vertices)):
|
1733
|
+
for j in range(i + 1, len(vertices)):
|
1734
|
+
temp_vec1 = vertices[i] - vertices[0]
|
1735
|
+
temp_vec2 = vertices[j] - vertices[0]
|
1736
|
+
cross_product = np.cross(temp_vec1, temp_vec2)
|
1737
|
+
if np.linalg.norm(cross_product) > 1e-6: # Check if the cross product is not near zero
|
1738
|
+
vec1 = temp_vec1
|
1739
|
+
vec2 = temp_vec2
|
1740
|
+
break
|
1741
|
+
if vec1 is not None and vec2 is not None:
|
1731
1742
|
break
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
# Calculate the cross product of the two edge vectors
|
1740
|
-
normal = np.cross(vec1, vec2)
|
1743
|
+
|
1744
|
+
if vec1 is None or vec2 is None:
|
1745
|
+
print("Face.Normal - Error: The given vertices do not form a valid plane (all vertices might be collinear). Returning None.")
|
1746
|
+
return None
|
1747
|
+
|
1748
|
+
# Calculate the cross product of the two edge vectors
|
1749
|
+
normal = np.cross(vec1, vec2)
|
1741
1750
|
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1751
|
+
# Normalize the normal vector
|
1752
|
+
normal_length = np.linalg.norm(normal)
|
1753
|
+
if normal_length == 0:
|
1754
|
+
print("Face.Normal - Error: The given vertices do not form a valid plane (cross product resulted in a zero vector). Returning None.")
|
1755
|
+
return None
|
1756
|
+
|
1757
|
+
normal = normal / normal_length
|
1758
|
+
normal = normal.tolist()
|
1759
|
+
normal = [round(x, mantissa) for x in normal]
|
1760
|
+
return_normal = []
|
1761
|
+
outputType = list(outputType.lower())
|
1762
|
+
for axis in outputType:
|
1763
|
+
if axis == "x":
|
1764
|
+
return_normal.append(normal[0])
|
1765
|
+
elif axis == "y":
|
1766
|
+
return_normal.append(normal[1])
|
1767
|
+
elif axis == "z":
|
1768
|
+
return_normal.append(normal[2])
|
1760
1769
|
return return_normal
|
1761
1770
|
|
1762
1771
|
@staticmethod
|
topologicpy/Graph.py
CHANGED
@@ -158,7 +158,7 @@ class WorkerProcess(Process):
|
|
158
158
|
continue
|
159
159
|
if Vertex.Distance(source, destination) > self.tolerance:
|
160
160
|
edge = Edge.ByVertices([source, destination])
|
161
|
-
e = Topology.
|
161
|
+
e = Topology.Intersect(edge, face)
|
162
162
|
if Topology.IsInstance(e, "Edge"):
|
163
163
|
edges.append(edge)
|
164
164
|
self.used[i + self.start_index][j] = 1
|
@@ -3991,8 +3991,8 @@ class Graph:
|
|
3991
3991
|
maxColors : int , optional
|
3992
3992
|
The desired maximum number of colors to test against. The default is 3.
|
3993
3993
|
silent : bool , optional
|
3994
|
-
If set to
|
3995
|
-
|
3994
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
3995
|
+
|
3996
3996
|
Returns
|
3997
3997
|
-------
|
3998
3998
|
int
|
topologicpy/Shell.py
CHANGED
@@ -389,8 +389,8 @@ class Shell():
|
|
389
389
|
tolerance : float , optional
|
390
390
|
The desired tolerance. The default is 0.0001.
|
391
391
|
silent : bool , optional
|
392
|
-
If set to
|
393
|
-
|
392
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
393
|
+
|
394
394
|
Returns
|
395
395
|
-------
|
396
396
|
topologic_core.Shell
|
@@ -485,7 +485,7 @@ class Shell():
|
|
485
485
|
tolerance : float , optional
|
486
486
|
The desired tolerance. The default is 0.0001.
|
487
487
|
silent : bool , optional
|
488
|
-
If set to
|
488
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
489
489
|
|
490
490
|
Returns
|
491
491
|
-------
|