mapteksdk.data.primitives.edge_properties module

Support for edge primitives.

An edge is a line between two points. In Python, an edge is represented as a numpy array containing two integers representing the indices of the points the edge connects. For example, the edge [0, 1] indicates the line between the 0th and 1st point. Because edges are defined based on points, all objects which inherit from EdgeProperties must also inherit from PointProperties.

class EdgeProperties

Bases: object

Mixin class which provides spatial objects support for edge primitives.

The edge [i, j] indicates the line is between the points Object.points[i] and Object.points[j].

Functions and properties defined on this class are available on all classes which support edges.

Notes

Currently all objects which inherit from EdgeProperties also inherit from PointProperties to allow using the points from point properties to define the edges.

is_read_only: bool
property edges: EdgeArray

A 2D Numpy array of edges of the form: [[i0, j0], [i1, j1], …, [iN, jN]] where N is the number of edges and all iK and jK are valid indices in Object.points.

Warning

For Surfaces the edges are derived from the points and facets. If any changes are made to the points or facets, the corresponding changes to the edges will not be made until save() has been called.

Notes

Invalid edges are removed during save().

property edge_colours: ColourArray

The colours of the edges.

The edge colours are represented as a numpy array of RGBA colours, with one colour for each edge.

property edge_selection: BooleanArray

A 1D ndarray representing which edges are selected.

edge_selection[i] = True indicates edge i is selected.

property edge_count: int

The count of edges in the object.

property edge_attributes: PrimitiveAttributes

Access to custom edge attributes.

These are arrays of values of the same type, with one value for each edge.

Use Object.edge_attributes[attribute_name] to access the edge attribute called attribute_name. See PrimitiveAttributes for valid operations on edge attributes.

Returns:

Access to the edge attributes.

Return type:

PrimitiveAttributes

Raises:

ValueError – If the type of the attribute is not supported.

Warning

For Surfaces if you have changed the points or facets in the object, you must call save() before accessing the edge attributes.

save_edge_attribute(attribute_name, data)

Create and/or edit the values of the edge attribute attribute_name.

This is equivalent to Object.edge_attributes[attribute_name] = data

Saving an edge attribute using an AttributeKey allows for additional metadata to be specified.

Parameters:
  • attribute_name (str | AttributeKey) – The name or key of the attribute.

  • data (npt.ArrayLike) – An array_like of a base type data to store for the attribute per-primitive.

Raises:
  • ValueError – If the type of the attribute is not supported.

  • AmbiguousNameError – If there is already an attribute with the same name, but with different metadata.

delete_edge_attribute(attribute_name)

Delete an edge attribute.

Parameters:

attribute_name (str | AttributeKey) – The name or key of the attribute.