[vtkusers] pick and update

Tom Radcliffe tradcliffe at predictivepatterns.com
Mon Jan 30 13:25:00 EST 2006


The reader's output will be regenerated during the next Update, so your 
changes will be wiped out.  You should pull the data out of the reader 
and make a copy.  Then make the copy of the data from the reader the 
start of your pipeline.

To do this without copying you can do something like this (in C++, 
something similar in Python):

vtkPolyData* pData = pReader->GetOutput();
pData->Register(0);
pReader->Delete();

This should drop the reader but keep the data around.

--Tom

-- 
Tom Radcliffe, Ph.D., P.Eng.
President, Predictive Patterns Software Inc.
http://www.predictivepatterns.com | 613-483-9803
tradcliffe at predictivepatterns.com


Boris Avdeev wrote:

>Hello,
>I am trying to make my pipeline to update as I pick and had no luck so far.
>Here is the pipeline:
><pre>
>      Modify on a pick event
>       |
>       V
>Reader -> Filter -> Mapper
></pre>
>I modify the reader's output. Is it not a good idea? Where have I messed up?
>Here is some python code:
>
>    picksR = vtkPolyDataReader()
>    picksR.SetFileName(fname)
>    proxy = vtkSurfaceReconstructionFilter()
>    proxy.SetInput(picksR.GetOutput())
>    surf = vtkContourFilter()
>    surf.SetValue(0,0.0)
>    surf.SetInput(proxy.GetOutput())
>
>    surfMap = vtkPolyDataMapper()
>    surfMap.SetInput(surf.GetOutput())
>    surfAct = vtkActor()
>    surfAct.SetMapper(surfMap)
>    ren.AddActor(surfAct)
>
>    def PickingFunction(obj, event):
>        global picksR, renWin
>        pt = obj.GetPicker().GetPickPosition()
>        picksR.GetOutput().GetPoints().InsertNextPoint(pt)
>        renWin.Render()
>
>    iact.AddObserver("EndPickEvent", PickingFunction)
>
>
>Thanks,
>Boris
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the 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