示例#1
0
文件: ioUtils.py 项目: caomw/director
def readVrml(filename):
    '''
    Returns list of vtkPolyData meshes and a list of colors as 3-tuples
    '''
    l = vtk.vtkVRMLImporter()
    l.SetFileName(filename)
    l.Read()
    w = l.GetRenderWindow()
    ren = w.GetRenderers().GetItemAsObject(0)
    actors = ren.GetActors()
    actors = [actors.GetItemAsObject(i) for i in xrange(actors.GetNumberOfItems())]
    meshes = [a.GetMapper().GetInput() for a in actors]
    colors = [ac.GetProperty().GetColor() for ac in actors]
    return meshes, colors
示例#2
0
def readVrml(filename):
    '''
    Returns list of vtkPolyData meshes and a list of colors as 3-tuples
    '''
    l = vtk.vtkVRMLImporter()
    l.SetFileName(filename)
    l.Read()
    w = l.GetRenderWindow()
    ren = w.GetRenderers().GetItemAsObject(0)
    actors = ren.GetActors()
    actors = [
        actors.GetItemAsObject(i) for i in xrange(actors.GetNumberOfItems())
    ]
    meshes = [a.GetMapper().GetInput() for a in actors]
    colors = [ac.GetProperty().GetColor() for ac in actors]
    return meshes, colors