topologicpy 0.7.75__py3-none-any.whl → 0.7.76__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/Speckle.py +124 -4
- topologicpy/version.py +1 -1
- {topologicpy-0.7.75.dist-info → topologicpy-0.7.76.dist-info}/METADATA +5 -5
- {topologicpy-0.7.75.dist-info → topologicpy-0.7.76.dist-info}/RECORD +7 -7
- {topologicpy-0.7.75.dist-info → topologicpy-0.7.76.dist-info}/WHEEL +1 -1
- {topologicpy-0.7.75.dist-info → topologicpy-0.7.76.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.75.dist-info → topologicpy-0.7.76.dist-info}/top_level.txt +0 -0
topologicpy/Speckle.py
CHANGED
@@ -18,10 +18,22 @@ from specklepy.api.client import SpeckleClient
|
|
18
18
|
from specklepy.api.wrapper import StreamWrapper
|
19
19
|
from specklepy.api import operations
|
20
20
|
from specklepy.objects import Base
|
21
|
+
from specklepy.objects.other import Collection
|
21
22
|
from specklepy.objects.other import RenderMaterial
|
22
23
|
from specklepy.transports.server import ServerTransport
|
23
|
-
from topologicpy.Topology import Topology
|
24
24
|
from specklepy.objects.geometry import (Mesh, Point, Polyline)
|
25
|
+
|
26
|
+
from topologicpy.Topology import Topology
|
27
|
+
from topologicpy.Vertex import Vertex
|
28
|
+
from topologicpy.Face import Face
|
29
|
+
from topologicpy.Cell import Cell
|
30
|
+
from topologicpy.CellComplex import CellComplex
|
31
|
+
from topologicpy.Graph import Graph
|
32
|
+
from topologicpy.Dictionary import Dictionary
|
33
|
+
|
34
|
+
from collections import deque
|
35
|
+
from typing import List
|
36
|
+
|
25
37
|
class Speckle:
|
26
38
|
|
27
39
|
@staticmethod
|
@@ -108,7 +120,7 @@ class Speckle:
|
|
108
120
|
return branches
|
109
121
|
|
110
122
|
@staticmethod
|
111
|
-
def ClientByURL(url="speckle.
|
123
|
+
def ClientByURL(url="https://app.speckle.systems/", token=None):
|
112
124
|
"""
|
113
125
|
Parameters
|
114
126
|
----------
|
@@ -379,7 +391,7 @@ class Speckle:
|
|
379
391
|
transport = ServerTransport(stream.id, client)
|
380
392
|
last_obj_id = commit.referencedObject
|
381
393
|
speckle_mesh = operations.receive(obj_id=last_obj_id, remote_transport=transport)
|
382
|
-
print(speckle_mesh)
|
394
|
+
# print(speckle_mesh)
|
383
395
|
return mesh_to_native(speckle_mesh["@display_value"])
|
384
396
|
|
385
397
|
@staticmethod
|
@@ -506,4 +518,112 @@ class Speckle:
|
|
506
518
|
DESCRIPTION.
|
507
519
|
|
508
520
|
"""
|
509
|
-
return item.stream.list()
|
521
|
+
return item.stream.list()
|
522
|
+
|
523
|
+
#######################################################
|
524
|
+
# NEW METHODS TO PROCESS IFC
|
525
|
+
|
526
|
+
@staticmethod
|
527
|
+
def SpeckleObject(client, stream, branch, commit):
|
528
|
+
transport = ServerTransport(stream.id, client)
|
529
|
+
last_obj_id = commit.referencedObject
|
530
|
+
speckle_mesh = operations.receive(obj_id=last_obj_id, remote_transport=transport)
|
531
|
+
|
532
|
+
return speckle_mesh
|
533
|
+
|
534
|
+
@staticmethod
|
535
|
+
def get_name_from_IFC_name(name) -> str:
|
536
|
+
"Function is used to get clean speckle element name"
|
537
|
+
|
538
|
+
import re
|
539
|
+
mapping = {
|
540
|
+
"IFC_WALL_REG": r"(Wall)",
|
541
|
+
"IFC_SLAB_REG": r"(Slab)",
|
542
|
+
"IFC_WINDOW_REG": r"(Window)",
|
543
|
+
"IFC_COLUMN_REG": r"(Column)",
|
544
|
+
"IFC_DOOR_REG": r"(Door)",
|
545
|
+
"IFC_SPACE_REG": r"(Space)"
|
546
|
+
}
|
547
|
+
|
548
|
+
for expression in mapping.values():
|
549
|
+
res = re.findall(expression, name)
|
550
|
+
if res:
|
551
|
+
return res[0]
|
552
|
+
|
553
|
+
|
554
|
+
@staticmethod
|
555
|
+
def TopologyBySpeckleObject(obj):
|
556
|
+
|
557
|
+
def from_points_to_vertices_3D(points) -> List[Vertex]:
|
558
|
+
points_array_length = len(points)
|
559
|
+
i = 0
|
560
|
+
topologic_vertices = []
|
561
|
+
while i < points_array_length:
|
562
|
+
x = points[i]
|
563
|
+
y = points[i+1]
|
564
|
+
z = points[i+2]
|
565
|
+
v = Vertex.ByCoordinates(x, y, z)
|
566
|
+
topologic_vertices.append(v)
|
567
|
+
|
568
|
+
i+=3
|
569
|
+
return topologic_vertices
|
570
|
+
|
571
|
+
def make_faces_from_indices(vertices, face_indices) -> List[Face]:
|
572
|
+
"Helping function used to make a triangular faces"
|
573
|
+
l = len(face_indices)
|
574
|
+
i = 0
|
575
|
+
triangles = []
|
576
|
+
|
577
|
+
while i < l:
|
578
|
+
curr = face_indices[i]
|
579
|
+
i+=1
|
580
|
+
lis = face_indices[i:curr+i]
|
581
|
+
triangles.append(lis)
|
582
|
+
i+=curr
|
583
|
+
|
584
|
+
topologic_vertices = from_points_to_vertices_3D(vertices)
|
585
|
+
faces_list = []
|
586
|
+
|
587
|
+
for triangle in triangles:
|
588
|
+
v1 = topologic_vertices[triangle[0]]
|
589
|
+
v2 = topologic_vertices[triangle[1]]
|
590
|
+
v3 = topologic_vertices[triangle[2]]
|
591
|
+
f = Face.ByVertices([v1, v2, v3])
|
592
|
+
faces_list.append(f)
|
593
|
+
|
594
|
+
return faces_list
|
595
|
+
|
596
|
+
#Stack used for the tree traversal
|
597
|
+
stack = deque()
|
598
|
+
stack.append(obj)
|
599
|
+
|
600
|
+
#list of coordinates
|
601
|
+
coords = []
|
602
|
+
|
603
|
+
while len(stack) > 0:
|
604
|
+
head = stack.pop()
|
605
|
+
|
606
|
+
if isinstance(head, Collection):
|
607
|
+
for el in head.elements:
|
608
|
+
stack.append(el)
|
609
|
+
|
610
|
+
elif isinstance(head, Base):
|
611
|
+
|
612
|
+
if hasattr(head, '@displayValue'):
|
613
|
+
meshes = head['@displayValue']
|
614
|
+
# print(head.name)
|
615
|
+
if isinstance(meshes, List):
|
616
|
+
full_name = head.name
|
617
|
+
short_name = Speckle.get_name_from_IFC_name(full_name)
|
618
|
+
speckle_id = head.id
|
619
|
+
|
620
|
+
mesh_faces = []
|
621
|
+
for mesh in meshes:
|
622
|
+
# print(mesh.get_serializable_attributes())
|
623
|
+
faces = make_faces_from_indices(vertices=mesh.vertices,
|
624
|
+
face_indices=mesh.faces)
|
625
|
+
mesh_faces.append(faces)
|
626
|
+
|
627
|
+
yield [short_name, full_name, speckle_id, mesh_faces]
|
628
|
+
|
629
|
+
# stack.pop()
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.76'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.76
|
4
4
|
Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
6
6
|
License: AGPL v3 License
|
@@ -29,16 +29,16 @@ Classifier: Operating System :: OS Independent
|
|
29
29
|
Requires-Python: <3.14,>=3.8
|
30
30
|
Description-Content-Type: text/markdown
|
31
31
|
License-File: LICENSE
|
32
|
-
Requires-Dist: numpy
|
33
|
-
Requires-Dist: scipy
|
32
|
+
Requires-Dist: numpy>=1.18.0
|
33
|
+
Requires-Dist: scipy>=1.4.1
|
34
34
|
Requires-Dist: pandas
|
35
35
|
Requires-Dist: tqdm
|
36
36
|
Requires-Dist: plotly
|
37
37
|
Requires-Dist: lark
|
38
38
|
Requires-Dist: specklepy
|
39
|
-
Requires-Dist:
|
39
|
+
Requires-Dist: topologic_core>=7.0.1
|
40
40
|
Provides-Extra: test
|
41
|
-
Requires-Dist: pytest-xdist
|
41
|
+
Requires-Dist: pytest-xdist>=2.4.0; extra == "test"
|
42
42
|
|
43
43
|
# topologicpy
|
44
44
|
|
@@ -21,16 +21,16 @@ topologicpy/Plotly.py,sha256=VNUHRUNu4NUmf3HScQRml3TcwHe_ZoqXjqwttGSuU88,112642
|
|
21
21
|
topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
|
22
22
|
topologicpy/PyG.py,sha256=LU9LCCzjxGPUM31qbaJXZsTvniTtgugxJY7y612t4A4,109757
|
23
23
|
topologicpy/Shell.py,sha256=8OJjlWk9eCZ3uGOTht6ZVrcMczCafw-YWoDGueaz7eg,87673
|
24
|
-
topologicpy/Speckle.py,sha256=
|
24
|
+
topologicpy/Speckle.py,sha256=AlsGlSDuKRtX5jhVsPNSSjjbZis079HbUchDH_5RJmE,18187
|
25
25
|
topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
|
26
26
|
topologicpy/Topology.py,sha256=J1eTBp8esd9jwcQ4fY82uTjJtj6r9WiaGIZmevRxxDQ,406736
|
27
27
|
topologicpy/Vector.py,sha256=A1g83zDHep58iVPY8WQ8iHNrSOfGWFEzvVeDuMnjDNY,33078
|
28
28
|
topologicpy/Vertex.py,sha256=ZS6xK89JKokBKc0W8frdRhhuzR8c-dI1TTLt7pTf1iA,71032
|
29
29
|
topologicpy/Wire.py,sha256=eVet2OToVsXi9AkDYo35LpfMPqJ6aKGD6QkiU4-Jvs8,182271
|
30
30
|
topologicpy/__init__.py,sha256=vlPCanUbxe5NifC4pHcnhSzkmmYcs_UrZrTlVMsxcFs,928
|
31
|
-
topologicpy/version.py,sha256=
|
32
|
-
topologicpy-0.7.
|
33
|
-
topologicpy-0.7.
|
34
|
-
topologicpy-0.7.
|
35
|
-
topologicpy-0.7.
|
36
|
-
topologicpy-0.7.
|
31
|
+
topologicpy/version.py,sha256=3M8WghUyEKh4Nub9zc52IBDUVRayyZVk2cK9zf5M-VY,23
|
32
|
+
topologicpy-0.7.76.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
|
33
|
+
topologicpy-0.7.76.dist-info/METADATA,sha256=iMOr84bFL_JI4Gr37GGBrxyIb6i7TOZxJaCKcIHHj_0,10488
|
34
|
+
topologicpy-0.7.76.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
35
|
+
topologicpy-0.7.76.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
36
|
+
topologicpy-0.7.76.dist-info/RECORD,,
|
File without changes
|
File without changes
|