[vtkusers] STLWriter output multiple splines (via vtkTriangleFilter)

sean Harre seanharre at gmail.com
Thu Dec 29 16:59:49 EST 2016


Hi,

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
unclear.

The example code shows a working example, and what I thought would work but
is failing and marked 'BROKEN',

{code}
    //---------------------------------------
//    stlWriter->SetInputConnection(appendFilter->GetOutputPort()); //
BROKEN
//
//    ERROR: In
/Users/ali/code/VTK-7.1.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx,
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
    //---------------------------------------
{/code}


I suspect there is something easy I'm missing, and would appreciate any
help.

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...

Thanks!

Sean



-- 
Sean Harre
seanharre at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161229/6893399b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TubesFromSplines.cxx
Type: application/octet-stream
Size: 8230 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161229/6893399b/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: render_correctly_shows_2_splines.png
Type: image/png
Size: 81248 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161229/6893399b/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stl_output_only_one_spline.png
Type: image/png
Size: 114082 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161229/6893399b/attachment-0003.png>


More information about the vtkusers mailing list