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
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
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.