VTK2OBJ

Post date: 2017/01/21 2:30:06

Unity3Dでの読み込みを目指して,VTKファイルからOBJへの変換を考える.

                  • #!/usr/bin/python # vtk2stl.py from vtk import * fname1 = 'test.vtk' fname2 = 'test.stl' reader = vtkUnstructuredGridReader() reader.SetFileName(fname1) reader.Update() geomFilter = vtkGeometryFilter() geomFilter.SetInputConnection(reader.GetOutputPort()) geomFilter.Update() writer = vtkSTLWriter() writer.SetInputConnection(geomFilter.GetOutputPort()) writer.SetFileName(fname2) writer.Write()