<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hi Clint,<br><br>yeah I've done that...but likely I lose the pointer.... <br>The code I wrote is part of a function member in my main class so.. ... I don't quite get why Vtk behaves like that. <br>May be I have to cast safely the QArrayByte...in a different way?<br><br>dunnow what to think about.<br><br>Giancarlo<br><br>> From: clinton@elemtech.com<br>> To: vtkusers@vtk.org<br>> Subject: Re: [vtkusers] ->Update()....what does that do?<br>> Date: Wed, 3 Feb 2010 10:50:22 -0700<br>> CC: ilferraresebono@hotmail.it; daviddoria+vtk@gmail.com<br>> <br>> <br>> There is the common problem of the char* pointer becoming invalid when the <br>> QByteArray goes out of scope. But if you're not omitting anything from your <br>> code snippet, I guess that's not your problem. What about using a debugger <br>> and checking data when it goes to SetFileName(data).<br>> <br>> Clint<br>> <br>> On Wednesday 03 February 2010 10:41:13 am Giancarlo Amati wrote:<br>> > Hi David,<br>> ><br>> > yes I opened the file with Paraview and it's all perfectly visualised.<br>> > I've printed 'data' and the path name is ok.<br>> ><br>> > what the compiler returns is this:<br>> > Unhandled exception at 0x775c1ffe in QTVTK_Diorama.exe: 0xC0000005: Access<br>> > violation reading location 0x5f5bc9f4.<br>> ><br>> > Many Thanks.<br>> > Giancarlo<br>> ><br>> > Date: Wed, 3 Feb 2010 11:43:40 -0500<br>> > From: daviddoria+vtk@gmail.com<br>> > CC: vtkusers@vtk.org<br>> > Subject: Re: [vtkusers] ->Update()....what does that do?<br>> ><br>> > On Wed, Feb 3, 2010 at 11:33 AM, Giancarlo Amati<br>> > <ilferraresebono@hotmail.it> wrote:<br>> ><br>> ><br>> ><br>> ><br>> ><br>> ><br>> > Hello VTK users,<br>> > this might be already posted but I can't find it in the repository. So, I<br>> > apologies for any duplicate.<br>> ><br>> > I have these statements:<br>> ><br>> > QByteArray temp = fn->toAscii();<br>> > char *data = temp.data();<br>> ><br>> > vtkSmartPointer<vtkPolyDataReader> drs = <br>> > vtkSmartPointer<vtkPolyDataReader>::New(); drs->SetFileName(data);<br>> > drs->Update();<br>> > vtkPolyData *pd = drs->GetOutput();<br>> ><br>> ><br>> > where QByteArray is a QT array of byte then converted into a string and<br>> > passed as input to PolyDataReader. so basically it's the path of the file<br>> > .vtk (which is a polydata) I would like to load.<br>> ><br>> > but the problem is that when i get to<br>> ><br>> ><br>> > drs->Update();<br>> ><br>> > it all crashes saying that an Unhandled expection has been generated.<br>> ><br>> > I checked out around and apparently it's the standard way to read a vtk<br>> > file (the one I have is ASCII format).<br>> ><br>> ><br>> > Any suggestion would be helpful..<br>> ><br>> > Kind Regards.<br>> > Giancarlo Amati<br>> ><br>> ><br>> > A couple of things -<br>> ><br>> > 1) try opening the file with Paraview. If it crashes, your file is bad.2)<br>> > did you print 'data' to make sure the file name is as you expect? Thanks,<br>> ><br>> > David<br>> > _________________________________________________________________<br>> > Personalizza la tua vita digitale, scarica i nuovi gadget!<br>> > http://www.pimpit.it/<br>> <br>                                            <br /><hr />Troppe caselle di posta? <a href='http://www.windowslive.it/hotmail/GestisciAltriAccount.aspx' target='_new'>Gestiscile da Hotmail!</a></body>
</html>