[vtkusers] pick and update
Boris Avdeev
borisaqua at gmail.com
Tue Jan 31 10:37:55 EST 2006
Thanks, that makes sense. However my problem still exists. This is the
code I have now:
picksR = vtkPolyDataReader()
picksR.SetFileName(fname) #points
picks = picksR.GetOutput()
picks.Update()
picks.SetSource(None)
del picksR
#reconstruct a surface from the scatteres points
proxy = vtkSurfaceReconstructionFilter()
proxy.SetInput(picks)
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 picks, renWin
picks.GetPoints().InsertNextPoint(obj.GetPicker().GetPickPosition())
renWin.Render() #The surface does not change
writer = vtkPolyDataWriter()
writer.SetFileName(fname)
writer.SetInput(picks)
writer.Write() # This works fine
iact.AddObserver("EndPickEvent", PickingFunction)
Any ideas?
Thanks,
Boris
On 1/30/06, David Gobbi <dgobbi at atamai.com> wrote:
> In Python you should never use Register() or Delete(). The python
> wrappers tie together the Python GC with VTK and call these for you
> automatically.
>
> If you want to keep the data around, you just have to keep a python
> reference to it around, you don't need to Register it. Note that the
> data keeps a reference to the source, so you need to break the pipeline
> after the Update() if you want the source to be deleted. In VTK 4, you
> would do data.SetSource(None).
>
> - David
>
More information about the vtkusers
mailing list