geometry.Geometry.set_prop#

Geometry.set_prop(prop=None)#

Create or destroy the property array for the Geometry.

A property array is a 1-dim integer array with length equal to the number of elements in the Geometry. Each element thus has its own property number. These numbers can be used for any purpose. In derived classes like Mesh they play an import role when creating new geometry: new elements inherit the property number of their parent element. Properties are also preserved on pure coordinate transformations.

Parameters#

prop: int, int array_like or ‘range’

The property number(s) to assign to the elements. If a single int, all elements get the same property value. If the number of passed values is less than the number of elements, the list will be repeated. If more values are passed than the number of elements, the excess ones are ignored.

A special value 'range' may be given to set the property numbers equal to the element number. This is equivalent to passing np.arange(self.n_elems()).

A value None (default) removes the properties from the Geometry.

Returns#

The calling object self, with the new properties inserted or with the properties deleted if argument is None.

Note#

This is one of the few operations that change the object in-place. It still returns the object itself, so that this operation can be used in a chain with other operations.

See Also#

  • to_prop(): Create a valid set of properties for the object

  • where_prop(): Find the elements having some property value