[vtkusers] AppendPolyData Problem

Secolas UA secolasua at gmail.com
Tue Jan 23 11:24:42 EST 2007


Olá,

experimentei o código e mesmo assim não funciona... começo a pensar que
talvez seja do modelo que eu estou a importar, poderia-me fornecer um modelo
que tenha testado para eu tirar as dúvidas?

Desde já o meu obrigado

Ricardo Seco
Universidade de Aveiro

On 1/23/07, Paulo José Correia Bernardes <pbernardes at uaum.uminho.pt> wrote:
>
>  Viva,
>
>
>
> O código que lhe envio está a funcionar…
>
> Veja se lhe serve.
>
>
>
> Cumprimentos,
>
>
>
> Paulo Bernardes
>
>
>
>
>
> vtkAppendPolyData *appendDataFromVRMLFile ( vtkVRMLImporter *vrmlData )
>
> {
>
>       vtkAppendPolyData *apd=vtkAppendPolyData::New();
>
>       vtkPolyData *vrmlPolyData=vtkPolyData::New();
>
>       vtkActorCollection *actorCollection=vtkActorCollection::New();
>
>       vtkActor *actorOfCollection=vtkActor::New();
>
>
>
>       actorCollection = vrmlData->GetRenderer()->GetActors();
>
>
>
>       actorCollection->InitTraversal();
>
>       actorOfCollection = actorCollection->GetNextActor();
>
>
>
>       while( actorOfCollection != NULL )
>
>       {
>
>             vrmlPolyData = reinterpret_cast<vtkPolyData
> *>(actorOfCollection->GetMapper()->GetInput());
>
>             apd->AddInput(vrmlPolyData);
>
>
>
>             actorOfCollection = actorCollection->GetNextActor();
>
>       }
>
>
>
>       return apd;
>
> }
>
>
>  ------------------------------
>
> *De:* vtkusers-bounces+pbernardes=uaum.uminho.pt at vtk.org [mailto:
> vtkusers-bounces+pbernardes=uaum.uminho.pt at vtk.org] *Em nome de *Secolas
> UA
> *Enviada:* terça-feira, 23 de Janeiro de 2007 15:57
> *Para:* vtkusers at vtk.org
> *Assunto:* [vtkusers] AppendPolyData Problem
>
>
>
> Hello!
>
> I am importing a Vrml Model and i want to append to the same polydata the
> polydata information of all the actors, but I have a problem when I do the
> appendSet->Update(); the following message appears Unhandled exception at
> 0x004771b7 in Visualization_Tool.exe: 0xC00000FD: Stack overflow.
>
> I think i'm doing everything right, so i'll put the relevant part of the
> code hoping that someone will have a solution.
>
> Thanks
> Ricardo Seco
> University of Aveiro
>
> ...
> if (NumberOfActors >0)
>     {
>           // Obtenção dos actores da cena
>
>         ActColection = ren1->GetActors();
>
>         tmpData = (vtkPolyData *)
> ((vtkActor*)ActColection->GetLastActor())->GetMapper()->GetInput();
>
>         appendSet->AddInput(tmpData);
>
>         ActColection->InitTraversal();
>
>         // Para cada iteração ...
>         for (int i=0;i<NumberOfActors;i++)
>         {
>             auxiliar++;
>
>             // Obter esse actor
>
>             Act = ActColection->GetNextActor();
>
>             if (Act!=NULL)
>             {
>                 if (Act->GetMapper()!=NULL)
>                 {
>
> printf("------------------------------------------------------------------
> \n");
>
>                     // Este código consoante o indice do actor
>                     // que "engloba" o modelo torna-o ou não
>                     // pickable. No caso de só existir um actor
>                     // este é sempre pickable
>
>                     if ((auxiliar==1) && (NumberOfActors>1))
>                     {
>                         Act->PickableOff();
>                         Act->GetProperty()->SetOpacity(0.5);
>                     }
>
>                     // Vai buscar ao Mapper os dados poligonais
>                     tmpData = (vtkPolyData* )
> Act->GetMapper()->GetInput();
>
>                     appendSet->AddInput(appendSet->GetOutput());
>
>                     appendSet->AddInput(tmpData);
>
>                     appendSet->Update(); //-> Stack OverFlow
>
>                     polyData = (vtkPolyData* )appendSet->GetOutput();
> ...
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070123/df58f62f/attachment.htm>


More information about the vtkusers mailing list