[vtkusers] extract actors but keep their positions

mehdi midi1990 at hotmail.fr
Sat Jul 2 15:27:06 EDT 2016


Hello,

I'm able to extract many actors from one initial actor and display them with
different colors. However, when I change the position of the initial actor
(not the camera) before extracting the actors, the positions of the latter
is the same as when the initial actor was not mooved.

Is there a function to handle this? here is a code snippet:


   
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-actors-but-keep-their-positions-tp5739069.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list