[vtkusers] Trying to perform boolean union between more than two polydatas

reaper84 sankowski at gmail.com
Tue Apr 16 08:10:25 EDT 2013


I tested that idea and it works fine but when I'm trying to make a loop and
perform union multiple times on the same function whole code breaks :/. This
is part of my code:

 vtkSmartPointer<vtkBooleanOperationPolyDataFilter> booleanOperation =
vtkSmartPointer<vtkBooleanOperationPolyDataFilter>::New();
 booleanOperation->SetOperationToUnion();
 vtkSmartPointer<vtkBooleanOperationPolyDataFilter> booleanOperation1 =
vtkSmartPointer<vtkBooleanOperationPolyDataFilter>::New();
 booleanOperation1->SetOperationToUnion();

int count_boolean = 0;
.
.
some loop
{
.
.
 triangle->SetInput(tuber->GetOutput()); //this gives me another poly to add
to union

       if (count_boolean ==
0){booleanOperation->AddInput(0,triangle->GetOutput());}
       else if (count_boolean ==
1){booleanOperation->AddInput(1,triangle->GetOutput());}
       else if (count_boolean ==
2){booleanOperation1->AddInput(0,booleanOperation->GetOutput());
                                             
booleanOperation1->AddInput(1,triangle->GetOutput());}
       else
           {
           vtkSmartPointer<vtkPolyData> boolCopy =
vtkSmartPointer<vtkPolyData>::New();
           boolCopy = booleanOperation1->GetOutput();
           boolCopy->Update();
           booleanOperation1->RemoveAllInputs();
           booleanOperation1->Update();
           booleanOperation1->AddInput(0,boolCopy);
           booleanOperation1->AddInput(1,triangle->GetOutput());
           booleanOperation1->Update();
           }
       count_boolean++;
       }

Error: vtkStreamingDemandDrivenPipeline (0x32cf8a0): Input port 0 of
algorithm vtkBooleanOperationPolyDataFilter(0x321e500) has 0 connections but
is not optional.

It seams like after removing inputs no new inputs are added...
Could somebody give me a hint? Thanks!




--
View this message in context: http://vtk.1045678.n5.nabble.com/Trying-to-perform-boolean-union-between-more-than-two-polydatas-tp5719330p5720081.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list