AddMesh

Adds a mesh object to the document.

Syntax

rhinoscriptsyntax.AddMesh ( vertices, face_vertices, vertex_normals=None, texture_coordinates=None, vertex_colors=None )

rhinoscript.mesh.AddMesh ( vertices, face_vertices, vertex_normals=None, texture_coordinates=None, vertex_colors=None )

Parameters

vertices

Required. List.  A list of 3-D points defining the vertices of the mesh.

face_vertices

Required. List.  A list containing lists of four numbers that define the vertex indices for each face of the mesh. If the third and forth vertex indices of a face are identical, a triangular face will be created. Otherwise a quad face will be created.

vertex_normals

Optional. List.  A list of 3-D vectors defining the vertex normals of the mesh. Note, for every vertex, there must be a corresponding vertex normal.

texture_coordinates

Optional. List. A list of 2-D texture coordinates. Note, for every vertex, there must be a corresponding texture coordinate.

vertex_colors

Optional. List.  A list of RGB color values. Note, for every vertex, there must be a corresponding vertex color.

Returns

Guid

The identifier of the new object if successful.

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

vertices = []

vertices.append((0.0,0.0,0.0))

vertices.append((5.0, 0.0, 0.0))

vertices.append((10.0, 0.0, 0.0))

vertices.append((0.0, 5.0, 0.0))

vertices.append((5.0, 5.0, 0.0))

vertices.append((10.0, 5.0, 0.0))

vertices.append((0.0, 10.0, 0.0))

vertices.append((5.0, 10.0, 0.0))

vertices.append((10.0, 10.0, 0.0))

faceVertices = []

faceVertices.append((0,1,4,4))

faceVertices.append((2,4,1,1))

faceVertices.append((0,4,3,3))

faceVertices.append((2,5,4,4))

faceVertices.append((3,4,6,6))

faceVertices.append((5,8,4,4))

faceVertices.append((6,4,7,7))

faceVertices.append((8,7,4,4))

rs.AddMesh( vertices, faceVertices )

 

Also See

MeshFaces

MeshFaceVertices

MeshTextureCoordinates

MeshVertexNormals

MeshVertices