topologicpy 0.7.74__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/Face.py CHANGED
@@ -132,7 +132,6 @@ class Face():
132
132
  dirA = Face.Normal(faceA, outputType="xyz", mantissa=3)
133
133
  dirB = Face.Normal(faceB, outputType="xyz", mantissa=3)
134
134
  if dirA == None or dirB == None:
135
- Topology.Show(faceA, faceB)
136
135
  print("Face.Angle - Error: Could not compute the angle between the two input faces. Returning None.")
137
136
  return None
138
137
  return round((Vector.Angle(dirA, dirB)), mantissa)
@@ -1707,10 +1706,11 @@ class Face():
1707
1706
  else:
1708
1707
  obstacles = []
1709
1708
 
1710
- origin = Vertex.Origin()
1709
+ origin = Topology.Centroid(face)
1711
1710
  normal = Face.Normal(face)
1712
1711
  flat_face = Topology.Flatten(face, origin=origin, direction=normal)
1713
1712
  flat_vertex = Topology.Flatten(vertex, origin=origin, direction=normal)
1713
+
1714
1714
  eb = Face.ExternalBoundary(flat_face)
1715
1715
  vertices = Topology.Vertices(eb)
1716
1716
  coords = [Vertex.Coordinates(v, outputType="xy") for v in vertices]
@@ -1728,6 +1728,7 @@ class Face():
1728
1728
  flat_face = Face.ByWires(eb, new_ib_list)
1729
1729
  for obs in obstacles:
1730
1730
  flat_face = Topology.Difference(flat_face, Face.ByWire(obs))
1731
+
1731
1732
  targets = Topology.Vertices(flat_face)
1732
1733
  distances = []
1733
1734
  for target in targets:
@@ -1748,6 +1749,7 @@ class Face():
1748
1749
  final_faces.append(f)
1749
1750
  shell = Shell.ByFaces(final_faces)
1750
1751
  return_face = Topology.RemoveCoplanarFaces(shell, epsilon=0.1)
1752
+
1751
1753
  if not Topology.IsInstance(return_face, "face"):
1752
1754
  temp = Shell.ExternalBoundary(shell)
1753
1755
  if Topology.IsInstance(temp, "Wire"):
@@ -1767,17 +1769,16 @@ class Face():
1767
1769
  if not Topology.IsInstance(return_face, "Face"):
1768
1770
  print("Face.Isovist - Error: Could not create isovist. Returning None.")
1769
1771
  return None
1770
-
1771
1772
  compAngle = 0
1772
1773
  if fov == 360:
1773
- pie = Face.Circle(origin= vertex, radius=max_d, sides=180)
1774
+ pie = Face.Circle(origin= flat_vertex, radius=max_d*1.2, sides=16)
1774
1775
  else:
1775
- compAngle = Vector.CompassAngle(Vector.North(), direction, mantissa=mantissa, tolerance=tolerance) - 90
1776
- fromAngle = -fov*0.5 - compAngle
1777
- toAngle = fov*0.5 - compAngle
1778
- c = Wire.Circle(origin= vertex, radius=max_d, sides=180, fromAngle=fromAngle, toAngle=toAngle, close = False)
1779
- e1 = Edge.ByVertices(Wire.StartVertex(c), vertex, silent=True)
1780
- e2 = Edge.ByVertices(Wire.EndVertex(c), vertex, silent=True)
1776
+ compAngle = Vector.CompassAngle(Vector.North(), direction, mantissa=mantissa, tolerance=tolerance)
1777
+ fromAngle = compAngle - fov*0.5
1778
+ toAngle = compAngle + fov*0.5
1779
+ c = Wire.Circle(origin= flat_vertex, radius=max_d*1.2, sides=int(16*(fov/360)), fromAngle=fromAngle, toAngle=toAngle, close = False)
1780
+ e1 = Edge.ByVertices(Wire.StartVertex(c), flat_vertex, silent=True)
1781
+ e2 = Edge.ByVertices(Wire.EndVertex(c), flat_vertex, silent=True)
1781
1782
  edges = Topology.Edges(c) + [e1,e2]
1782
1783
  pie = Face.ByWire(Topology.SelfMerge(Cluster.ByTopologies(edges)))
1783
1784
  return_face = Topology.Intersect(pie, return_face)
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.xyz", token=None):
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.74'
1
+ __version__ = '0.7.76'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.74
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 >=1.18.0
33
- Requires-Dist: scipy >=1.4.1
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: topologic-core >=7.0.1
39
+ Requires-Dist: topologic_core>=7.0.1
40
40
  Provides-Extra: test
41
- Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'test'
41
+ Requires-Dist: pytest-xdist>=2.4.0; extra == "test"
42
42
 
43
43
  # topologicpy
44
44
 
@@ -10,7 +10,7 @@ topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
10
10
  topologicpy/Dictionary.py,sha256=0AsGoz48pGTye_F4KcJopNjD9STeQ50LHc6PPvERFaA,31932
11
11
  topologicpy/Edge.py,sha256=9u9SdUxuenLUIK26xwFvPoYV34p0dCfXmHHBxdgvAdM,67164
12
12
  topologicpy/EnergyModel.py,sha256=AqTtmXE35SxvRXhG3vYAQd7GQDW-6HtjYPHua6ME4Eg,53762
13
- topologicpy/Face.py,sha256=q7x6auTju6IS3mdOhhXZdU3rqKSuJCE-5EOfxofDDMI,124348
13
+ topologicpy/Face.py,sha256=9E3AaTCkcENwmTbFgyZKkdmhjVXHO_q9clQSji2685M,124363
14
14
  topologicpy/Graph.py,sha256=BuSg8ilbZd2Qqoenmtw5FrkSe1fDLFS6jshljvq4dOs,416822
15
15
  topologicpy/Grid.py,sha256=9N6PE84qCm40TRi2WtlVZSBwXXr47zHpscEpZHg_JW4,18205
16
16
  topologicpy/Helper.py,sha256=Sv35czP_j0oLDeJcN8usswUm4U3auiK1LQ_Z_HBvxxg,21716
@@ -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=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
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=_XwNUtWN5b4vRt6q08wKnk-7iLHDZXyRKXWBhgnWyP4,23
32
- topologicpy-0.7.74.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
- topologicpy-0.7.74.dist-info/METADATA,sha256=QQ-v5awljewQVDPhAMmdZdVtUcKzJh4LRiYGoCePtmk,10493
34
- topologicpy-0.7.74.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
35
- topologicpy-0.7.74.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
- topologicpy-0.7.74.dist-info/RECORD,,
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5