[vtkusers] Cell pick and Delete

fanghao 312846295 at qq.com
Tue Mar 6 00:49:41 EST 2012


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.



More information about the vtkusers mailing list