[vtkusers] Cell pick and Delete

Jothybasu Selvaraj jothybasu at gmail.com
Tue Mar 6 04:38:20 EST 2012


Could you change this order

 appendFilter->RemoveInput(selected);
 appendFilter->Update();

Jothy


On Tue, Mar 6, 2012 at 5:49 AM, fanghao <312846295 at qq.com> wrote:

> I use left button to pick the cell and chang it's color.
> when I push down the right button,the selected cell will be deleted.
>  vtkAppendFilter->addInput(selected) and
> vtkAppendFilter->removeInput(selected) is OK。 but I have a trouble .
> when I want to delete the last one,the error information will come out.
>
>
> ERROR: In ..\..\VTK\Filtering\vtkDemandDrivenPipeline.cxx, line 727
> vtkStreamingDemandDrivenPipeline (0256C690): Input port 0 of algorithm
> vtkAppendFilter(025821B8) has 0 connections but is not optional.xfF
>
> A part of source code:
>
> vtkSmartPointer<vtkDataSetCollection> collection =
> vtkSmartPointer<vtkDataSetCollection>::New();
>                        collection = appendFilter->GetInputList();
>                        int NumberOfItems = collection->GetNumberOfItems();
>                        std::cout<<"There are"<< NumberOfItems<<" Item In
> Collection"<<std::endl;
>                        vtkDataSet *selected = collection->GetItem(i);
>
>                        appendFilter->RemoveInput(selected);
>                        appendFilter->Update();
>
>                        //collection = appendFilter->GetInputList();
>                        //std::cout<<"After Remove,There are"<<
> collection->GetNumberOfItems()<<"
> Item In Collection"<<std::endl;
>
>  selectedMapper->SetInputConnection(appendFilter->GetOutputPort());
>                        selectedActor->SetMapper(selectedMapper);
>                        selectedActor->GetProperty()->SetColor(1,0,0);
>
>
> this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(selectedActor);
>
>
> http://vtk.1045678.n5.nabble.com/file/n5539990/QQ%E6%88%AA%E5%9B%BE20120306135025.jpg
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Cell-pick-and-Delete-tp5539990p5539990.html
> Sent from the VTK - Users mailing list archive at Nabble.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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120306/1fb554c0/attachment.htm>


More information about the vtkusers mailing list