Skip to content

addattrib

If you know the class of attribute you want to add ahead of time, using adddetailattrib, addprimattrib, addpointattrib, or addvertexattrib may be faster.

int  addattrib(int geohandle, string attribclass, string name, <type>defvalue)

int  addattrib(int geohandle, string attribclass, string name, <type>defvalue[])

geohandle

A handle to the geometry to write to. Currently the only valid value is 0 or geoself, which means the current geometry in a node. (This argument may be used in the future to allow writing to other geometries.)

attribclass

One of "detail" (or "global"), "point", "prim", or "vertex".

You can also use "primgroup", "pointgroup" or "vertexgroup" to read from groups.

name

The name of the attribute to create.

defvalue

The default value for the attribute and determines the type of attribute to create. String and array attributes cannot have defaults, so only the type is used in those cases.

Returns

geohandle on success, or -1 on failure.

  • If an attribute of the same name already exists, the function will try to convert it to the new type.