[vtkusers] extract actos

mehdi midi1990 at hotmail.fr
Tue Sep 20 10:38:10 EDT 2016


Hello,

I made a small application in which I load a 3D assembly in a STL format.
Then, I'm able to extract the parts in the assembly as each part becomes a
different actor. However, if I translate the 3D assembly (not the camera :-)
) before extraction, it still works but the extracted actors return to the
positions that are normally obtained when the assembly is not moved. Here is
a code snipet:

appendFilter->AddInputData(vtkPolyData::SafeDownCast(actor->GetMapper()->GetInput()));
appendFilter->Update();
vtkPolyDataConnectivityFilter
*connectivityFilter=vtkPolyDataConnectivityFilter::New();
connectivityFilter->SetInputConnection(appendFilter->GetOutputPort());

connectivityFilter->SetExtractionModeToAllRegions();
connectivityFilter->Update();

nbracteurs=connectivityFilter->GetNumberOfExtractedRegions();
connectivityFilter->SetExtractionModeToSpecifiedRegions();

for (i=0; i<nbracteurs;i++)
{

connectivityFilter->Update();
connectivityFilter->InitializeSpecifiedRegionList();
connectivityFilter->AddSpecifiedRegion(i);
connectivityFilter->Update();

vtkPolyData *output = vtkPolyData::New();
output->DeepCopy(connectivityFilter->GetOutput());
vtkPolyDataMapper *mapper =vtkPolyDataMapper::New();
mapper->SetInputData(output);
mapper->Update();

vtkActor *actor2=vtkActor::New();
actor2->SetMapper(mapper);
m_renderer->AddActor(actor2);

}




--
View this message in context: http://vtk.1045678.n5.nabble.com/extract-actos-tp5740451.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list