# Mesh Class

A Mesh describes an instance of a single geometry mesh. It is an instance of a Prim Class.

## Members[edit]

`closedU`

→ `bool`

**(Read Only)**:

Returns True if the mesh is closed in U, False otherwise.

`closedV`

→ `bool`

**(Read Only)**:

Returns True if the mesh is closed in V, False otherwise.

`numRows`

→ `int`

**(Read Only)**:

Number of rows in the mesh.

`numCols`

→ `int`

**(Read Only)**:

Number of columns in the mesh.

## Methods[edit]

No operator specific methods.

# Prim Class[edit]

## Members[edit]

`center`

→ `tdu.Position`

:

Get or set the barycentric coordinate of this primitive. It is expressed as a tdu.Position object.

`index`

→ `int`

**(Read Only)**:

The primitive index in the list.

`normal`

→ `tdu.Vector`

**(Read Only)**:

The calculated normal vector of this primitive, expressed as a tdu.Vector object.

`owner`

→ `OP`

**(Read Only)**:

The OP to which this object belongs.

`weight`

→ `float`

**(Read Only)**:

The associated weight of the primitive. Only certain primitives, such as those created by the Metaball SOP can modify this value from its default of 2.0.

`direction`

→ `tdu.Vector`

**(Read Only)**:

A normalized vector pointing from the centroid of the SOP to the centroid of this primitive.

`min`

→ `tdu.Position`

**(Read Only)**:

The minimum coordinates of this primitive along each dimension, expressed as a tdu.Position object.

`max`

→ `tdu.Position`

**(Read Only)**:

The maximum coordinates of this primitive along each dimension, expressed as a tdu.Position object.

`size`

→ `tdu.Position`

**(Read Only)**:

The size of this primitive along each dimension, expressed as a tdu.Position object.

## Methods[edit]

`destroy(destroyPoints=True)`

→ `None`

:

Destroy and remove the actual primitive this object refers to. This operation is only valid when the primitive belongs to a scriptSOP. Note: after this call, other existing Prim objects in this SOP may no longer be valid.

- destroyPoints - (Keyword, Optional) If True, its points are destroyed as well, if false, they are simply detached. The argument is True by default.

`eval(u, v)`

→ `td.Position`

:

Evaluate the position on the primitive given the u,v coordinates. u,v should be in the range [0,1]. Polygons and curves ignore the v parameter.

center = op('box1').prim[0].eval(0.5, 0.5)

### Special Functions[edit]

`len(Prim)`

→ `int`

:

Returns the total number of vertices.

a = len(op('box1').prim[0])

`[index]`

→ `td.Vertex`

:

Get specific vertex given an integer index

n = op('box1').prims[5][0]

`[row, col]`

→ `td.Vertex`

:

Get specific vertex from a Mesh given integer row and column values.

v = op('grid1').prims[2,3]

`Iterator`

→ `td.Vertex`

:

Iterate over each vertex.

for m in op('box1').prims[5]: # do something with m, which is a Vertex

Any of the procedural data operators. OPs do all the work in TouchDesigner. They "cook" and output data to other OPs, which ultimately result in new images, data and audio being generated. See Node.

An Operator Family that reads, creates and modifies 3D polygons, curves, NURBS surfaces, spheres, meatballs and other 3D surface data.