Export linear extrusion as .ply file

Hello,

I’ve had great luck exporting colored glyphs as .ply files for use in other software.

Now I’m trying to export some “cylinders” which are created using a linear extrusion, more specifically, like this:

disk = vtk.vtkDiskSource()
disk.SetCircumferentialResolution(128)
disk.SetRadialResolution(1)
disk.SetOuterRadius(2)
disk.SetInnerRadius(1)
pipe = vtk.vtkLinearExtrusionFilter()
pipe.SetInputConnection(disk.GetOutputPort())
pipe.SetExtrusionTypeToNormalExtrusion()
pipe.SetVector(0, 0, 1)
pipe.SetScaleFactor(5)
pipe.Update()

However, doing this, and writing it to a .ply file

writer = vtk.vtkPLYWriter()
writer.SetFileName('pipe.ply')
writer.SetInputConnection(pipe.GetOutputPort())
writer.Write()

only leaves me with 2 disks, one upper and one lower, and not the “pipe” that I’m seeing if I add this to a render window.

I tried the same thing, using a cylinder instead of my extruded disk, and here I had success.

Does anyone know what I am missing?

I’m clearly an idiot here, delete if you want.

The answer:

Add a triangle filter.

fil = vtk.vtkTriangleFilter()
fil.SetInputConnection(pipe.GetOutputPort())

and use this in the writer and it works fine.