Cell.add_vertex
- Cell.add_vertex(key=None, attr_dict=None, **kwattr)
Add a vertex to the mesh object.
- Parameters
key (int, optional) – The vertex identifier.
attr_dict (dict, optional) – Vertex attributes.
kwattr (dict, optional) – Additional named vertex attributes. Named vertex attributes overwrite corresponding attributes in the attribute dict (
attr_dict
).
- Returns
int – The identifier of the vertex.
Notes
If no key is provided for the vertex, one is generated automatically. An automatically generated key is an integer that increments the highest integer value of any key used so far by 1.
If a key with an integer value is provided that is higher than the current highest integer key value, then the highest integer value is updated accordingly.
Examples
>>> from compas.datastructures import Mesh >>> mesh = Mesh() >>> mesh.add_vertex() 0 >>> mesh.add_vertex(x=0, y=0, z=0) 1 >>> mesh.add_vertex(key=2) 2 >>> mesh.add_vertex(key=0, x=1) 0