Hi,<br>
as the error message says, the vtkClipPolyData needs either a clip function<br>
or input scalars. Check if your data does have vtkPointData or vtkCellData.<br>
If not, you can generate one easily thanks to vtkGenerateIndexArray.<br>
<br>
If yes, you should share your data and minimal code to people that will be<br>
able to track the bug, if it is one.<br>
<br>
Hope that helps<br>
Jerome<br><br><br><div class="gmail_quote">2011/5/19 agerlach <span dir="ltr"><<a href="mailto:agerlach@gmail.com">agerlach@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
All, I have a problem that has been driving me nuts. I have an application<br>
that allows the user to select and load *.ply and *.obj files at<br>
vtkPolyData. The user can then use the vtkImageTracerWidget to circle<br>
regions on the 3D model and then compute the area of that region. This works<br>
fine when I load a *.ply file, but if I use an *.obj file of the same 3D<br>
scene I get the following errors:<br>
ERROR: In ..\..\..\..\VTK-GIT\Graphics\vtkClipPolyData.cxx, line 175<br>
vtkClipPolyData (00000000034E21E0): Cannot clip without clip function or<br>
input scalars<br>
<br>
ERROR: In ..\..\..\..\VTK-GIT\Graphics\vtkMassProperties.cxx, line 81<br>
vtkMassProperties (00000000034E5AB0): No data to measure...!<br>
<br>
I have my method for loading the model and for computing area attached<br>
below.<br>
This is driving me nuts. Is it a bug or am I missing something. I am open to<br>
any alternatives for calculating area of a user circled or highlighted<br>
region that may be better. Thanks.<br>
<br>
void vtkHelper::loadModel(QString fileLoc)<br>
{<br>
if(fileLoc.endsWith("ply"))<br>
{<br>
this->plyReader->SetFileName(fileLoc.toAscii());<br>
this->plyReader->Update();<br>
this->polyData = this->plyReader->GetOutput();<br>
}<br>
else if(fileLoc.endsWith("obj"))<br>
{<br>
this->objReader->SetFileName(fileLoc.toAscii());<br>
this->objReader->Update();<br>
this->polyData = this->objReader->GetOutput();<br>
<br>
}<br>
}<br>
<br>
double vtkHelper::calcSurfaceArea(vtkImageTracerWidget *trace)<br>
{<br>
vtkSmartPointer<vtkPolyData> tracePolyData =<br>
vtkSmartPointer<vtkPolyData>::New();<br>
trace->GetPath(tracePolyData);<br>
<br>
if(tracePolyData->GetNumberOfPoints() < 10)<br>
return -1;<br>
vtkSmartPointer<vtkSelectPolyData> loop =<br>
vtkSmartPointer<vtkSelectPolyData>::New();<br>
loop->SetInput(this->polyData);<br>
loop->SetLoop(tracePolyData->GetPoints());<br>
loop->SetSelectionModeToSmallestRegion();<br>
loop->Update();<br>
<br>
vtkSmartPointer<vtkClipPolyData> clip =<br>
vtkSmartPointer<vtkClipPolyData>::New();<br>
clip->SetInput(loop->GetOutput());<br>
clip->Update();<br>
<br>
vtkSmartPointer<vtkMassProperties> mass =<br>
vtkSmartPointer<vtkMassProperties>::New();<br>
mass->SetInput(clip->GetOutput());<br>
<br>
return mass->GetSurfaceArea();<br>
}<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Weird-vtkClipPolyData-error-when-using-an-obj-tp4408314p4408314.html" target="_blank">http://vtk.1045678.n5.nabble.com/Weird-vtkClipPolyData-error-when-using-an-obj-tp4408314p4408314.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br>