hou.Vertex class

Existing inside a Geometry object, a Vertex object is contained in exactly one Prim, and references exactly one Point.

This setup allows points to be shared between primitives. For example, a polygon contains its own list of vertices that are not shared with other primitives, but vertices in different polygons may refer to the same point. When that point moves, the corresponding vertices on all adjacent polygons will also move, preventing polygon edges from separating.

Note that you can use hou.Vertex.point to retrieve a point from a vertex, but there is no method to retrieve all the vertices referring to a point. Houdini does not store this information internally, but you can derive it. The best way to quickly retrieve this information is to build a dictionary mapping all points to sets of vertices, and then reuse this dictionary in your algorithm.

Methods

attribValue(self, name_or_attrib)int, float, str or tuple

Return the value store in this vertex for a particular attribute. The attribute may be specified by name or by hou.Attrib object.

Looking an attribute value using a hou.Attrib object is slightly faster than looking it up by name. When looking up attribute values inside a loop, look up the hou.Attrib object outside the loop, and pass it into this method.

Raises hou.OperationFailed if no attribute exists with this name.

floatAttribValue(self, name_or_attrib)float

Return the vertex attribute value for a particular floating point attribute. The attribute may be specified by name or by hou.Attrib object.

Raises hou.OperationFailed if no attribute exists with this name or the attribute is not float of size 1.

In most cases, you’ll just use hou.Vertex.attribValue to access attribute values. Houdini uses this method internally to implement attribValue.

floatListAttribValue(self, name_or_attrib)tuple of float

Return the vertex attribute value for a particular floating point attribute. The attribute may be specified by name or by hou.Attrib object. The return value is a list of floats.

It is valid to call this method when the attribute’s size is 1. In this case, a list with one element is returned.

See also hou.Vertex.attribValue.

intAttribValue(self, name_or_attrib)int

Return the vertex attribute value for a particular integer attribute of size 1. The attribute may be specified by name or by hou.Attrib object. See hou.Vertex.floatAttribValue for more information.

intListAttribValue(self, name_or_attrib)tuple of int

Return the vertex attribute value for a particular integer attribute. The attribute may be specified by name or by hou.Attrib object. The return value is a list of ints. See hou.Vertex.floatListAttribValue for more information.

stringAttribValue(self, name_or_attrib)str

Return the vertex attribute value for a particular string attribute. The attribute may be specified by name or by hou.Attrib object. See hou.Vertex.floatAttribValue for more information.

setAttribValue(self, name_or_attrib, attrib_value)

Store an attribute value in this vertex. The attribute may be specified by name or by hou.Attrib object, and must be an existing vertex attribute in the geometry. You would typically call this method from the code of a Python-defined SOP.

Raises hou.OperationFailed if no attribute exists with this name or if the attribute’s data type does not match the value passed in. If the attribute’s size is more than 1, the attribute value must be a sequence of integers/floats, and the size of the sequence must match the attribute’s size.

Raises hou.GeometryPermissionError if this geometry is not modifiable.

attribType(self)hou.attribType enum value

Return the enumerated value hou.attribType.Vertex. Points, primitives, vertices, and geometry support the same set of methods for querying their attributes, and this method is one of them.

See also:

point(self)hou.Point

Return the hou.Point object that this vertex refers to. Each vertex refers to exactly one point.

prim(self)hou.Prim

Return the hou.Prim object containing this vertex.

If the primitive is a face, use hou.Prim.vertices to access the other vertices in the primitive. If it is a surface, use hou.Surface.vertex, hou.Surface.numRows, and hou.Surface.numCols.

geometry(self)Geometry

Return the hou.Geometry object containing this vertex.

number(self)int

Return the number of this vertex. Vertices in the same primitive are numbered sequentially starting from 0, and the vertices returned by hou.Prim.vertices are in order by their number.

destroy(self)

Not implemented yet

normal(self)hou.Vector3

Not implemented yet