topologicpy 0.7.60__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/Topology.py CHANGED
@@ -2382,7 +2382,7 @@ class Topology():
2382
2382
 
2383
2383
  """
2384
2384
 
2385
- import ifcopenshell
2385
+ import ifcopenshell, ifcopenshell.geom
2386
2386
  from topologicpy.Dictionary import Dictionary
2387
2387
 
2388
2388
  def get_psets(entity):
@@ -2399,22 +2399,23 @@ class Topology():
2399
2399
  property_set = definition.RelatingPropertyDefinition
2400
2400
 
2401
2401
  # Check if it is a property set
2402
- if property_set.is_a('IfcPropertySet'):
2403
- pset_name = "IFC_"+property_set.Name
2404
-
2405
- # Dictionary to hold individual properties
2406
- properties = {}
2407
-
2408
- # Iterate over the properties in the PSET
2409
- for prop in property_set.HasProperties:
2410
- if prop.is_a('IfcPropertySingleValue'):
2411
- # Get the property name and value
2412
- prop_name = "IFC_"+prop.Name
2413
- prop_value = prop.NominalValue.wrappedValue if prop.NominalValue else None
2414
- properties[prop_name] = prop_value
2415
-
2416
- # Add this PSET to the dictionary for this entity
2417
- psets[pset_name] = properties
2402
+ if not property_set == None:
2403
+ if property_set.is_a('IfcPropertySet'):
2404
+ pset_name = "IFC_"+property_set.Name
2405
+
2406
+ # Dictionary to hold individual properties
2407
+ properties = {}
2408
+
2409
+ # Iterate over the properties in the PSET
2410
+ for prop in property_set.HasProperties:
2411
+ if prop.is_a('IfcPropertySingleValue'):
2412
+ # Get the property name and value
2413
+ prop_name = "IFC_"+prop.Name
2414
+ prop_value = prop.NominalValue.wrappedValue if prop.NominalValue else None
2415
+ properties[prop_name] = prop_value
2416
+
2417
+ # Add this PSET to the dictionary for this entity
2418
+ psets[pset_name] = properties
2418
2419
  return psets
2419
2420
 
2420
2421
  def get_color_transparency_material(entity):
@@ -2549,7 +2550,7 @@ class Topology():
2549
2550
  # Main Code
2550
2551
  topologies = []
2551
2552
  settings = ifcopenshell.geom.settings()
2552
- settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.SOLID)
2553
+ #settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.SOLID)
2553
2554
  settings.set(settings.USE_WORLD_COORDS, True)
2554
2555
  products = file.by_type("IfcProduct")
2555
2556
  entities = []
@@ -3110,7 +3111,8 @@ class Topology():
3110
3111
  edge_apertures = []
3111
3112
  face_apertures = []
3112
3113
  # Step 2: Create Entities and handle apertures
3113
- for entity in string:
3114
+ json_dictionary = json.loads(string)
3115
+ for entity in json_dictionary:
3114
3116
  entity_type = entity['type']
3115
3117
  entity_dict = Dictionary.ByKeysValues(keys=list(entity['dictionary'].keys()),
3116
3118
  values=list(entity['dictionary'].values()))
@@ -4281,7 +4283,7 @@ class Topology():
4281
4283
  return topologyA
4282
4284
 
4283
4285
  @staticmethod
4284
- def Explode(topology, origin=None, scale: float = 1.25, typeFilter: str = None, axes: str = "xyz", mantissa: int = 6, tolerance: float = 0.0001):
4286
+ def Explode(topology, origin=None, scale: float = 1.25, typeFilter: str = None, axes: str = "xyz", transferDictionaries: bool = False, mantissa: int = 6, tolerance: float = 0.0001):
4285
4287
  """
4286
4288
  Explodes the input topology. See https://en.wikipedia.org/wiki/Exploded-view_drawing.
4287
4289
 
@@ -4297,6 +4299,8 @@ class Topology():
4297
4299
  The type of the subtopologies to explode. This can be any of "vertex", "edge", "face", or "cell". If set to None, a subtopology one level below the type of the input topology will be used. The default is None.
4298
4300
  axes : str , optional
4299
4301
  Sets what axes are to be used for exploding the topology. This can be any permutation or substring of "xyz". It is not case sensitive. The default is "xyz".
4302
+ transferDictionaries : bool , optional
4303
+ If set to True, the dictionaries of the original subTopologies are transferred to the exploded topologies. Otherwise, they are not. The default is False.
4300
4304
  mantissa : int , optional
4301
4305
  The desired length of the mantissa. The default is 6.
4302
4306
  tolerance : float , optional
@@ -4311,6 +4315,7 @@ class Topology():
4311
4315
  from topologicpy.Vertex import Vertex
4312
4316
  from topologicpy.Cluster import Cluster
4313
4317
  from topologicpy.Graph import Graph
4318
+ from topologicpy.Dictionary import Dictionary
4314
4319
 
4315
4320
  def processClusterTypeFilter(cluster):
4316
4321
  if len(Cluster.CellComplexes(cluster)) > 0:
@@ -4365,7 +4370,7 @@ class Topology():
4365
4370
  return None
4366
4371
  if Topology.IsInstance(topology, "Topology"):
4367
4372
  # Hack to fix a weird bug that seems to be a problem with OCCT memory handling.
4368
- topology = Topology.ByBREPString(Topology.BREPString(topology))
4373
+ topology = Topology.ByJSONString(Topology.JSONString([topology]))[0]
4369
4374
  axes = axes.lower()
4370
4375
  x_flag = "x" in axes
4371
4376
  y_flag = "y" in axes
@@ -4403,7 +4408,10 @@ class Topology():
4403
4408
  xT = newX - oldX
4404
4409
  yT = newY - oldY
4405
4410
  zT = newZ - oldZ
4406
- newTopology = Topology.Translate(aTopology, xT, yT, zT)
4411
+ newTopology = Topology.Copy(aTopology)
4412
+ newTopology = Topology.Translate(newTopology, xT, yT, zT)
4413
+ if transferDictionaries == True:
4414
+ newTopology = Topology.SetDictionary(newTopology, Topology.Dictionary(aTopology))
4407
4415
  newTopologies.append(newTopology)
4408
4416
  return Cluster.ByTopologies(newTopologies)
4409
4417
 
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.60'
1
+ __version__ = '0.7.62'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.60
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,29 +8,29 @@ 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
24
24
  topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
25
25
  topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
26
- topologicpy/Topology.py,sha256=cFYSb93kxqcsdGLdeVcdE9td-KZ9X967sEn98NQAYfM,397243
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=OPMe-rPXSkz9Cu9DTdHOcBcmqfzAZp01-uadL4eOXFY,23
32
- topologicpy-0.7.60.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
33
- topologicpy-0.7.60.dist-info/METADATA,sha256=zVoxaGqEvSXMGH8W2SJlq4eqAF7XCCZDWEDTjPSSNhw,10918
34
- topologicpy-0.7.60.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
35
- topologicpy-0.7.60.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
- topologicpy-0.7.60.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,,