topologicpy 0.4.55__py3-none-any.whl → 0.4.57__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/Cell.py +95 -22
- topologicpy/CellComplex.py +36 -5
- topologicpy/DGL.py +4 -1
- topologicpy/Edge.py +1 -1
- topologicpy/Face.py +86 -64
- topologicpy/Graph.py +37 -34
- topologicpy/Helper.py +83 -44
- topologicpy/Plotly.py +15 -14
- topologicpy/Shell.py +70 -28
- topologicpy/Topology.py +155 -174
- topologicpy/Wire.py +64 -146
- topologicpy/__init__.py +22 -22
- topologicpy/bin/linux/topologic/__init__.py +2 -2
- topologicpy/bin/linux/topologic/topologic.cpython-310-x86_64-linux-gnu.so +0 -0
- topologicpy/bin/linux/topologic/topologic.cpython-311-x86_64-linux-gnu.so +0 -0
- topologicpy/bin/linux/topologic/topologic.cpython-38-x86_64-linux-gnu.so +0 -0
- topologicpy/bin/linux/topologic/topologic.cpython-39-x86_64-linux-gnu.so +0 -0
- topologicpy/bin/linux/topologic.libs/libTKBO-6bdf205d.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKBRep-2960a069.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKBool-c44b74bd.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKFillet-9a670ba0.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKG2d-8f31849e.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKG3d-4c6bce57.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKGeomAlgo-26066fd9.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKGeomBase-2116cabe.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKMath-72572fa8.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKMesh-2a060427.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKOffset-6cab68ff.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKPrim-eb1262b3.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKShHealing-e67e5cc7.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKTopAlgo-e4c96c33.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libTKernel-fb7fe3b7.so.7.7.0 +0 -0
- topologicpy/bin/linux/topologic.libs/libgcc_s-32c1665e.so.1 +0 -0
- topologicpy/bin/linux/topologic.libs/libstdc++-672d7b41.so.6.0.30 +0 -0
- topologicpy/bin/macos/topologic/__init__.py +2 -2
- topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd +0 -0
- topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd +0 -0
- topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd +0 -0
- topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd +0 -0
- {topologicpy-0.4.55.dist-info → topologicpy-0.4.57.dist-info}/METADATA +1 -1
- {topologicpy-0.4.55.dist-info → topologicpy-0.4.57.dist-info}/RECORD +44 -48
- topologicpy/bin/linux/topologic.libs/libgcc_s-b928ac34.so.1 +0 -0
- topologicpy/bin/linux/topologic.libs/libstdc++-e9ef912c.so.6.0.32 +0 -0
- topologicpy/bin/macos/topologic/topologic.cpython-310-darwin.so +0 -0
- topologicpy/bin/macos/topologic/topologic.cpython-311-darwin.so +0 -0
- topologicpy/bin/macos/topologic/topologic.cpython-38-darwin.so +0 -0
- topologicpy/bin/macos/topologic/topologic.cpython-39-darwin.so +0 -0
- {topologicpy-0.4.55.dist-info → topologicpy-0.4.57.dist-info}/LICENSE +0 -0
- {topologicpy-0.4.55.dist-info → topologicpy-0.4.57.dist-info}/WHEEL +0 -0
- {topologicpy-0.4.55.dist-info → topologicpy-0.4.57.dist-info}/top_level.txt +0 -0
topologicpy/Shell.py
CHANGED
|
@@ -456,13 +456,11 @@ class Shell(Topology):
|
|
|
456
456
|
|
|
457
457
|
"""
|
|
458
458
|
from topologicpy.Vertex import Vertex
|
|
459
|
-
from topologicpy.Edge import Edge
|
|
460
459
|
from topologicpy.Wire import Wire
|
|
461
460
|
from topologicpy.Face import Face
|
|
462
461
|
from topologicpy.Cluster import Cluster
|
|
463
462
|
from topologicpy.Topology import Topology
|
|
464
463
|
from topologicpy.Dictionary import Dictionary
|
|
465
|
-
from topologicpy.Helper import Helper
|
|
466
464
|
from random import sample
|
|
467
465
|
import sys
|
|
468
466
|
import subprocess
|
|
@@ -485,22 +483,23 @@ class Shell(Topology):
|
|
|
485
483
|
return None
|
|
486
484
|
|
|
487
485
|
# Create a Vertex at the world's origin (0,0,0)
|
|
488
|
-
world_origin = Vertex.
|
|
486
|
+
world_origin = Vertex.Origin()
|
|
489
487
|
|
|
490
488
|
if isinstance(face, topologic.Face):
|
|
491
|
-
|
|
489
|
+
# Flatten the face
|
|
490
|
+
origin = Topology.Centroid(face)
|
|
491
|
+
normal = Face.Normal(face)
|
|
492
|
+
flatFace = Topology.Flatten(face, origin=origin, direction=normal)
|
|
492
493
|
faceVertices = Face.Vertices(face)
|
|
493
494
|
vertices += faceVertices
|
|
494
495
|
# Retrieve the needed transformations
|
|
495
496
|
dictionary = Topology.Dictionary(flatFace)
|
|
496
|
-
xTran = Dictionary.ValueAtKey(dictionary,"
|
|
497
|
-
yTran = Dictionary.ValueAtKey(dictionary,"
|
|
498
|
-
zTran = Dictionary.ValueAtKey(dictionary,"
|
|
497
|
+
xTran = Dictionary.ValueAtKey(dictionary,"x")
|
|
498
|
+
yTran = Dictionary.ValueAtKey(dictionary,"y")
|
|
499
|
+
zTran = Dictionary.ValueAtKey(dictionary,"z")
|
|
499
500
|
phi = Dictionary.ValueAtKey(dictionary,"phi")
|
|
500
501
|
theta = Dictionary.ValueAtKey(dictionary,"theta")
|
|
501
502
|
|
|
502
|
-
|
|
503
|
-
|
|
504
503
|
# Create a cluster of the input vertices
|
|
505
504
|
verticesCluster = Cluster.ByTopologies(vertices)
|
|
506
505
|
|
|
@@ -525,16 +524,23 @@ class Shell(Topology):
|
|
|
525
524
|
tempTriangleVertices.append(vertices[simplex[0]])
|
|
526
525
|
tempTriangleVertices.append(vertices[simplex[1]])
|
|
527
526
|
tempTriangleVertices.append(vertices[simplex[2]])
|
|
528
|
-
|
|
527
|
+
tempFace = Face.ByWire(Wire.ByVertices(tempTriangleVertices), tolerance=tolerance)
|
|
528
|
+
tempCentroid = Topology.Centroid(tempFace)
|
|
529
|
+
if Face.IsInternal(flatFace, tempCentroid):
|
|
530
|
+
faces.append(tempFace)
|
|
529
531
|
|
|
530
532
|
shell = Shell.ByFaces(faces, tolerance=tolerance)
|
|
531
|
-
if shell == None:
|
|
532
|
-
print("Shell.Delaunay - WARNING: Could not create Shell. Returning a Cluster of Faces.")
|
|
533
|
-
shell = Cluster.ByTopologies(faces)
|
|
533
|
+
#if shell == None:
|
|
534
|
+
#print("Shell.Delaunay - WARNING: Could not create Shell. Returning a Cluster of Faces.")
|
|
535
|
+
#shell = Cluster.ByTopologies(faces)
|
|
534
536
|
if isinstance(face, topologic.Face):
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
537
|
+
# Get the internal boundaries of the face
|
|
538
|
+
wires = Face.InternalBoundaries(flatFace)
|
|
539
|
+
ibList = []
|
|
540
|
+
if len(wires) > 0:
|
|
541
|
+
ibList = [Face.ByWire(w) for w in wires]
|
|
542
|
+
cluster = Cluster.ByTopologies(ibList)
|
|
543
|
+
shell = Topology.Difference(shell, cluster)
|
|
538
544
|
shell = Topology.Rotate(shell, origin=world_origin, x=0, y=1, z=0, degree=theta)
|
|
539
545
|
shell = Topology.Rotate(shell, origin=world_origin, x=0, y=0, z=1, degree=phi)
|
|
540
546
|
shell = Topology.Translate(shell, xTran, yTran, zTran)
|
|
@@ -1311,7 +1317,39 @@ class Shell(Topology):
|
|
|
1311
1317
|
shell = Topology.Rotate(shell, origin, 0, 0, 1, phi)
|
|
1312
1318
|
return shell
|
|
1313
1319
|
|
|
1314
|
-
|
|
1320
|
+
@staticmethod
|
|
1321
|
+
def RemoveCollinearEdges(shell: topologic.Shell, angTolerance: float = 0.1, tolerance: float = 0.0001) -> topologic.Wire:
|
|
1322
|
+
"""
|
|
1323
|
+
Removes any collinear edges in the input shell.
|
|
1324
|
+
|
|
1325
|
+
Parameters
|
|
1326
|
+
----------
|
|
1327
|
+
shell : topologic.Shell
|
|
1328
|
+
The input shell.
|
|
1329
|
+
angTolerance : float , optional
|
|
1330
|
+
The desired angular tolerance. The default is 0.1.
|
|
1331
|
+
tolerance : float , optional
|
|
1332
|
+
The desired tolerance. The default is 0.0001.
|
|
1333
|
+
|
|
1334
|
+
Returns
|
|
1335
|
+
-------
|
|
1336
|
+
topologic.Shell
|
|
1337
|
+
The created shell without any collinear edges.
|
|
1338
|
+
|
|
1339
|
+
"""
|
|
1340
|
+
from topologicpy.Face import Face
|
|
1341
|
+
|
|
1342
|
+
if not isinstance(shell, topologic.Shell):
|
|
1343
|
+
print("Shell.RemoveCollinearEdges - Error: The input shell parameter is not a valid shell. Returning None.")
|
|
1344
|
+
return None
|
|
1345
|
+
faces = Shell.Faces(shell)
|
|
1346
|
+
clean_faces = []
|
|
1347
|
+
for face in faces:
|
|
1348
|
+
clean_faces.append(Face.RemoveCollinearEdges(face, angTolerance=angTolerance, tolerance=tolerance))
|
|
1349
|
+
return Shell.ByFaces(clean_faces, tolerance=tolerance)
|
|
1350
|
+
|
|
1351
|
+
@staticmethod
|
|
1352
|
+
def Roof(face, degree: float = 45, epsilon: float = 0.01, tolerance: float = 0.001):
|
|
1315
1353
|
"""
|
|
1316
1354
|
Creates a hipped roof through a straight skeleton. This method is contributed by 高熙鹏 xipeng gao <gaoxipeng1998@gmail.com>
|
|
1317
1355
|
This algorithm depends on the polyskel code which is included in the library. Polyskel code is found at: https://github.com/Botffy/polyskel
|
|
@@ -1322,8 +1360,8 @@ class Shell(Topology):
|
|
|
1322
1360
|
The input face.
|
|
1323
1361
|
degree : float , optioal
|
|
1324
1362
|
The desired angle in degrees of the roof. The default is 45.
|
|
1325
|
-
|
|
1326
|
-
The desired
|
|
1363
|
+
epsilon : float , optional
|
|
1364
|
+
The desired epsilon (another form of tolerance for distance from plane). The default is 0.01. (This is set to a larger number as it was found to work better)
|
|
1327
1365
|
tolerance : float , optional
|
|
1328
1366
|
The desired tolerance. The default is 0.001. (This is set to a larger number as it was found to work better)
|
|
1329
1367
|
|
|
@@ -1360,7 +1398,9 @@ class Shell(Topology):
|
|
|
1360
1398
|
return None
|
|
1361
1399
|
if degree < tolerance:
|
|
1362
1400
|
return None
|
|
1363
|
-
|
|
1401
|
+
origin = Topology.Centroid(face)
|
|
1402
|
+
normal = Face.Normal(face)
|
|
1403
|
+
flat_face = Topology.Flatten(face, origin=origin, direction=normal)
|
|
1364
1404
|
d = Topology.Dictionary(flat_face)
|
|
1365
1405
|
roof = Wire.Roof(flat_face, degree=degree, tolerance=tolerance)
|
|
1366
1406
|
if not roof:
|
|
@@ -1409,12 +1449,12 @@ class Shell(Topology):
|
|
|
1409
1449
|
if not shell:
|
|
1410
1450
|
shell = Cluster.ByTopologies(final_faces)
|
|
1411
1451
|
try:
|
|
1412
|
-
shell = Topology.RemoveCoplanarFaces(shell,
|
|
1452
|
+
shell = Topology.RemoveCoplanarFaces(shell, epsilon=epsilon, tolerance=tolerance)
|
|
1413
1453
|
except:
|
|
1414
1454
|
pass
|
|
1415
|
-
xTran = Dictionary.ValueAtKey(d,"
|
|
1416
|
-
yTran = Dictionary.ValueAtKey(d,"
|
|
1417
|
-
zTran = Dictionary.ValueAtKey(d,"
|
|
1455
|
+
xTran = Dictionary.ValueAtKey(d,"x")
|
|
1456
|
+
yTran = Dictionary.ValueAtKey(d,"y")
|
|
1457
|
+
zTran = Dictionary.ValueAtKey(d,"z")
|
|
1418
1458
|
phi = Dictionary.ValueAtKey(d,"phi")
|
|
1419
1459
|
theta = Dictionary.ValueAtKey(d,"theta")
|
|
1420
1460
|
shell = Topology.Rotate(shell, origin=Vertex.Origin(), x=0, y=1, z=0, degree=theta)
|
|
@@ -1758,12 +1798,14 @@ class Shell(Topology):
|
|
|
1758
1798
|
return None
|
|
1759
1799
|
|
|
1760
1800
|
# Flatten the input face
|
|
1761
|
-
|
|
1801
|
+
origin = Topology.Centroid(face)
|
|
1802
|
+
normal = Face.Normal(face)
|
|
1803
|
+
flatFace = Topology.Flatten(face, origin=origin, direction=normal)
|
|
1762
1804
|
# Retrieve the needed transformations
|
|
1763
1805
|
dictionary = Topology.Dictionary(flatFace)
|
|
1764
|
-
xTran = Dictionary.ValueAtKey(dictionary,"
|
|
1765
|
-
yTran = Dictionary.ValueAtKey(dictionary,"
|
|
1766
|
-
zTran = Dictionary.ValueAtKey(dictionary,"
|
|
1806
|
+
xTran = Dictionary.ValueAtKey(dictionary,"x")
|
|
1807
|
+
yTran = Dictionary.ValueAtKey(dictionary,"y")
|
|
1808
|
+
zTran = Dictionary.ValueAtKey(dictionary,"z")
|
|
1767
1809
|
phi = Dictionary.ValueAtKey(dictionary,"phi")
|
|
1768
1810
|
theta = Dictionary.ValueAtKey(dictionary,"theta")
|
|
1769
1811
|
|