Rhino3dm: face get mesh always None!

Hello , what is the error in this code? always GetMesh(rh.MeshType.Any) is None.
The file is a simple cube

import rhino3dm as rh

file = "..../cube.3dm"
rf = rh.File3dm.Read(file)

for obj in rf.Objects:
        geo = obj.Geometry
        if geo.ObjectType == rh.ObjectType.Brep:
            faces = geo.Faces
            for i in range(len(faces)):
                print i, faces[i]
                mesh = faces[i].GetMesh(rh.MeshType.Any)
                print mesh

0 <rhino3dm._rhino3dm.BrepFace object at 0x00000000037E4650>
None
1 <rhino3dm._rhino3dm.BrepFace object at 0x00000000037E4650>
None
2 <rhino3dm._rhino3dm.BrepFace object at 0x00000000037E4650>
None
3 <rhino3dm._rhino3dm.BrepFace object at 0x00000000037E4650>
None
4 <rhino3dm._rhino3dm.BrepFace object at 0x00000000037E4650>
None
5 <rhino3dm._rhino3dm.BrepFace object at 0x00000000037E4650>
None

If the .3dm file was not saved with render meshes, then there won’t be any meshes to get.

Feel free to post your .3dm file.

– Dale

Thanks , in the simple box file i hit render button than save and the script work fine but with another model and the same method don’t work.
And this wok fine with extrusion unlike faces

if geo.ObjectType == rh.ObjectType.Extrusion: geo.GetMesh(rh.MeshType.Any)

file = "....../test.3dm"
rf = rh.File3dm.Read(file)

for obj in rf.Objects:
    geo = obj.Geometry
    print geo
    if geo.ObjectType == rh.ObjectType.Extrusion:
        #geo.GetMesh(rh.MeshType.Any)
        faces = geo.ToBrep(True).Faces
        for i in range(len(faces)):
            print i, faces[i]
            mesh = faces[i].GetMesh(rh.MeshType.Any)
            print mesh

This is the 3d file:

test.3dm (77.5 KB)

You need to save your file with one viewport in Shaded or Rendered mode.

Thanks, dont’t wok the same message None

For an extrusion it is better to directly GetMesh. This is what we do in import_3dm blender add-on as well. I guess creatiing a Brep from the extrusion still doesn’t give you the render meshes, as the brep hasn’t been meshed yet.

1 Like

Thank you , so import in Blender also need this ?

Yes.

1 Like