topologicpy 0.7.61__py3-none-any.whl → 0.7.62__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/Edge.py CHANGED
@@ -293,7 +293,8 @@ class Edge():
293
293
  import inspect
294
294
 
295
295
  if len(args) == 0:
296
- print("Edge.ByVertices - Error: The input vertices parameter is an empty list. Returning None.")
296
+ if not silent:
297
+ print("Edge.ByVertices - Error: The input vertices parameter is an empty list. Returning None.")
297
298
  return None
298
299
  if len(args) == 1:
299
300
  vertices = args[0]
@@ -1107,7 +1108,7 @@ class Edge():
1107
1108
  return Edge.Direction(normal_edge)
1108
1109
 
1109
1110
  @staticmethod
1110
- def NormalEdge(edge, length: float = 1.0, u: float = 0.5, angle: float = 0.0):
1111
+ def NormalEdge(edge, length: float = 1.0, u: float = 0.5, angle: float = 0.0, tolerance: float = 0.0001, silent: bool = False):
1111
1112
  """
1112
1113
  Returns the normal (perpendicular) vector to the input edge as an edge.
1113
1114
 
@@ -1125,7 +1126,11 @@ class Edge():
1125
1126
  angle : float , optional
1126
1127
  The desired rotational offset angle in degrees for the normal edge. This rotates the normal edge
1127
1128
  by the angle value around the axis defined by the input edge. The default is 0.0.
1128
-
1129
+ tolerance : float , optional
1130
+ The desired tolerance. The default is 0.0001.
1131
+ silent : bool , optional
1132
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1133
+
1129
1134
  Returns
1130
1135
  -------
1131
1136
  topologic_core.Edge
@@ -1153,8 +1158,13 @@ class Edge():
1153
1158
  # Otherwise, calculate the normal by crossing with the Z-axis
1154
1159
  z_axis = np.array([0, 0, 1])
1155
1160
  normal_vector = np.cross(direction_vector, z_axis)
1161
+
1162
+ # Check if the normal vector is effectively zero before normalization
1163
+ if np.isclose(norm(normal_vector), 0):
1164
+ return normal_vector
1156
1165
 
1157
- normal_vector /= norm(normal_vector) # Normalize the normal vector
1166
+ # Normalize the normal vector
1167
+ normal_vector /= norm(normal_vector)
1158
1168
  return normal_vector
1159
1169
 
1160
1170
  def calculate_normal_line(start_vertex, end_vertex):
@@ -1168,10 +1178,12 @@ class Edge():
1168
1178
  return start_vertex, normal_end_vertex
1169
1179
 
1170
1180
  if not Topology.IsInstance(edge, "Edge"):
1171
- print("Edge.NormalEdge - Error: The input edge parameter is not a valid edge. Returning None.")
1181
+ if not silent:
1182
+ print("Edge.NormalEdge - Error: The input edge parameter is not a valid edge. Returning None.")
1172
1183
  return None
1173
1184
  if length <= 0.0:
1174
- print("Edge.NormalEdge - Error: The input length parameter is not a positive number greater than zero. Returning None.")
1185
+ if not silent:
1186
+ print("Edge.NormalEdge - Error: The input length parameter is not a positive number greater than zero. Returning None.")
1175
1187
  return None
1176
1188
 
1177
1189
  # Get start and end vertex coordinates
@@ -1186,10 +1198,13 @@ class Edge():
1186
1198
  ev = Vertex.ByCoordinates(list(normal_line_end))
1187
1199
 
1188
1200
  # Create an edge from the start to the end of the normal vector
1189
- normal_edge = Edge.ByVertices([sv, ev])
1190
-
1201
+ normal_edge = Edge.ByVertices([sv, ev], tolerance=tolerance, silent=silent)
1202
+ if normal_edge == None:
1203
+ if not silent:
1204
+ print("Edge.NormalEdge - Error: Could not create edge. Returning None.")
1205
+ return None
1191
1206
  # Set the length of the normal edge
1192
- normal_edge = Edge.SetLength(normal_edge, length, bothSides=False)
1207
+ normal_edge = Edge.SetLength(normal_edge, length, bothSides=False, tolerance=tolerance)
1193
1208
 
1194
1209
  # Rotate the normal edge around the input edge by the specified angle
1195
1210
  edge_direction = Edge.Direction(edge)
topologicpy/Graph.py CHANGED
@@ -8119,7 +8119,8 @@ class Graph:
8119
8119
  camera=[-1.25, -1.25, 1.25],
8120
8120
  center=[0, 0, 0], up=[0, 0, 1],
8121
8121
  projection="perspective",
8122
- tolerance=0.0001):
8122
+ tolerance=0.0001,
8123
+ silent=False):
8123
8124
  """
8124
8125
  Shows the graph using Plotly.
8125
8126
 
@@ -8218,9 +8219,10 @@ class Graph:
8218
8219
  The desired up vector. The default is [0, 0, 1].
8219
8220
  projection : str , optional
8220
8221
  The desired type of projection. The options are "orthographic" or "perspective". It is case insensitive. The default is "perspective"
8221
-
8222
8222
  tolerance : float , optional
8223
8223
  The desired tolerance. The default is 0.0001.
8224
+ silent : bool , optional
8225
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
8224
8226
 
8225
8227
  Returns
8226
8228
  -------
@@ -8234,7 +8236,7 @@ class Graph:
8234
8236
  print("Graph.Show - Error: The input graph is not a valid graph. Returning None.")
8235
8237
  return None
8236
8238
 
8237
- data= Plotly.DataByGraph(graph, sagitta=sagitta, absolute=absolute, sides=sides, vertexColor=vertexColor, vertexSize=vertexSize, vertexLabelKey=vertexLabelKey, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups, showVertices=showVertices, showVertexLabels=showVertexLabels, showVertexLegend=showVertexLegend, edgeColor=edgeColor, edgeWidth=edgeWidth, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, showEdges=showEdges, showEdgeLabels=showEdgeLabels, showEdgeLegend=showEdgeLegend, colorScale=colorScale)
8239
+ data= Plotly.DataByGraph(graph, sagitta=sagitta, absolute=absolute, sides=sides, vertexColor=vertexColor, vertexSize=vertexSize, vertexLabelKey=vertexLabelKey, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups, showVertices=showVertices, showVertexLabels=showVertexLabels, showVertexLegend=showVertexLegend, edgeColor=edgeColor, edgeWidth=edgeWidth, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, showEdges=showEdges, showEdgeLabels=showEdgeLabels, showEdgeLegend=showEdgeLegend, colorScale=colorScale, silent=silent)
8238
8240
  fig = Plotly.FigureByData(data, width=width, height=height, xAxis=xAxis, yAxis=yAxis, zAxis=zAxis, axisSize=axisSize, backgroundColor=backgroundColor,
8239
8241
  marginLeft=marginLeft, marginRight=marginRight, marginTop=marginTop, marginBottom=marginBottom, tolerance=tolerance)
8240
8242
  Plotly.Show(fig, renderer=renderer, camera=camera, center=center, up=up, projection=projection)
topologicpy/Plotly.py CHANGED
@@ -293,7 +293,8 @@ class Plotly:
293
293
  showEdgeLabels: bool = False,
294
294
  showEdgeLegend: bool = False,
295
295
  colorScale: str = "viridis",
296
- mantissa: int = 6):
296
+ mantissa: int = 6,
297
+ silent: bool = False):
297
298
  """
298
299
  Creates plotly vertex and edge data from the input graph.
299
300
 
@@ -354,6 +355,9 @@ class Plotly:
354
355
  If set to True the edge legend will be drawn. Otherwise, it will not be drawn. The default is False.
355
356
  colorScale : str , optional
356
357
  The desired type of plotly color scales to use (e.g. "Viridis", "Plasma"). The default is "Viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
358
+ silent : bool , optional
359
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
360
+
357
361
  Returns
358
362
  -------
359
363
  list
@@ -446,11 +450,11 @@ class Plotly:
446
450
  if sagitta > 0:
447
451
  for edge in edges:
448
452
  d = Topology.Dictionary(edge)
449
- arc = Wire.ArcByEdge(edge, sagitta=sagitta, absolute=absolute, sides=sides, close=False)
453
+ arc = Wire.ArcByEdge(edge, sagitta=sagitta, absolute=absolute, sides=sides, close=False, silent=silent)
450
454
  if Topology.IsInstance(arc, "Wire"):
451
455
  arc_edges = Topology.Edges(arc)
452
456
  for arc_edge in arc_edges:
453
- arc_edge = Topology.SetDictionary(arc_edge, d)
457
+ arc_edge = Topology.SetDictionary(arc_edge, d, silent=silent)
454
458
  new_edges.append(arc_edge)
455
459
  else:
456
460
  new_edges.append(edge)
topologicpy/Wire.py CHANGED
@@ -206,7 +206,11 @@ class Wire():
206
206
  length = sagitta
207
207
  else:
208
208
  length = Edge.Length(edge)*sagitta
209
- norm = Edge.NormalEdge(edge, length=length)
209
+ norm = Edge.NormalEdge(edge, length=length, silent=silent)
210
+ if norm == None:
211
+ if not silent:
212
+ print("Wire.ArcByEdge - Warning: Could not create an arc. Returning the original edge.")
213
+ return edge
210
214
  cv = Edge.EndVertex(norm)
211
215
  return Wire.Arc(sv, cv, ev, sides=sides, close=close)
212
216
 
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.61'
1
+ __version__ = '0.7.62'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.61
3
+ Version: 0.7.62
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
@@ -8,16 +8,16 @@ topologicpy/Color.py,sha256=FrxX2yILqWvYrqD8kBaknfMfOR_phJOmhvTvFc07bY4,18065
8
8
  topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
9
9
  topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
10
10
  topologicpy/Dictionary.py,sha256=cURg452wwk2WeSxWY46ncgAUo5XD1c2c5EtO6ESZHaY,27304
11
- topologicpy/Edge.py,sha256=7Mxu9w9AY8uEk-xJpwMlWkuAgK96YIvUo0jtS5xuPq0,66123
11
+ topologicpy/Edge.py,sha256=FACD8Bm2nL2uTHIeRMVXfRF0cYeqhZ-lCZPHAfjAIPg,66927
12
12
  topologicpy/EnergyModel.py,sha256=NM3_nAdY9_YDtbp9CaEZ0x0xVsetTqVDzm_VSjmq_mI,53746
13
13
  topologicpy/Face.py,sha256=YjU6TxxW2Mf5InumMvzXUXVVRdtjxyRGauRIhGXzkao,116411
14
- topologicpy/Graph.py,sha256=NoHGYCCoCFP2nDLrzkM7x4hpemo6KiVeOq5Cm0BR78c,411204
14
+ topologicpy/Graph.py,sha256=4b8bzlyXmh0Ef9rjiEjl8wmh_9vAxoE5xiSiGvGjG9Q,411392
15
15
  topologicpy/Grid.py,sha256=3-sn7CHWGcXk18XCnHjsUttNJTWwmN63g_Insj__p04,18218
16
16
  topologicpy/Helper.py,sha256=i-AfI29NMsZXBaymjilfvxQbuS3wpYbpPw4RWu1YCHs,16358
17
17
  topologicpy/Honeybee.py,sha256=Oc8mfGBNSjs6wxkPzCKmEw1ZPQPbp9XtiYWaAF62oSk,21893
18
18
  topologicpy/Matrix.py,sha256=umgR7An919-wGInXJ1wpqnoQ2jCPdyMe2rcWTZ16upk,8079
19
19
  topologicpy/Neo4j.py,sha256=BezQ-sdpU8B0W4X_kaF7alZrlN0-h4779HFrB3Fsn-w,22033
20
- topologicpy/Plotly.py,sha256=FeRneK3QfMdWZzwnr2lLWvFLQIjwuyq9ms-DghvuZnI,108134
20
+ topologicpy/Plotly.py,sha256=k-gluqX4Na3zlYCDl_6A0gqeFoGR-0Oy6fLiT-Zqlyk,108362
21
21
  topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
22
22
  topologicpy/PyG.py,sha256=LU9LCCzjxGPUM31qbaJXZsTvniTtgugxJY7y612t4A4,109757
23
23
  topologicpy/Shell.py,sha256=joahFtpRQTWJpQOmi3qU4Xe0Sx2XXeayHlXTNx8CzMk,87610
@@ -26,11 +26,11 @@ topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
26
26
  topologicpy/Topology.py,sha256=5Vnn9oMEQ__ta_ew9XhnZExMPbHsj9QN91v-6pxdrJg,397934
27
27
  topologicpy/Vector.py,sha256=A1g83zDHep58iVPY8WQ8iHNrSOfGWFEzvVeDuMnjDNY,33078
28
28
  topologicpy/Vertex.py,sha256=bLY60YWoMsgCgHk7F7k9F93Sq2FJ6AzUcTfJ83NZfHA,71107
29
- topologicpy/Wire.py,sha256=rGLAwjd5p80rxvkOkcrE1MPXkU9oZ1iRK7n_wOTLbd0,162382
29
+ topologicpy/Wire.py,sha256=nRD_TqDpgbdQ1-YrMqrxVq_sYwi91Ad83mflFGL4Na4,162578
30
30
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
31
- topologicpy/version.py,sha256=tiB10UwHe_W_etMVnPuXlVWgr8S2BBgwOuFocOXK4Nk,23
32
- topologicpy-0.7.61.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
33
- topologicpy-0.7.61.dist-info/METADATA,sha256=Dcv499yRgltilHs2CTCeo3Ktv7lA4HOZWL8wsVT5Tpg,10918
34
- topologicpy-0.7.61.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
35
- topologicpy-0.7.61.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
- topologicpy-0.7.61.dist-info/RECORD,,
31
+ topologicpy/version.py,sha256=zE7Ne5ringVmSmv9eQ1aDQ5rppXqGLcX_FCGFkD0JoU,23
32
+ topologicpy-0.7.62.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
33
+ topologicpy-0.7.62.dist-info/METADATA,sha256=awRKe419hWCdlGWl5t1Yrt-Hkm4E6BYxSJFzvcYKpSE,10918
34
+ topologicpy-0.7.62.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
35
+ topologicpy-0.7.62.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
+ topologicpy-0.7.62.dist-info/RECORD,,