geometric_key

compas.utilities.geometric_key(xyz, precision=None, sanitize=True)[source]

Convert XYZ coordinates to a string that can be used as a dict key.

Parameters
  • xyz (list of float) – The XYZ coordinates.

  • precision (str, optional) – A formatting option that specifies the precision of the individual numbers in the string. Supported values are any float precision, or decimal integer ('d'). Default is None, in which case the global precision setting will be used (compas.PRECISION).

  • sanitize ({True, False}, optional) – Flag that indicates whether or not the input should be cleaned up. Default is True.

Returns

str – The string representation of the given coordinates.

Examples

>>> geometric_key([pi, pi, pi])
'3.142,3.142,3.142'

See also

geometric_key_xy

Create geometric keys for 2D coordinates