[vtkusers] Removing Actors

Renato Cesar Pompeu rcpompeu at hotmail.com
Mon May 5 11:20:36 EDT 2008


I'm using a button to show/disappear an actor. 
Here's the code:
 
vtkCubeSource *cubo = vtkCubeSource::New();    cubo->SetXLength(14);    cubo->SetYLength(14);    cubo->SetZLength(14);    cubo->SetCenter(a/2,b/2,c/2);
  vtkPolyDataMapper *cuboMapper = vtkPolyDataMapper::New();    cuboMapper->SetInput(cubo->GetOutput());
  vtkActor *cubo1 = vtkActor::New();    cubo1->SetMapper(cuboMapper);    cubo1->GetProperty()->SetColor(0.52, 0.27, 0);    cubo1->GetProperty()->SetAmbient(0.2);    cubo1->GetProperty()->SetDiffuse(0.3);    cubo1->GetProperty()->SetSpecular(0.8);
 
if  (tbnCubo->Down) {                     // the button is down = the cube appears    VTK3->GetRenderer()->AddActor(cubo1);
}
else {                                           // the button is up = the cube disappears     VTK3->GetRenderer()->RemoveActor(cubo1);    VTK3->GetRenderer()->RemoveViewProp(cubo1);    VTK3->GetRenderer()->Clear();
}
cubo->Delete();cuboMapper->Delete();cubo1->Delete();
VTK3->Invalidate();
When the button is up the actor does not disappear.
 
 
 


From: frederic.danesi at dinccs.comTo: rcpompeu at hotmail.comSubject: RE: [vtkusers] Removing ActorsDate: Mon, 5 May 2008 17:01:17 +0200






Just a dumb question : is your outlineActor the same at each call or not ? … could you please provide us with more sourcecode (t least the code before your condition …) ?
Fred.
 



De : vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] De la part de Renato Cesar PompeuEnvoyé : lundi 5 mai 2008 15:45À : vtkusers at public.kitware.comObjet : [vtkusers] Removing Actors
 
Hello All, 

How do I remove an individual actor from the scene? My code does not work. Someone help me? Thanks.
 if  (tbnIniciar->Down) {  VTK3->GetRenderer()->AddActor(outlineActor);  } else {    VTK3->GetRenderer()->RemoveActor(outlineActor);    VTK3->GetRenderer()->RemoveViewProp(outlineActor);    VTK3->GetRenderer()->Clear();   } VTK3->Invalidate();



Notícias direto do New York Times, gols do Lance, videocassetadas e muitos outros vídeos no MSN Videos! Confira já!
_________________________________________________________________
Conheça o Windows Live Spaces, a rede de relacionamentos do Messenger!
http://www.amigosdomessenger.com.br/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080505/00f3cdae/attachment.htm>


More information about the vtkusers mailing list