[vtkusers] Automatic building of Cubes

Bill Lorensen bill.lorensen at gmail.com
Fri Feb 11 23:02:08 EST 2011


Rene,

Try using an std::vector and use smart pointers so that you need not
worry about deleting them.

Something like

std::vector<vtkSmartPointer<vtkCubeSource> > cubes;
for(i=0; i <= x; i++)
  {
   vtkSmartPointer<vtkCubeSource> cube =
      vtkSmartPointer<vtkCubeSource>::New();
   cubes.push_back(cube);
  }

The wiki example here stores actors in an std::vector
http://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/VectorOfActors

Bill
On Fri, Feb 11, 2011 at 10:05 AM, Rene_Wohlgethan
<rwohlgethan at icqmail.com> wrote:
>
>
> I´ve got a problem again and i don´t know how to solve it.
>
>
> i want to do a procedure like this
>
>
> for(i=0; i<=x, i++)
>
> vtkCubeSource *cube[i] = vtkCubeSource::New();
>
> but i can´t do it like this, because cube needs a constant where "i" is.
>
>
> Is there a way to build a Vector or Array of Cubes?
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Automatic-building-of-Cubes-tp3381336p3381336.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list