vtkPlanes is empty when using GetPlanes

Hi. I am trying to use vtkBoxWidget2 to clip an unstructured grid. Within my vtkBoxCallback, I initiate the planes variable and then grab the planes from the vtkBoxRepresentation.

However, the planes variable is always empty, and I have no idea why. So when I then do m_actor->GetMapper()->SetClippingPlanes(planes), my actor just disappears because the planes variable is just empty with just zeros.

When debugging, I can clearly see that the vtkBoxRepresentation has the right planes in there.

But when grabbing them, the planes variable is empty.

Does anyone know why this is?

Thanks a lot!

Incase this helps others in the future, I had not set SetInsideOut to true (1). Setting this prior to getting the planes works perfectly.

Here is the code:

namespace {

    class vtkBoxCallback : public vtkCommand
    {
        public:
            static vtkBoxCallback* New()
            {
                return new vtkBoxCallback;
            }

            vtkSmartPointer<vtkActor> m_actor;

            void SetActor(vtkSmartPointer<vtkActor> actor)
            {
                m_actor = actor;
            }

            virtual void Execute(vtkObject* caller, unsigned long, void*)
            {
                vtkSmartPointer<vtkBoxWidget2> boxWidget =
                      dynamic_cast<vtkBoxWidget2*>(caller);

                vtkNew<vtkPlanes> planes;

                vtkSmartPointer<vtkBoxRepresentation> boxRep =
                        dynamic_cast<vtkBoxRepresentation*>(boxWidget->GetRepresentation());

                boxRep->SetInsideOut(1);

                boxRep->GetPlanes(planes);

                this->m_actor->GetMapper()->SetClippingPlanes(planes);
            }

            vtkBoxCallback()
            {
                //none
            }

    }; // vtkBoxCallback

} // namespace

thanks my issue has been fixed.