MantisBT - VTK
View Issue Details
0001684VTK(No Category)public2005-03-17 19:162016-08-12 09:54
Christopher.Moore 
Kitware Robot 
lowminoralways
closedmoved 
 
 
0001684: can't add vtkPropAssembly to vtkPropAssembly
The documentation says that a PropAssembly can contain other PropAssemblies, but my code seg faults when I try this.

I create two PropAssemblies, one with a ConeSource and one with a SphereSource, add them to the Renderer, this works.

I create two PropAssemblies, one with a ConeSource AND a SphereSource, and then add this to the second PropAssembly -> run-time error "segmentation fault", app crashes

Short code segment:

#include "vtkConeSource.h"
#include "vtkSphereSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkCamera.h"
#include "vtkPropAssembly.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
 
int main( int argc, char *argv[] )
{
 
vtkRenderer *ren1= vtkRenderer::New();
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer( ren1 );
renWin->SetSize( 300, 300 );
iren->SetRenderWindow( renWin );
 
// make a cone
vtkConeSource *cone = vtkConeSource::New();
vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
coneMapper->SetInput( cone->GetOutput() );
vtkActor *coneActor = vtkActor::New();
coneActor->SetMapper( coneMapper );
 
// make a sphere
vtkSphereSource *sphere = vtkSphereSource::New();
vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
sphereMapper->SetInput( sphere->GetOutput() );
vtkActor *sphereActor = vtkActor::New();
sphereActor->SetMapper( sphereMapper );
 
// this works:
// ren1->AddProp( coneActor );
// ren1->AddProp( sphereActor );
 
 
// this works:
// vtkPropAssembly *pa1= vtkPropAssembly::New();
// pa1->AddPart(coneActor);
// vtkPropAssembly *pa2= vtkPropAssembly::New();
// pa2->AddPart(sphereActor);
// ren1->AddProp(pa1);
// ren1->AddProp(pa2);
                                                                                               
// this doesnt (seg faults):
vtkPropAssembly *pa1 = vtkPropAssembly::New();
pa1->AddPart(coneActor);
pa1->AddPart(sphereActor);
vtkPropAssembly *pa2 = vtkPropAssembly::New();
pa2->AddPart(pa1);
ren1->AddProp(pa2);
                                                                                               
                                                                                               iren->Start();
                                                                                               }
No tags attached.
Issue History
2008-11-30 09:24Mathieu MalaterreAssigned ToMathieu Malaterre => François Bertel
2008-11-30 20:21François BertelAssigned ToFrançois Bertel =>
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:54Kitware RobotNote Added: 0036778
2016-08-12 09:54Kitware RobotStatusexpired => closed
2016-08-12 09:54Kitware RobotResolutionopen => moved
2016-08-12 09:54Kitware RobotAssigned To => Kitware Robot

Notes
(0036778)
Kitware Robot   
2016-08-12 09:54   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.