[vtkusers] ErrorEvent observer on algorithms (or vtkClipClosedSurface)

Bryn Lloyd lloyd at itis.ethz.ch
Thu Feb 2 08:29:31 EST 2012


Yes, this is the usage:

             clipper = vtk.vtkClipClosedSurface()
             clipper.SetInputConnection(input.GetProducerPort())
             clipper.SetClippingPlanes(planes)
             clipper.TriangulationErrorDisplayOn()
             clipper.PassPointDataOn()
             e = ErrorObserver()
             clipper.AddObserver("ErrorEvent", errorEventCallback)
             clipper.Update()

             if e.ErrorOccurred():
                 print >>sys.stderr, "ERROR:",e.ErrorMessage()

The vtkWin32OutputWindow pops up and the error is displayed. But the 
ErrorEvent is not invoked.

Thanks
/Bryn




On 2/2/2012 2:17 PM, David Gobbi wrote:
> Since it is vtkClipClosedSurface that you are observing, did you set
> TriangulationErrorDisplayOn()?  The default behavior of this filter is
> to be silent.
>
>   - David
>
> On Thu, Feb 2, 2012 at 5:48 AM, Bryn Lloyd<lloyd at itis.ethz.ch>  wrote:
>> Hi
>>
>> I am trying to catch the ErrorEvent on the vtkClipClosedSurface filter in
>> python.
>>
>> I have tried the code from David Gobbi:
>> http://www.cognitive-antics.net/mw/index.php?title=VTK/Python_ErrorObserver
>>
>> I also tried a simple callback:
>> def errorEventCallback(obj,eventId):
>>     print>>sys.stderr, "ERROR:",obj
>>
>> clipper.AddObserver('ErrorEvent', errorEventCallback)
>> clipper.Update()
>>
>>
>> But it seems the ErrorEvent is not invoked by the vtkErrorMacro. I assume I
>> have not attached the error observer to the correct object, but am unclear
>> about where I should attach the observer.
>>
>> This seems to be a question raised again and again. Most examples use e.g. a
>> imagereader, some say the observer should be attached to the executive ...
>> Mysterious.
>>
>> Thanks for any clarification
>> Bryn



More information about the vtkusers mailing list