[vtkusers] Weird vtkClipPolyData error when using an *.obj

Jérôme jerome.velut at gmail.com
Thu May 19 02:25:15 EDT 2011


Hi,
as the error message says, the vtkClipPolyData needs either a clip function
or input scalars. Check if your data does have vtkPointData or vtkCellData.
If not, you can generate one easily thanks to vtkGenerateIndexArray.

If yes, you should share your data and minimal code to people that will be
able to track the bug, if it is one.

Hope that helps
Jerome


2011/5/19 agerlach <agerlach at gmail.com>

> All, I have a problem that has been driving me nuts. I have an application
> that allows the user to select and load *.ply and *.obj files at
> vtkPolyData. The user can then use the vtkImageTracerWidget to circle
> regions on the 3D model and then compute the area of that region. This
> works
> fine when I load a *.ply file, but if I use an *.obj file of the same 3D
> scene I get the following errors:
> ERROR: In ..\..\..\..\VTK-GIT\Graphics\vtkClipPolyData.cxx, line 175
> vtkClipPolyData (00000000034E21E0): Cannot clip without clip function or
> input scalars
>
> ERROR: In ..\..\..\..\VTK-GIT\Graphics\vtkMassProperties.cxx, line 81
> vtkMassProperties (00000000034E5AB0): No data to measure...!
>
> I have my method for loading the model and for computing area attached
> below.
> This is driving me nuts. Is it a bug or am I missing something. I am open
> to
> any alternatives for calculating area of a user circled or highlighted
> region that may be better. Thanks.
>
> void vtkHelper::loadModel(QString fileLoc)
> {
>    if(fileLoc.endsWith("ply"))
>    {
>        this->plyReader->SetFileName(fileLoc.toAscii());
>        this->plyReader->Update();
>        this->polyData = this->plyReader->GetOutput();
>    }
>    else if(fileLoc.endsWith("obj"))
>    {
>        this->objReader->SetFileName(fileLoc.toAscii());
>        this->objReader->Update();
>        this->polyData = this->objReader->GetOutput();
>
>    }
> }
>
> double vtkHelper::calcSurfaceArea(vtkImageTracerWidget *trace)
> {
>    vtkSmartPointer<vtkPolyData> tracePolyData =
> vtkSmartPointer<vtkPolyData>::New();
>    trace->GetPath(tracePolyData);
>
>    if(tracePolyData->GetNumberOfPoints() < 10)
>        return -1;
>    vtkSmartPointer<vtkSelectPolyData> loop =
> vtkSmartPointer<vtkSelectPolyData>::New();
>    loop->SetInput(this->polyData);
>    loop->SetLoop(tracePolyData->GetPoints());
>    loop->SetSelectionModeToSmallestRegion();
>    loop->Update();
>
>    vtkSmartPointer<vtkClipPolyData> clip =
> vtkSmartPointer<vtkClipPolyData>::New();
>    clip->SetInput(loop->GetOutput());
>    clip->Update();
>
>    vtkSmartPointer<vtkMassProperties> mass =
> vtkSmartPointer<vtkMassProperties>::New();
>    mass->SetInput(clip->GetOutput());
>
>    return mass->GetSurfaceArea();
> }
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Weird-vtkClipPolyData-error-when-using-an-obj-tp4408314p4408314.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110519/34109786/attachment.htm>


More information about the vtkusers mailing list