topologicpy 0.7.18__py3-none-any.whl → 0.7.20__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 CHANGED
@@ -1058,7 +1058,6 @@ class Cell():
1058
1058
  vertices = Vertex.Fuse(vertices)
1059
1059
  coords = [Vertex.Coordinates(v) for v in vertices]
1060
1060
  dodecahedron = Topology.RemoveCoplanarFaces(Topology.SelfMerge(Topology.ByGeometry(vertices=coords, faces=geo['faces'])))
1061
- print(dodecahedron)
1062
1061
  dodecahedron = Topology.Orient(dodecahedron, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction, tolerance=tolerance)
1063
1062
  dodecahedron = Topology.Place(dodecahedron, originA=Vertex.Origin(), originB=origin)
1064
1063
  return dodecahedron
topologicpy/Face.py CHANGED
@@ -189,7 +189,13 @@ class Face():
189
189
  from topologicpy.Topology import Topology
190
190
 
191
191
  br_wire = Wire.BoundingRectangle(topology=topology, optimize=optimize, tolerance=tolerance)
192
+ if not Topology.IsInstance(br_wire, "Wire"):
193
+ print("Face.BoundingRectangle - Warning: Could not create base wire. Returning None.")
194
+ return None
192
195
  br_face = Face.ByWire(br_wire)
196
+ if not Topology.IsInstance(br_face, "Face"):
197
+ print("Face.BoundingRectangle - Warning: Could not create face from base wire. Returning None.")
198
+ return None
193
199
  br_face = Topology.SetDictionary(br_face, Topology.Dictionary(br_wire))
194
200
  return br_face
195
201
 
@@ -225,7 +231,11 @@ class Face():
225
231
  if not Topology.IsInstance(wire, "Wire"):
226
232
  print("Face.ByEdges - Error: Could not create the required wire. Returning None.")
227
233
  return None
228
- return Face.ByWire(wire, tolerance=tolerance)
234
+ face = Face.ByWire(wire, tolerance=tolerance)
235
+ if not Topology.IsInstance(face, "Face"):
236
+ print("Face.ByEdges - Warning: Could not create face from base wire. Returning None.")
237
+ return None
238
+ return face
229
239
 
230
240
  @staticmethod
231
241
  def ByEdgesCluster(cluster, tolerance: float = 0.0001):
@@ -255,7 +265,11 @@ class Face():
255
265
  if len(edges) < 1:
256
266
  print("Face.ByEdgesCluster - Warning: The input cluster parameter does not contain any valid edges. Returning None.")
257
267
  return None
258
- return Face.ByEdges(edges, tolerance=tolerance)
268
+ face = Face.ByEdges(edges, tolerance=tolerance)
269
+ if not Topology.IsInstance(face, "Face"):
270
+ print("Face.ByEdgesCluster - Warning: Could not create face from edges. Returning None.")
271
+ return None
272
+ return face
259
273
 
260
274
  @staticmethod
261
275
  def ByOffset(face, offset: float = 1.0, tolerance: float = 0.0001):
@@ -289,7 +303,11 @@ class Face():
289
303
  offset_internal_boundaries = []
290
304
  for internal_boundary in internal_boundaries:
291
305
  offset_internal_boundaries.append(Wire.ByOffset(wire=internal_boundary, offset=offset, bisectors=False, tolerance=tolerance))
292
- return Face.ByWires(offset_external_boundary, offset_internal_boundaries, tolerance=tolerance)
306
+ face = Face.ByWires(offset_external_boundary, offset_internal_boundaries, tolerance=tolerance)
307
+ if not Topology.IsInstance(face, "Face"):
308
+ print("Face.ByOffset - Warning: Could not create face from wires. Returning None.")
309
+ return None
310
+ return face
293
311
 
294
312
  @staticmethod
295
313
  def ByShell(shell, origin= None, angTolerance: float = 0.1, tolerance: float = 0.0001, silent=False):
topologicpy/Graph.py CHANGED
@@ -280,7 +280,7 @@ class Graph:
280
280
  vertexLabelKey : str , optional
281
281
  The returned vertices are labelled according to the dictionary values stored under this key.
282
282
  If the vertexLabelKey does not exist, it will be created and the vertices are labelled numerically and stored in the vertex dictionary under this key. The default is "label".
283
- edgeWeightKey : str , optional
283
+ edgeKey : str , optional
284
284
  If set, the edges' dictionaries will be searched for this key to set their weight. If the key is set to "length" (case insensitive), the length of the edge will be used as its weight. If set to None, a weight of 1 will be used. The default is "Length".
285
285
  reverse : bool , optional
286
286
  If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not. The default is False.
@@ -515,8 +515,10 @@ class Graph:
515
515
  The input graph.
516
516
  edge : topologic_core.Edge
517
517
  The input edge.
518
- transferDictionaries : bool, optional
519
- If set to True, the dictionaries of the edge and its vertices are transferred to the graph.
518
+ transferVertexDictionaries : bool, optional
519
+ If set to True, the dictionaries of the vertices are transferred to the graph.
520
+ transferEdgeDictionaries : bool, optional
521
+ If set to True, the dictionaries of the edges are transferred to the graph.
520
522
  tolerance : float , optional
521
523
  The desired tolerance. The default is 0.0001.
522
524
 
topologicpy/Plotly.py CHANGED
@@ -1846,10 +1846,10 @@ class Plotly:
1846
1846
  """
1847
1847
  import os
1848
1848
  if not isinstance(figure, plotly.graph_objs._figure.Figure):
1849
- print("Plotly.FigureExportToPNG - Error: The input figure is not a plolty figure. Returning None.")
1849
+ print("Plotly.FigureExportToPDF - Error: The input figure is not a plolty figure. Returning None.")
1850
1850
  return None
1851
1851
  if not isinstance(path, str):
1852
- print("Plotly.FigureExportToPNG - Error: The input path is not a string. Returning None.")
1852
+ print("Plotly.FigureExportToPDF - Error: The input path is not a string. Returning None.")
1853
1853
  return None
1854
1854
  # Make sure the file extension is .pdf
1855
1855
  ext = path[len(path)-4:len(path)]
topologicpy/Shell.py CHANGED
@@ -1419,6 +1419,7 @@ class Shell():
1419
1419
  shell = Topology.RemoveCoplanarFaces(shell, epsilon=epsilon, tolerance=tolerance)
1420
1420
  except:
1421
1421
  pass
1422
+ shell = Topology.Unflatten(shell, origin=origin, direction=normal)
1422
1423
  return shell
1423
1424
 
1424
1425
  @staticmethod
@@ -1519,11 +1520,18 @@ class Shell():
1519
1520
  if not Topology.IsInstance(face, "Face"):
1520
1521
  return None
1521
1522
  roof = Wire.Skeleton(face, tolerance=tolerance)
1522
- if not roof:
1523
+ if not (Topology.IsInstance(roof, "Wire") or Topology.IsInstance(roof, "Cluster")):
1524
+ print("Shell.Skeleton - Error: Could not create base skeleton wire. Returning None.")
1523
1525
  return None
1524
1526
  br = Wire.BoundingRectangle(roof) #This works even if it is a Cluster not a Wire
1527
+ if not Topology.IsInstance(br, "Wire"):
1528
+ print("Shell.Skeleton - Error: Could not create a bounding rectangle wire. Returning None.")
1529
+ return None
1525
1530
  br = Topology.Scale(br, Topology.Centroid(br), 1.5, 1.5, 1)
1526
1531
  bf = Face.ByWire(br, tolerance=tolerance)
1532
+ if not Topology.IsInstance(bf, "Face"):
1533
+ print("Shell.Skeleton - Error: Could not create a bounding rectangle face. Returning None.")
1534
+ return None
1527
1535
  large_shell = Topology.Boolean(bf, roof, operation="slice", tolerance=tolerance)
1528
1536
  if not large_shell:
1529
1537
  return None
@@ -1536,6 +1544,9 @@ class Shell():
1536
1544
  if len(internalBoundaries) == 0:
1537
1545
  final_faces.append(f)
1538
1546
  shell = Shell.ByFaces(final_faces, tolerance=tolerance)
1547
+ if not Topology.IsInstance(shell, "Shell"):
1548
+ print("Shell.Skeleton - Error: Could not create shell. Returning None.")
1549
+ return None
1539
1550
  return shell
1540
1551
 
1541
1552
  @staticmethod
topologicpy/Topology.py CHANGED
@@ -4692,13 +4692,15 @@ class Topology():
4692
4692
  else:
4693
4693
  if isinstance(value, list):
4694
4694
  value.sort()
4695
- value = str(value)
4695
+ value = str(value)
4696
4696
  value.replace("*",".+")
4697
4697
  value = value.lower()
4698
4698
  d = Topology.Dictionary(aTopology)
4699
4699
  v = Dictionary.ValueAtKey(d, key)
4700
- if v != None:
4701
- v = v.lower()
4700
+ if v == None:
4701
+ otherTopologies.append(aTopology)
4702
+ else:
4703
+ v = str(v).lower()
4702
4704
  if searchType.lower() == "equal to":
4703
4705
  searchResult = (value == v)
4704
4706
  elif searchType.lower() == "contains":
@@ -4716,9 +4718,7 @@ class Topology():
4716
4718
  if searchResult:
4717
4719
  filteredTopologies.append(aTopology)
4718
4720
  else:
4719
- otherTopologies.append(aTopology)
4720
- else:
4721
- otherTopologies.append(aTopology)
4721
+ otherTopologies.append(aTopology)
4722
4722
  else:
4723
4723
  otherTopologies.append(aTopology)
4724
4724
  return {"filtered": filteredTopologies, "other": otherTopologies}
@@ -5454,8 +5454,6 @@ class Topology():
5454
5454
  ----------
5455
5455
  topology : topologic_core.Topology
5456
5456
  The input topology.
5457
- angTolerance : float , optional
5458
- The desired angular tolerance for removing coplanar faces. The default is 0.1.
5459
5457
  epsilon : float , optional
5460
5458
  The desired epsilon (another form of tolerance) for finding if two faces are coplanar. The default is 0.01.
5461
5459
  tolerance : float , optional
@@ -7747,7 +7745,7 @@ class Topology():
7747
7745
  typeID = 16
7748
7746
  elif name == "cell":
7749
7747
  typeID = 32
7750
- elif name == "cellComplex":
7748
+ elif name == "cellcomplex":
7751
7749
  typeID = 64
7752
7750
  elif name == "cluster":
7753
7751
  typeID = 128
topologicpy/Wire.py CHANGED
@@ -152,7 +152,9 @@ class Wire(Topology):
152
152
  topology : topologic_core.Topology
153
153
  The input topology.
154
154
  optimize : int , optional
155
- If set to an integer from 1 (low optimization) to 10 (high optimization), the method will attempt to optimize the bounding rectangle so that it reduces its surface area. The default is 0 which will result in an axis-aligned bounding rectangle. The default is 0.
155
+ If set to an integer from 1 (low optimization) to 10 (high optimization), the method will attempt to optimize the bounding rectangle so that it reduces its surface area.
156
+ The minimum optimization number of 0 will result in an axis-aligned bounding rectangle.
157
+ A maximum optimization number of 10 will attempt to reduce the bounding rectangle's area by 50%. The default is 0.
156
158
  mantissa : int , optional
157
159
  The desired length of the mantissa. The default is 6.
158
160
  tolerance : float , optional
@@ -190,9 +192,11 @@ class Wire(Topology):
190
192
  if not Topology.IsInstance(topology, "Topology"):
191
193
  return None
192
194
 
193
- world_origin = Vertex.Origin()
194
195
 
195
196
  vertices = Topology.SubTopologies(topology=topology, subTopologyType="vertex")
197
+ if Vertex.AreCollinear(vertices, mantissa=mantissa, tolerance=tolerance):
198
+ print("Wire.BoundingRectangle - Error: All vertices of the input topology parameter are collinear and thus no bounding rectangle can be created. Returning None.")
199
+ return None
196
200
  start = time.time()
197
201
  period = 0
198
202
  result = True
@@ -205,7 +209,13 @@ class Wire(Topology):
205
209
  print("Wire.BoundingRectangle - Error: Could not find three vertices that are not colinear within 30 seconds. Returning None.")
206
210
  return None
207
211
  w = Wire.ByVertices(vList)
212
+ if not Topology.IsInstance(w, "Wire"):
213
+ print("Wire.BoundingRectangle - Error: Could not create wire from three vertices. Returning None.")
214
+ return None
208
215
  f = Face.ByWire(w, tolerance=tolerance)
216
+ if not Topology.IsInstance(f, "Face"):
217
+ print("Wire.BoundingRectangle - Error: Could not create face from wire. Returning None.")
218
+ return None
209
219
  f_origin = Topology.Centroid(f)
210
220
  normal = Face.Normal(f, mantissa=mantissa)
211
221
  topology = Topology.Flatten(topology, origin=f_origin, direction=normal)
@@ -224,7 +234,7 @@ class Wire(Topology):
224
234
  origin = Topology.Centroid(topology)
225
235
  optimize = min(max(optimize, 0), 10)
226
236
  if optimize > 0:
227
- factor = (round(((11 - optimize)/30 + 0.57), 2))
237
+ factor = 1.0 - float(optimize)*0.05 # This will give a range of 0 to 0.5. Equivalent to a maximum 50% reduction in area.
228
238
  flag = False
229
239
  for n in range(10, 0, -1):
230
240
  if flag:
@@ -240,7 +250,7 @@ class Wire(Topology):
240
250
  w = abs(maxX - minX)
241
251
  l = abs(maxY - minY)
242
252
  area = l*w
243
- if area < orig_area*factor:
253
+ if area <= orig_area*factor: # If new area is less than or equal to a certain percentage of the original area then break. e.g. if area is less than or qual to 50% of original area then break.
244
254
  best_area = area
245
255
  best_z = z
246
256
  best_br = [minX, minY, maxX, maxY]
@@ -253,7 +263,6 @@ class Wire(Topology):
253
263
 
254
264
  else:
255
265
  best_br = boundingRectangle
256
-
257
266
  minX, minY, maxX, maxY = best_br
258
267
  vb1 = Vertex.ByCoordinates(minX, minY, 0)
259
268
  vb2 = Vertex.ByCoordinates(maxX, minY, 0)
@@ -3253,8 +3262,8 @@ class Wire(Topology):
3253
3262
 
3254
3263
  Parameters
3255
3264
  ----------
3256
- edge : topologic_core.Edge
3257
- The input edge.
3265
+ wire : topologic_core.Wire
3266
+ The input wire.
3258
3267
  distance : float , optional
3259
3268
  The offset distance. The default is 0.
3260
3269
  origin : topologic_core.Vertex , optional
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.18'
1
+ __version__ = '0.7.20'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.18
3
+ Version: 0.7.20
4
4
  Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
5
5
  Author-email: Wassim Jabi <wassim.jabi@gmail.com>
6
6
  License: MIT License
@@ -1,5 +1,6 @@
1
+ topologicpy/ANN.py,sha256=H_L81-RLdmzL0wehqcZz9IUgRENFxIH7mYxS3aKL7oE,48982
1
2
  topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
2
- topologicpy/Cell.py,sha256=FNmDHdNkJYaM982MLktfSipqFnfJBQmdxKp3kmuBKjA,99861
3
+ topologicpy/Cell.py,sha256=1AAruEDSUJqQFED7fL5-nTon2lR1FrkZxo59iEHOCY0,99833
3
4
  topologicpy/CellComplex.py,sha256=Fd70Dj7E4LqV5O-7kcCCYnrFEyqheZvxc0YWktm0EL8,47440
4
5
  topologicpy/Cluster.py,sha256=HvomWm_V4bx76YMxqOEhAUrsvcU6z5e_zry6WxMuV2M,54819
5
6
  topologicpy/Color.py,sha256=UlmRcCSOhqcM_OyMWz4t3Kr75KcgXDhz3uctAJ2n7Ic,18031
@@ -8,26 +9,26 @@ topologicpy/DGL.py,sha256=5jNn1L8F8REx1-oAh9sr_cfil0R5kUuueCNDKwNU_GM,138991
8
9
  topologicpy/Dictionary.py,sha256=pMbfE2RYGCNpVr2x58qiHRc-aBWnp1jLlyzwS9nz6-w,25891
9
10
  topologicpy/Edge.py,sha256=f7LjP662_yoqopAXBh1Gqv8DvdzvfM_heJTP2XnFskY,58447
10
11
  topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
11
- topologicpy/Face.py,sha256=1J1dnS3tNnaoFQyWdWjn9YnHldyiN-J67IjytIT0-R4,108142
12
- topologicpy/Graph.py,sha256=JM4N6EShvDspFcE9_E027HKAkHhZ5e5UD4I9LxlRfmA,391560
12
+ topologicpy/Face.py,sha256=DpV4ZOurOmqV3H3cDZG8FIt9NSm1DspYQjSIwfyzJjE,109083
13
+ topologicpy/Graph.py,sha256=tafjhTMr4cixcQnyj6FaIeDucc0SGTwn7kNFtnU4Q0U,391685
13
14
  topologicpy/Grid.py,sha256=Cpzs9l5-SptMQbUR8AvbbIOHrGMGlK0Qx8FWmQBgvX0,18497
14
15
  topologicpy/Helper.py,sha256=07V9IFu5ilMpvAdZVhIbdBOjBJSRTtJ0BfR1IoRaRXU,17743
15
16
  topologicpy/Honeybee.py,sha256=dlr5OEH93q51ZmEgvi8PXGfCHBDAjIZ1cm38Rft1Bz4,20235
16
17
  topologicpy/Matrix.py,sha256=VV-kbT0Qt5QO38HRFJmD4IMnQUzYbLjBF4xaFAqLh3Q,8352
17
18
  topologicpy/Neo4j.py,sha256=Gy2PS4Ky8BNhohKreoV4zgzW9OXCjhSwiZF_Aq21_wU,19589
18
- topologicpy/Plotly.py,sha256=IYyUIlLYn8YrjPnxXo4SkRzyrI3hVM9dtMZyA3KfWJ8,98845
19
+ topologicpy/Plotly.py,sha256=6ZYVAvSSDtoHZ7OsofIDwOKRDF_CTE_UOEzEtcxHAuU,98845
19
20
  topologicpy/Polyskel.py,sha256=pNawz5lnvy4oTzCL91fGY2PblW2hmcYBdT5268m2RZs,19743
20
- topologicpy/Shell.py,sha256=fdMhCKH5Oq2id16XjTWRe8-06jZ8z8LnrVqMR-33F3s,79144
21
+ topologicpy/Shell.py,sha256=gQZb0LEdzHjvQbjEOX5wT9fOYB71E6WkPLz9Kr1i4_s,79903
21
22
  topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
22
23
  topologicpy/Sun.py,sha256=mN3RzlslcZT3APUtwmWIXVbPkJ6OcKTaTf6338gbMJE,37152
23
- topologicpy/Topology.py,sha256=Y0McJCx_eH6y92bMbRfG82Foe0A9K7j3Fp8w-dD9h4k,338825
24
+ topologicpy/Topology.py,sha256=arsO_TXFLt_M0ulUIKIOgI-xn-gjrtwKlT6Je2_R-ZU,338696
24
25
  topologicpy/Vector.py,sha256=G4mIIcE5Y-EHfiNV_rxiOz8pJeV3NMEwLu5EOgM0gKA,32653
25
26
  topologicpy/Vertex.py,sha256=bD3JnNhizbp6HFhHRve2LK_y5w27jytCbsagOLxKjZQ,71198
26
- topologicpy/Wire.py,sha256=OtqCUmZeqeNF3baBLmUjB8yBZ3gmzzpSPcD-zzKzz4k,143577
27
+ topologicpy/Wire.py,sha256=ujU77xbwsmZqMmlIhfAlmJsM32ZXWoxCSM7Pc7Yj4T0,144545
27
28
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
28
- topologicpy/version.py,sha256=JKTQ-L90z9YkGvUYq8IRiy8FeivJmY_tDcKgSZ-ssw4,23
29
- topologicpy-0.7.18.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
30
- topologicpy-0.7.18.dist-info/METADATA,sha256=NiOC_LjQzxSER_rnY5Kz05fNWAbiEOuGxcoFAh2-_VA,10916
31
- topologicpy-0.7.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
32
- topologicpy-0.7.18.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
33
- topologicpy-0.7.18.dist-info/RECORD,,
29
+ topologicpy/version.py,sha256=VIiPuXuXNrG_S2UPdi_XO4PF0FZA9CnJGIDymw2UNro,23
30
+ topologicpy-0.7.20.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
31
+ topologicpy-0.7.20.dist-info/METADATA,sha256=kVffMsaS5-2HNrTirl-E14NV4ugX2IVruTcXx98-UXw,10916
32
+ topologicpy-0.7.20.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
33
+ topologicpy-0.7.20.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
34
+ topologicpy-0.7.20.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5