[vtkusers] isosurface update issue

David E DeMarle dave.demarle at kitware.com
Mon Dec 3 10:02:37 EST 2018


>
> It may not be a good idea to delete the actor and make a new one in every
> call.


It can work, but in addition to deleting the old actor, you have to call
renderer->RemoveActor(oldactor); Otherwise the renderer's reference keeps
the original actor alive.

David E DeMarle
Kitware, Inc.
Principal Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Sat, Dec 1, 2018 at 9:27 AM newcfd via vtkusers <
vtkusers at public.kitware.com> wrote:

> Thanks for your reply. mapSphere was a typing error and should be mapper.
> I made the following changes and still have the same problem.
>
> void MyApp::redraw( const double value )
> {
>     if ( m_pActor == nullptr )
>     {
>        m_pActor = vtkActor::New();
>       vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
>        mapper->SetScalarRange(0.0, 1.0);
>        m_pActor->SetMapper( mapper );
>
>        renderer->AddActor( m_pActor );
>        renderer->SetBackground(1,1,1); // Background color white
>    }
>
>    vtkStructuredGrid * mesh =...
>
>   vtkSmartPointer<vtkContourFilter> filter =
>   vtkSmartPointer<vtkContourFilter>::New();
>   filter->SetInputData( mesh );
>   filter->SetNumberOfContours( 1 );
>   filter->Setvalue( 0, value ); // value is passed in
>
>   m_pActor->GetMapper()->SetInputConnection( filter->GetOutputPort() );
>   renderWindow->Render();
> }
>
> It may not be a good idea to delete the actor and make a new one in every
> call.
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181203/567d09f3/attachment.html>


More information about the vtkusers mailing list