[vtkusers] ->Update()....what does that do?

Clinton Stimpson clinton at elemtech.com
Wed Feb 3 12:50:22 EST 2010


There is the common problem of the char* pointer becoming invalid when the 
QByteArray goes out of scope.  But if you're not omitting anything from your 
code snippet, I guess that's not your problem.  What about using a debugger 
and checking data when it goes to SetFileName(data).

Clint

On Wednesday 03 February 2010 10:41:13 am Giancarlo Amati wrote:
> Hi David,
>
> yes I opened the file with Paraview and it's all perfectly visualised.
> I've printed 'data' and the path name is ok.
>
> what the compiler returns is this:
> Unhandled exception at 0x775c1ffe in QTVTK_Diorama.exe: 0xC0000005: Access
> violation reading location 0x5f5bc9f4.
>
> Many Thanks.
> Giancarlo
>
> Date: Wed, 3 Feb 2010 11:43:40 -0500
> From: daviddoria+vtk at gmail.com
> CC: vtkusers at vtk.org
> Subject: Re: [vtkusers] ->Update()....what does that do?
>
> On Wed, Feb 3, 2010 at 11:33 AM, Giancarlo Amati
> <ilferraresebono at hotmail.it> wrote:
>
>
>
>
>
>
> Hello VTK users,
> this might be already posted but I can't find it in the repository. So, I
> apologies for any duplicate.
>
> I have these statements:
>
> QByteArray temp = fn->toAscii();
> char *data = temp.data();
>
>         vtkSmartPointer<vtkPolyDataReader> drs = 
> vtkSmartPointer<vtkPolyDataReader>::New(); drs->SetFileName(data);
>          drs->Update();
>         vtkPolyData *pd = drs->GetOutput();
>
>
> where QByteArray is a QT array of byte then converted into a string and
> passed as input to PolyDataReader. so basically it's the path of the file
> .vtk (which is a polydata) I would like to load.
>
> but the problem is that when i get to
>
>
> drs->Update();
>
> it all crashes saying that an Unhandled expection has been generated.
>
> I checked out around and apparently it's the standard way to read a vtk
> file (the one I have is ASCII format).
>
>
> Any suggestion would be helpful..
>
> Kind Regards.
> Giancarlo Amati
>
>
> A couple of things -
>
> 1) try opening the file with Paraview. If it crashes, your file is bad.2)
> did you print 'data' to make sure the file name is as you expect? Thanks,
>
> David
> _________________________________________________________________
> Personalizza la tua vita digitale, scarica i nuovi gadget!
> http://www.pimpit.it/




More information about the vtkusers mailing list