<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>Access violation error while writing to vtkXMLPolyDataWriter ! possible problem in vtkDataArray ! </TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>
<P><FONT SIZE=2>Hello All,<BR>
I wonder if somebody could help me :(<BR>
<BR>
<BR>
When I try to write a polydata into file.vtp, it gives me error of access violation and a very familiar windows message appears :<BR>
basic.exe has encountered a problem and needs to close,we are sorry for ....<BR>
When I press the debug button on this small message window,it opens up a debug session and takes me to the source code of<BR>
...\Common\vtkDataArray.cxx on Line 73<BR>
<BR>
const char* vtkDataArray::GetName()<BR>
{<BR>
return this->Name;<BR>
}<BR>
<BR>
when I try to execute return sttement, I get the error message<BR>
"Unhandled exception in main.exe: 0x000005 access violation"<BR>
So, I presume this is the place where problem occurs.But, I couldnt work out what the problem is.Can anybody help me what the problem can be.<BR>
<BR>
<BR>
This is a simple form of my code :<BR>
<BR>
//reading in<BR>
<BR>
vtkXMLPolyDataReader *reader1 = vtkXMLPolyDataReader::New();<BR>
reader1->SetFileName("conemodel.vtp");<BR>
vtkPolyData *data =reader1->GetOutput();<BR>
<BR>
<BR>
<BR>
vtkPoints* pointSet = vtkPoints->New();<BR>
<BR>
<BR>
// loaded all the point-data of data<BR>
vtkPoints * pointSet = vtkPoints::New();<BR>
<BR>
double pointDouble[3];<BR>
float pointfloat[3];<BR>
<BR>
//Load pointSet from polydata <BR>
for ( i =0; i< (data->GetNumberOfPoints());i++)<BR>
{<BR>
<BR>
<BR>
data->GetPoint(i,pointDouble);<BR>
<BR>
<BR>
pointFloat[0]=pointDouble[0];// Note: In the source code available on vtk website, vtkPolyData::GetPoint()takes double <BR>
//as argument while vtkPoints::InsertPoint() takes float as argument<BR>
pointFloat[1]=pointDouble[1];<BR>
pointFloat[2]=pointDouble[2];<BR>
<BR>
pointSet->InsertPoint(i,pointFloat);<BR>
<BR>
}<BR>
<BR>
// processing <BR>
<BR>
<BR>
for loop<BR>
{<BR>
replacePoint(newPoint,OldPoint,pointSet);// user defined function, using vtkPoints::setPoints()<BR>
data->SetPoints(pointSet);<BR>
}<BR>
<BR>
//writing<BR>
<BR>
vtkXMLPolyDataWriter *writer = vtkXMLPolyDataWriter::New();<BR>
writer->SetInput(data);<BR>
writer1->SetDataModeToAscii();<BR>
writer1->SetFileName("result.vtp");<BR>
writer1->Write(); ===============================>here the problem occurs<BR>
<BR>
<BR>
<BR>
Any thoughts, I am desperately stuck at this point.Any help will be appreciated a lot<BR>
<BR>
Best Regards,<BR>
<BR>
M.Salman<BR>
University of Surrey,U.K.<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>