[vtkusers] ErrorEvent observer on algorithms (or vtkClipClosedSurface)

Bryn Lloyd lloyd at itis.ethz.ch
Thu Feb 2 09:02:43 EST 2012


Yes, it does return True (or 1).

I am iterating through a model, which consists of multiple pieces (>200).
I clip each piece and would like to know if the operation failed, in 
order to analyze the problem and possibly fix it by hand (if possible) 
or restart the clipping with slightly different parameters.

If I cannot catch the error, then I cannot implement either of these 
strategies.






On 2/2/2012 2:56 PM, David Gobbi wrote:
> Does clipper.HasObserver("ErrorEvent") return true?
>
>
> On Thu, Feb 2, 2012 at 6:32 AM, Bryn Lloyd<lloyd at itis.ethz.ch>  wrote:
>> Same if I use this form:
>>
>>             clipper.AddObserver("ErrorEvent", e)
>>
>>
>>
>>
>> On 2/2/2012 2:29 PM, Bryn Lloyd wrote:
>>> 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
>>> _______________________________________________
>>>
>>> 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
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list