[vtkusers] STLWriter output multiple splines (via vtkTriangleFilter)
rccm.kyoshimi at gmail.com
Thu Dec 29 20:33:46 EST 2016
You need to convert an unstructured grid to a polydata which is
required by vtkSTLWriter.
Or you can use the vtkAppendPolyData instead of the vtkAppendData.
2016-12-30 6:59 GMT+09:00 sean Harre <seanharre at gmail.com>:
> I have a simple example to show a problem I need help resolving. I'm very
> new to VTK and have copied the TubesFromSplines example C++ code to almost
> what I need, but one issue remains to be solved.
> The intent is to have a program where I can add multiple splines/tubes and
> then output the combined form to an STL file.
> The example program I have attached generates the correct model in the
> render window, and I get one spline in the output STL.
> But I would like all programmed splines to be merged and output to the STL
> file. I need to merge them before calling the STLWriter. This is where I am
> The example code shows a working example, and what I thought would work but
> is failing and marked 'BROKEN',
> // stlWriter->SetInputConnection(appendFilter->GetOutputPort()); //
> // ERROR: In
> line 810
> // vtkCompositeDataPipeline (0x7f987670c630): Input for connection index
> 0 on input port index 0 for
> // algorithm vtkSTLWriter(0x7f9876709f40) is of type
> vtkUnstructuredGrid, but a vtkPolyData is required.
> stlWriter->SetInputConnection(triangleFilter->GetOutputPort()); // WORKS
> I suspect there is something easy I'm missing, and would appreciate any
> I've also attached some screenshots showing how the render window and STL
> output look.
> And yes the code is ugly and repeats itself, but I'm just trying to
> understand the basic concept first then can add a function for adding each
> spline, etc...
> Sean Harre
> seanharre at gmail.com
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the VTK FAQ at:
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
More information about the vtkusers