[vtkusers] vtkAssembly VisibilityOff function not working as expected

Day, Michael A AMRDEC/UAH mike.a.day at us.army.mil
Mon Aug 29 09:51:25 EDT 2005


Howdy

It seems to me that the following code should produce 3 cubes, with the 
middle one invisible.  However, I only can get the middle cube
to go invisible if I uncomment the "anotherCube->VisibilityOff();" line.
Shouldn't the vtkAssembly be able to make its children invisible,
without having to explicitly call VisibilityOff on each individual
child?  Am I missing something here?

<snip>

vtkAssembly* topAssem = vtkAssembly::New();

double i = 0;
for(i = 0; i < 15; i+=5) {
  vtkAssembly* nextAssem = vtkAssembly::New();
  anotherCube = makeCubeActor();  //this function makes a 1x1x1 cube
  anotherCube->SetPosition(i,i,i);
  
  nextAssem->AddPart(anotherCube);

  if(i == 5) {
   nextAssem->VisibilityOff();
   //anotherCube->VisibilityOff();  //shouldn't need this line
  }

  topAssem->AddPart(nextAssem);
}

//add the Assembly to Renderer, the Renderer to a RenderWindow etc.

<snap>

Thanks,

Mike Day
Virtual Targets Center
https://modelexchange.army.mil/




More information about the vtkusers mailing list