[vtkusers] STLWriter output multiple splines (via vtkTriangleFilter)

kenichiro yoshimi rccm.kyoshimi at gmail.com
Thu Dec 29 20:33:46 EST 2016


Hi Sean,

You need to convert an unstructured grid to a polydata which is
required by vtkSTLWriter.
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/GeometryFilter
Or you can use the vtkAppendPolyData instead of the vtkAppendData.
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/CombinePolyData

Thanks,
Yoshimi

2016-12-30 6:59 GMT+09:00 sean Harre <seanharre at gmail.com>:
> 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
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>


More information about the vtkusers mailing list