[vtkusers] Please help me use vtkLinearExtrusionFilter

Obada Mahdi omahdi at gmx.de
Sat Jun 24 01:00:56 EDT 2006


Hi Christopher,

I have made an attempt to track down the problem and might have found at 
least the reason.

Christopher Bruns wrote:
>  I get a "Access violation reading location 0x00000000" when attempting 
> to use vtkLinearExtrusionFilter with certain input pipelines, while I 
> can get it to work with others.
> 
>  Presumably I am neglecting to populate part of the input data pipeline 
> correctly.  Can someone please suggest how I might fix my error here?  
> Is there some other filter I need to add?
> 
>  In my debugger the crash appears to occur at line 214 of 
> vtklinearextrusionfilter.cxx in the method RequestData, which contains 
> the statement "outputPD->CopyData(pd,ptId,ptId);"  The variable pd 
> contains input vtkPointData.  Deeper in the stack, 
> pd->Data[0]->GetVoidPointer(0) returns 0x0000000 instead of returning a 
> valid pointer, because  pd->Data[0]->Array is zero as well.

The problem seems to be caused by a small typo in vtkRibbonFilter.cxx 
that leads to some bogus data array entries in the PointData struct, 
messing up the extrusion filter later: There is a line
|  outPD->CopyAllocate(pd,numNewCells);
which should read
|  outCD->CopyAllocate(cd,numNewCells);
(see attached diff).

I was able to perfectly reproduce all the results (and crashes) you 
mentioned with a recent CVS version of VTK, and your test program 
appears to work fine with the above line corrected.

If rebuilding VTK is not an option for you, and you do not need CellData 
to be filtered through, there might be other ways to work around that 
problem and get colored thick ribbons :-)  After all, no point data 
information is destroyed, and you only need to get rid of any bogus 
(empty) data field introduced by vtkRibbonFilter.  For example, writing 
the the output of vtkRibbonFilter to a file (using vtkPolyDataWriter) 
and feeding that same file to vtkExtrusionFilter using a 
vtkPolyDataReader did also work for me.


Good luck :-)

Obada
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkRibbonFilter-CopyAllocate-fix.diff
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060624/5d21920b/attachment.txt>


More information about the vtkusers mailing list