[vtkusers] How to write multiple surfaces into a single STL file?

An Jiye an_jiye at hotmail.com
Thu Feb 19 20:05:54 EST 2004


> You can:
> 1. Use vtkAppendPolyData to append all the outputs from multiple
> vtkContourFilter's into one PolyData
> 2. Just use one instance of vtkContourFilter (and one vtkActor etc) in the
> first place, extracting all the contours by setting multiple contour
values
> in the one filter
>
> HTH
>
> Goodwin

Thank your for the hint£¬Goodwin. Definitely, this will help me very much.

I think maybe the second method is easily to understand, anyway all the
surfaces come from the same data set.

But in my application, I will pick point from EACH surface after rendering.
As I understand, actor is the object of vtk picking. So I can not pick
points from some inside surfaces if all of them were extracted and rendered
by a single actor. Each of these inside surfaces are a part of the actor and
they were coverd by some other parts. I can not separate them.

Considering this point, I will make each actor represents a surface. No
matter which surface I want to pick on, I can set other actors'(surfaces)
PickableOff, or even VisibilityOff.

So my visualization pipeline will be like this:

vtkImageData -> vtkContourFilter(value 1) -> vtkPolyDataMapper -> vtkActor
vtkImageData -> vtkContourFilter(value 2) -> vtkPolyDataMapper -> vtkActor
.. ...

When rendering, add all these actors into one render window. And the picking
function can be applied to each actor.

As for saveing the rendering result into STL file, I will remove all the
actors and data mappers. Instead, use vtkAppendPolyData::AddInput() to
appent all the contour filters' outpus into a single polygonal dataset. The
remaining parts of the wring pipline would be:

vtkAppendPolyData -> vtkTriangleFilter -> vtkSTLWriter

Did I fully understand you?

An Jiye




More information about the vtkusers mailing list