[vtkusers] Writing to STL with color.

David Gobbi david.gobbi at gmail.com
Sat Dec 13 00:26:46 EST 2014

On Fri, Dec 12, 2014 at 9:22 PM, abstracted <jds0447 at unt.edu> wrote:

> A project I am working on requires that a mesh that is generated from vtk
> primitives get saved to an STL file.
> This is easy enough, but I need the (binary) stl to be saved with colors.
> Is
> this possible?

Not possible, because the STL file format only stores geometry.  It doesn't
store colors.

> This appears particularly cumbersome since PolyData does not contain color
> data, but the actor usually does.

The polydata can contain color data, and there are various ways of adding
color data to the polydata.  In fact, the default behavior in VTK is that
actor color (more precisely the vtkProperty color) is only used when the
polydata itself provides no color.

But, of course, any color data is lost if the data is saved in an STL file,
STL has no support for color.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141212/c5101545/attachment-0001.html>

More information about the vtkusers mailing list