Hello, I am a newcomer to VTK recently. Now I have a task to finish. I need to construct a 3D object from a several sections of an object. To be more specifically, I need to first construct a section from multiple points and then stack all scetions into a 3D object.
Here is my current thought and code. I combine points in a single section and store them in vtkpolyData. Later I want to stack all vtkpolyData and then show them in the vtk renderer windows.
If you need the ability to access properties, pick each individual polydata, you can use the vtkCompositeDataSet / vtkPartitionedDataSetCollection API for managing the whole model.
If you would simply like to combine them into a single vtkPolyData object, use vtkAppendPolyData.
I think it is your use of Get here: appendFilter->AddInputData(polyData.Get()); , polyData.Get()) is returning a raw pointer to the contained object. In this case it goes out of scope after the for loop exits, hence no PolyData.
Don’t use Get and see what happens. Also look at CombinePolyData.
But since you mentioned raw pointer. I come out that I first store all polydata I get in my own class. And then I use appendpolydata to store the polydata I store in the class.
BTW, I want to ask does this issue relative to the difference between vtkNew and vtkSmartPointer?
@yen I think the issue is that your polydata doesn’t have any cells. You are using InsertCellPoint without calling InsertNextCell. You need both of those calls for adding a valid cell to the lines cellarray.