topologicpy 0.7.19__py3-none-any.whl → 0.7.21__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
@@ -988,8 +988,6 @@ class Cell():
988
988
  def Dodecahedron(origin= None, radius: float = 0.5,
989
989
  direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
990
990
  """
991
- Description
992
- ----------
993
991
  Creates a dodecahedron. See https://en.wikipedia.org/wiki/Dodecahedron.
994
992
 
995
993
  Parameters
@@ -1331,8 +1329,6 @@ class Cell():
1331
1329
  def Icosahedron(origin= None, radius: float = 0.5,
1332
1330
  direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
1333
1331
  """
1334
- Description
1335
- ----------
1336
1332
  Creates an icosahedron. See https://en.wikipedia.org/wiki/Icosahedron.
1337
1333
 
1338
1334
  Parameters
@@ -1500,8 +1496,6 @@ class Cell():
1500
1496
  def Octahedron(origin= None, radius: float = 0.5,
1501
1497
  direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
1502
1498
  """
1503
- Description
1504
- ----------
1505
1499
  Creates an octahedron. See https://en.wikipedia.org/wiki/Octahedron.
1506
1500
 
1507
1501
  Parameters
@@ -1562,8 +1556,6 @@ class Cell():
1562
1556
  @staticmethod
1563
1557
  def Pipe(edge, profile = None, radius: float = 0.5, sides: int = 16, startOffset: float = 0, endOffset: float = 0, endcapA = None, endcapB = None, mantissa: int = 6) -> dict:
1564
1558
  """
1565
- Description
1566
- ----------
1567
1559
  Creates a pipe along the input edge.
1568
1560
 
1569
1561
  Parameters
@@ -1696,8 +1688,6 @@ class Cell():
1696
1688
  def Prism(origin= None, width: float = 1, length: float = 1, height: float = 1, uSides: int = 1, vSides: int = 1, wSides: int = 1,
1697
1689
  direction: list = [0, 0, 1], placement: str ="center", mantissa: int = 6, tolerance: float = 0.0001):
1698
1690
  """
1699
- Description
1700
- ----------
1701
1691
  Creates a prism.
1702
1692
 
1703
1693
  Parameters
@@ -2017,8 +2007,6 @@ class Cell():
2017
2007
  def Tetrahedron(origin= None, radius: float = 0.5,
2018
2008
  direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
2019
2009
  """
2020
- Description
2021
- ----------
2022
2010
  Creates a tetrahedron. See https://en.wikipedia.org/wiki/Tetrahedron.
2023
2011
 
2024
2012
  Parameters
@@ -790,8 +790,6 @@ class CellComplex():
790
790
  def Octahedron(origin= None, radius: float = 0.5,
791
791
  direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
792
792
  """
793
- Description
794
- ----------
795
793
  Creates an octahedron. See https://en.wikipedia.org/wiki/Octahedron.
796
794
 
797
795
  Parameters
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/Matrix.py CHANGED
@@ -20,8 +20,6 @@ class Matrix:
20
20
  @staticmethod
21
21
  def Add(matA, matB):
22
22
  """
23
- Description
24
- ----------
25
23
  Adds the two input matrices.
26
24
 
27
25
  Parameters
@@ -52,8 +50,6 @@ class Matrix:
52
50
  @staticmethod
53
51
  def ByRotation(angleX=0, angleY=0, angleZ=0, order="xyz"):
54
52
  """
55
- Description
56
- ----------
57
53
  Creates a 4x4 rotation matrix.
58
54
 
59
55
  Parameters
@@ -121,8 +117,6 @@ class Matrix:
121
117
  @staticmethod
122
118
  def ByScaling(scaleX=1.0, scaleY=1.0, scaleZ=1.0):
123
119
  """
124
- Description
125
- ----------
126
120
  Creates a 4x4 scaling matrix.
127
121
 
128
122
  Parameters
@@ -148,8 +142,6 @@ class Matrix:
148
142
  @staticmethod
149
143
  def ByTranslation(translateX=0, translateY=0, translateZ=0):
150
144
  """
151
- Description
152
- ----------
153
145
  Creates a 4x4 translation matrix.
154
146
 
155
147
  Parameters
@@ -175,8 +167,6 @@ class Matrix:
175
167
  @staticmethod
176
168
  def Multiply(matA, matB):
177
169
  """
178
- Description
179
- ----------
180
170
  Multiplies the two input matrices. When transforming an object, the first input matrix is applied first
181
171
  then the second input matrix.
182
172
 
@@ -222,8 +212,6 @@ class Matrix:
222
212
  @staticmethod
223
213
  def Subtract(matA, matB):
224
214
  """
225
- Description
226
- ----------
227
215
  Subtracts the two input matrices.
228
216
 
229
217
  Parameters
@@ -254,8 +242,6 @@ class Matrix:
254
242
  @staticmethod
255
243
  def Transpose(matrix):
256
244
  """
257
- Description
258
- ----------
259
245
  Transposes the input matrix.
260
246
 
261
247
  Parameters
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/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)
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.19'
1
+ __version__ = '0.7.21'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.19
3
+ Version: 0.7.21
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,7 +1,7 @@
1
- topologicpy/ANN.py,sha256=MPgMJxJVdEt0ETpxt1TliUosByDEqKQcKq7iqrJjRXc,53073
1
+ topologicpy/ANN.py,sha256=H_L81-RLdmzL0wehqcZz9IUgRENFxIH7mYxS3aKL7oE,48982
2
2
  topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
3
- topologicpy/Cell.py,sha256=1AAruEDSUJqQFED7fL5-nTon2lR1FrkZxo59iEHOCY0,99833
4
- topologicpy/CellComplex.py,sha256=Fd70Dj7E4LqV5O-7kcCCYnrFEyqheZvxc0YWktm0EL8,47440
3
+ topologicpy/Cell.py,sha256=2ePfxb8umij3A3wzOZRSF6fAKhc2bHhSnrXRlUo1Kts,99599
4
+ topologicpy/CellComplex.py,sha256=-f-O5lcz0nSNcjw89XYi3IYhZRrbzojG11dItpISI_U,47401
5
5
  topologicpy/Cluster.py,sha256=HvomWm_V4bx76YMxqOEhAUrsvcU6z5e_zry6WxMuV2M,54819
6
6
  topologicpy/Color.py,sha256=UlmRcCSOhqcM_OyMWz4t3Kr75KcgXDhz3uctAJ2n7Ic,18031
7
7
  topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
@@ -9,26 +9,26 @@ topologicpy/DGL.py,sha256=5jNn1L8F8REx1-oAh9sr_cfil0R5kUuueCNDKwNU_GM,138991
9
9
  topologicpy/Dictionary.py,sha256=pMbfE2RYGCNpVr2x58qiHRc-aBWnp1jLlyzwS9nz6-w,25891
10
10
  topologicpy/Edge.py,sha256=f7LjP662_yoqopAXBh1Gqv8DvdzvfM_heJTP2XnFskY,58447
11
11
  topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
12
- topologicpy/Face.py,sha256=1J1dnS3tNnaoFQyWdWjn9YnHldyiN-J67IjytIT0-R4,108142
13
- topologicpy/Graph.py,sha256=JM4N6EShvDspFcE9_E027HKAkHhZ5e5UD4I9LxlRfmA,391560
12
+ topologicpy/Face.py,sha256=DpV4ZOurOmqV3H3cDZG8FIt9NSm1DspYQjSIwfyzJjE,109083
13
+ topologicpy/Graph.py,sha256=tafjhTMr4cixcQnyj6FaIeDucc0SGTwn7kNFtnU4Q0U,391685
14
14
  topologicpy/Grid.py,sha256=Cpzs9l5-SptMQbUR8AvbbIOHrGMGlK0Qx8FWmQBgvX0,18497
15
15
  topologicpy/Helper.py,sha256=07V9IFu5ilMpvAdZVhIbdBOjBJSRTtJ0BfR1IoRaRXU,17743
16
16
  topologicpy/Honeybee.py,sha256=dlr5OEH93q51ZmEgvi8PXGfCHBDAjIZ1cm38Rft1Bz4,20235
17
- topologicpy/Matrix.py,sha256=VV-kbT0Qt5QO38HRFJmD4IMnQUzYbLjBF4xaFAqLh3Q,8352
17
+ topologicpy/Matrix.py,sha256=umgR7An919-wGInXJ1wpqnoQ2jCPdyMe2rcWTZ16upk,8079
18
18
  topologicpy/Neo4j.py,sha256=Gy2PS4Ky8BNhohKreoV4zgzW9OXCjhSwiZF_Aq21_wU,19589
19
19
  topologicpy/Plotly.py,sha256=6ZYVAvSSDtoHZ7OsofIDwOKRDF_CTE_UOEzEtcxHAuU,98845
20
20
  topologicpy/Polyskel.py,sha256=pNawz5lnvy4oTzCL91fGY2PblW2hmcYBdT5268m2RZs,19743
21
- topologicpy/Shell.py,sha256=fdMhCKH5Oq2id16XjTWRe8-06jZ8z8LnrVqMR-33F3s,79144
21
+ topologicpy/Shell.py,sha256=gQZb0LEdzHjvQbjEOX5wT9fOYB71E6WkPLz9Kr1i4_s,79903
22
22
  topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
23
23
  topologicpy/Sun.py,sha256=mN3RzlslcZT3APUtwmWIXVbPkJ6OcKTaTf6338gbMJE,37152
24
24
  topologicpy/Topology.py,sha256=arsO_TXFLt_M0ulUIKIOgI-xn-gjrtwKlT6Je2_R-ZU,338696
25
25
  topologicpy/Vector.py,sha256=G4mIIcE5Y-EHfiNV_rxiOz8pJeV3NMEwLu5EOgM0gKA,32653
26
26
  topologicpy/Vertex.py,sha256=bD3JnNhizbp6HFhHRve2LK_y5w27jytCbsagOLxKjZQ,71198
27
- topologicpy/Wire.py,sha256=vkDmfHjV7_ejZmrnCWFf4zdhhoI88ZDWY9Su_TQwjas,143577
27
+ topologicpy/Wire.py,sha256=ujU77xbwsmZqMmlIhfAlmJsM32ZXWoxCSM7Pc7Yj4T0,144545
28
28
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
29
- topologicpy/version.py,sha256=UOy-EMduBicLVj1Dfuz2h9Dr9n4BtAE9AAVmMLbBN6s,23
30
- topologicpy-0.7.19.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
31
- topologicpy-0.7.19.dist-info/METADATA,sha256=SYu8MxTVov2F8IWtiwnK1YLB_kEPdVrhEjn8omSXefU,10916
32
- topologicpy-0.7.19.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
33
- topologicpy-0.7.19.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
34
- topologicpy-0.7.19.dist-info/RECORD,,
29
+ topologicpy/version.py,sha256=NtJ4aAFnc8NGqEqKfgzjO8aauC5wP3QyLOgRcSVICcQ,23
30
+ topologicpy-0.7.21.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
31
+ topologicpy-0.7.21.dist-info/METADATA,sha256=161Kl1mK0XdOw4dxCmk1UmiBxctwWgcLI0d_-UE56IU,10916
32
+ topologicpy-0.7.21.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
33
+ topologicpy-0.7.21.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
34
+ topologicpy-0.7.21.dist-info/RECORD,,