Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5745

Construct Mesh GHPython

$
0
0

@tim.stark wrote:

Hello everyone,

I have trouble constructing a mesh in Python.

import Rhino.Geometry as rg
vertices = []
faces = []
for i in range(len(iMeshes)):
    vertices.append(rg.Mesh.Vertices.GetValue(iMeshes[i]))
for i in range(len(iMeshes)):
    faces.append(rg.Mesh.Faces.GetValue(iMeshes[i]))

Var 1

for i in range(len(iMeshes)):
    tempMesh = rg.Mesh()
    tempMesh.Faces.AddFace(faces[i])

=> Runtime error (ArgumentTypeException): expected MeshFace, got MeshFaceList

Var2

for i in range(len(iMeshes)):
    tempMesh = rg.Mesh()
    for j in faces[i]:
        tempMesh.Faces.AddFace(faces[i][j])

=> Runtime error (ArgumentTypeException): expected int, got MeshFace

In Var1 I get an error that MeshFace is expected, but if I give him MeshFace in Var2 he wants an integer.
Can someone tell me where the error is? Went threw all documentation I could found, but looks like I don’t see it.

181028_python_help.gh (3.8 KB)

Thank you very much.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5745

Trending Articles