示例#1
0
def readPoints():
    nv,vertices = triangleio.read(filename)
        
    output = pointsource.GetPolyDataOutput()
    points = vtk.vtkPoints()
    output.SetPoints(points)

    for vertex in vertices:
        x,y,z = vertex[0],vertex[1],vertex[2]
        points.InsertNextPoint(x,y,z)
示例#2
0
from pylab import *
import sys,triangleio

try:
    name = sys.argv[1]
except:
    raise Exception('Must enter filename to read')

nv,vertices,nf,facets = triangleio.read(name,faces=True)

from enthought.mayavi import mlab
mlab.triangular_mesh(vertices[:,0],vertices[:,1],vertices[:,2],facets)
mlab.show()
示例#3
0
from numpy import *
import triangleio,sys

args = triangleio.initArguments()

filename = args.get('in',None,True)
name  = args.get('out',None,True)
nv, vertices = triangleio.read(filename)

file = open(name,'w')
file.write('# vtk DataFile Version 2.0\n')
file.write('Point cloud\n')
file.write('ASCII\n')
file.write('DATASET POLYDATA\n')
file.write('POINTS %d float\n' % nv)
for vertex in vertices:
    file.write('%8f %8f %8f\n' % (vertex[0],vertex[1],vertex[2]))
file.close()