Export mesh
In [1]:
Copied!
from imodmodel import ImodModel
from imodmodel.models import Mesh, Object
import trimesh
from imodmodel import ImodModel
from imodmodel.models import Mesh, Object
import trimesh
In [ ]:
Copied!
teapot = trimesh.load('data/teapot.obj')
teapot = trimesh.load('data/teapot.obj')
In [ ]:
Copied!
model = ImodModel()
model.objects.append(Object())
model.objects[0].meshes.append(Mesh())
model.objects[0].meshes[0].vertices = teapot.vertices
model.objects[0].meshes[0].indices = teapot.faces
model = ImodModel()
model.objects.append(Object())
model.objects[0].meshes.append(Mesh())
model.objects[0].meshes[0].vertices = teapot.vertices
model.objects[0].meshes[0].indices = teapot.faces
In [4]:
Copied!
model.to_file('teapot.mod')
model.to_file('teapot.mod')