If you know the attribute class ahead of time, using detailattribsize, primattribsize, pointattribsize, or vertexattribsize may be faster.
int attribsize(<geometry>geometry, string attribclass, string attribute_name)
When running in the context of a node (such as a wrangle SOP), this argument can be an integer representing the input number (starting at 0) to read the geometry from.
Alternatively, the argument can be a string specifying a geometry file (for example, a
.bgeo) to read from. When running inside Houdini, this can be an
You can also use
"vertexgroup" to read from groups.
The size of an attribute’s type.
For a vector type, this is the number of components.
For an integer, float, or string, this returns
For an array attribute, this returns the size of the tuples in the array. The tuple size is controlled by the Size parameter on the Attribute Create node.
If the attribute does not exist, returns
This function works with the attribute’s type. It does not return the size of an attribute value. You can’t use this function to get the length of a string or array value.
// Get the size of the position attribute of "defgeo.bgeo" int size = attribsize("defgeo.bgeo", "point", "P");