topologicpy 0.8.15__py3-none-any.whl → 0.8.18__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/Dictionary.py CHANGED
@@ -344,6 +344,30 @@ class Dictionary():
344
344
  values.append(pythonDictionary[key])
345
345
  return Dictionary.ByKeysValues(keys, values)
346
346
 
347
+ @staticmethod
348
+ def Copy(dictionary, silent: bool = False):
349
+ """
350
+ Creates a copy of the input dictionary.
351
+
352
+ Parameters
353
+ ----------
354
+ dictionary : topologic_core.Dictionary
355
+ The input dictionary.
356
+
357
+ Returns
358
+ -------
359
+ topologic_core.Dictionary
360
+ A copy of the input dictionary.
361
+
362
+ """
363
+ if not isinstance(dictionary, topologic_core.Dictionary):
364
+ if not silent:
365
+ print("Dictionary.Copy - Error: The input dictionary parameter is not a valid dictionary. Returning None.")
366
+ return None
367
+ keys = Dictionary.Keys(dictionary)
368
+ values = Dictionary.Values(dictionary)
369
+ return Dictionary.ByKeysValues(keys, values)
370
+
347
371
  @staticmethod
348
372
  def Filter(elements, dictionaries, searchType="any", key=None, value=None):
349
373
  """
topologicpy/Face.py CHANGED
@@ -201,7 +201,7 @@ class Face():
201
201
  return br_face
202
202
 
203
203
  @staticmethod
204
- def ByEdges(edges: list, tolerance : float = 0.0001):
204
+ def ByEdges(edges: list, tolerance : float = 0.0001, silent: bool = False):
205
205
  """
206
206
  Creates a face from the input list of edges.
207
207
 
@@ -211,6 +211,8 @@ class Face():
211
211
  The input list of edges.
212
212
  tolerance : float , optional
213
213
  The desired tolerance. The default is 0.0001.
214
+ silent : bool , optional
215
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
214
216
 
215
217
  Returns
216
218
  -------
@@ -222,24 +224,28 @@ class Face():
222
224
  from topologicpy.Topology import Topology
223
225
 
224
226
  if not isinstance(edges, list):
225
- print("Face.ByEdges - Error: The input edges parameter is not a valid list. Returning None.")
227
+ if not silent:
228
+ print("Face.ByEdges - Error: The input edges parameter is not a valid list. Returning None.")
226
229
  return None
227
230
  edges = [e for e in edges if Topology.IsInstance(e, "Edge")]
228
231
  if len(edges) < 1:
229
- print("Face.ByEdges - Error: The input edges parameter does not contain any valid edges. Returning None.")
232
+ if not silent:
233
+ print("Face.ByEdges - Error: The input edges parameter does not contain any valid edges. Returning None.")
230
234
  return None
231
235
  wire = Wire.ByEdges(edges, tolerance=tolerance)
232
236
  if not Topology.IsInstance(wire, "Wire"):
233
- print("Face.ByEdges - Error: Could not create the required wire. Returning None.")
237
+ if not silent:
238
+ print("Face.ByEdges - Error: Could not create the required wire. Returning None.")
234
239
  return None
235
240
  face = Face.ByWire(wire, tolerance=tolerance)
236
241
  if not Topology.IsInstance(face, "Face"):
237
- print("Face.ByEdges - Warning: Could not create face from base wire. Returning None.")
242
+ if not silent:
243
+ print("Face.ByEdges - Error: Could not create face from base wire. Returning None.")
238
244
  return None
239
245
  return face
240
246
 
241
247
  @staticmethod
242
- def ByEdgesCluster(cluster, tolerance: float = 0.0001):
248
+ def ByEdgesCluster(cluster, tolerance: float = 0.0001, silent: bool = False):
243
249
  """
244
250
  Creates a face from the input cluster of edges.
245
251
 
@@ -249,6 +255,8 @@ class Face():
249
255
  The input cluster of edges.
250
256
  tolerance : float , optional
251
257
  The desired tolerance. The default is 0.0001.
258
+ silent : bool , optional
259
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
252
260
 
253
261
  Returns
254
262
  -------
@@ -260,15 +268,18 @@ class Face():
260
268
  from topologicpy.Topology import Topology
261
269
 
262
270
  if not Topology.IsInstance(cluster, "Cluster"):
263
- print("Face.ByEdgesCluster - Warning: The input cluster parameter is not a valid topologic cluster. Returning None.")
271
+ if not silent:
272
+ print("Face.ByEdgesCluster - Error: The input cluster parameter is not a valid topologic cluster. Returning None.")
264
273
  return None
265
274
  edges = Cluster.Edges(cluster)
266
275
  if len(edges) < 1:
267
- print("Face.ByEdgesCluster - Warning: The input cluster parameter does not contain any valid edges. Returning None.")
276
+ if not silent:
277
+ print("Face.ByEdgesCluster - Error: The input cluster parameter does not contain any valid edges. Returning None.")
268
278
  return None
269
279
  face = Face.ByEdges(edges, tolerance=tolerance)
270
280
  if not Topology.IsInstance(face, "Face"):
271
- print("Face.ByEdgesCluster - Warning: Could not create face from edges. Returning None.")
281
+ if not silent:
282
+ print("Face.ByEdgesCluster - Error: Could not create face from edges. Returning None.")
272
283
  return None
273
284
  return face
274
285
 
@@ -729,7 +740,7 @@ class Face():
729
740
  return return_face
730
741
 
731
742
  @staticmethod
732
- def ByVertices(vertices: list, tolerance: float = 0.0001):
743
+ def ByVertices(vertices: list, tolerance: float = 0.0001, silent: bool = False):
733
744
 
734
745
  """
735
746
  Creates a face from the input list of vertices.
@@ -740,6 +751,8 @@ class Face():
740
751
  The input list of vertices.
741
752
  tolerance : float , optional
742
753
  The desired tolerance. The default is 0.0001.
754
+ silent : bool , optional
755
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
743
756
 
744
757
  Returns
745
758
  -------
@@ -751,17 +764,33 @@ class Face():
751
764
  from topologicpy.Wire import Wire
752
765
 
753
766
  if not isinstance(vertices, list):
767
+ if not silent:
768
+ print("Face.ByVertices - Error: The input vertices parameter is not a valid list. Returning None.")
754
769
  return None
755
770
  vertexList = [x for x in vertices if Topology.IsInstance(x, "Vertex")]
756
771
  if len(vertexList) < 3:
772
+ if not silent:
773
+ print("Face.ByVertices - Error: The input vertices parameter does not contain at least three valid vertices. Returning None.")
757
774
  return None
758
775
 
759
776
  w = Wire.ByVertices(vertexList, tolerance=tolerance)
777
+ if not Topology.IsInstance(w, "Wire"):
778
+ if not silent:
779
+ print("Face.ByVertices - Error: Could not create the base wire. Returning None.")
780
+ return None
781
+ if not Wire.IsClosed(w):
782
+ if not silent:
783
+ print("Face.ByVertices - Error: Could not create a closed base wire. Returning None.")
784
+ return None
760
785
  f = Face.ByWire(w, tolerance=tolerance)
786
+ if not Topology.IsInstance(w, "Wire"):
787
+ if not silent:
788
+ print("Face.ByVertices - Error: Could not create the face. Returning None.")
789
+ return None
761
790
  return f
762
791
 
763
792
  @staticmethod
764
- def ByVerticesCluster(cluster, tolerance: float = 0.0001):
793
+ def ByVerticesCluster(cluster, tolerance: float = 0.0001, silent: bool = False):
765
794
  """
766
795
  Creates a face from the input cluster of vertices.
767
796
 
@@ -771,6 +800,8 @@ class Face():
771
800
  The input cluster of vertices.
772
801
  tolerance : float , optional
773
802
  The desired tolerance. The default is 0.0001.
803
+ silent : bool , optional
804
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
774
805
 
775
806
  Returns
776
807
  -------
@@ -778,12 +809,17 @@ class Face():
778
809
  The created face.
779
810
 
780
811
  """
781
- from topologicpy.Cluster import Cluster
782
812
  from topologicpy.Topology import Topology
783
813
 
784
814
  if not Topology.IsInstance(cluster, "Cluster"):
815
+ if not silent:
816
+ print("Face.ByVertices - Error: The input cluster parameter is not a valid cluster. Returning None.")
785
817
  return None
786
818
  vertices = Topology.Vertices(cluster)
819
+ if len(vertices) < 3:
820
+ if not silent:
821
+ print("Face.ByVertices - Error: The input cluster parameter does not contain at least three valid vertices. Returning None.")
822
+ return None
787
823
  return Face.ByVertices(vertices, tolerance=tolerance)
788
824
 
789
825
  @staticmethod