I want to create vtk file with mesh
The vtk should have :
vtk DataFile Version 3.0
POINTS
POLYGONS
NORMALS
I create a 3d cube object
cube1 = vtk.vtkCubeSource()
cube1.SetXLength(6)
cube1.SetYLength(10)
cube1.SetZLength(4)
cube1.SetCenter(0,2,0)
cube1.Update()
How do I save it in required format?
I tried this
writer = vtk.vtkPolyDataWriter()
writer.SetInputData(cube1.GetOutput())
writer.SetFileName('cube1.vtk')
writer.Update()
This is another format (it has OFFSETS / CONNECTIVITY)
I tried this
writer = vtk.vtkUnstructuredGridWriter()
writer.SetFileName("Cube1.vtk")
writer.SetInputData(cube1.VTKObject)
writer.Write()
I get an error : no attribute ‘VTKObject’
I have asked the same question on stack(https://stackoverflow.com/questions/63391179/write-file-in-vtk-format)