[vtkusers] Help needed trying to use vtkTableBasedClipDataSet with a ImplicitFunction

Gustavo Longhin longhin at simworx.com.br
Wed Apr 19 09:03:09 EDT 2017


Hi folks,

I'm developing a pre-processor for a Finite Differences based 
geomechanics solver and I need to clip though my original mesh, but for 
mathematical reasons is desirable that all Hexas that weren't touched by 
the cutting surface remains untouched (not triangulated). That's why I'm 
using vtkPolyData pd = vtkPolyData.New();
vtkTableBasedClipDataSet 
<http://www.vtk.org/doc/nightly/html/classvtkTableBasedClipDataSet.html>. 
In my initial tests where I cut the mesh with a plane everything works fine.

Now I have a cloud of points, which I can triangulate with a delaunay2d 
to form the surface, and I wanted to use that surface as the Clipping 
Function, passing it via SetClipFunction(..).

My first option was to feed a vtkImplicitDataSet with the data from my 
delaunay2d but I keep receiving the error:
"In 
..\..\..\..\vtksource-prefix\src\vtksource\Filtering\vtkImplicitDataSet.cxx, 
line 76 vtkImplicitDataSet (0A17E848): Can't evaluate dataset!"
in vtkOututWindow.

I'm using C# and this is my code:
PS: points contains the cloud of points I'm reading from a DXF file and 
I've checked, points are ok, the surface is shown perfectly in the 
render window.
>                 vtkPolyData pd = vtkPolyData.New();
>                 pd.SetPoints(points.GetPoints());
>                 pd.Update();
>
>                 vtkDelaunay2D d2d = vtkDelaunay2D.New();
>                 d2d.SetInput(pd);
>
>                 vtkDataSetMapper ds = vtkDataSetMapper.New();
>                 ds.SetInput(d2d.GetOutput());
>
>
>                 vtkTableBasedClipDataSet clippeme = 
> vtkTableBasedClipDataSet.New();
>                 vtkDataSet mygrd = m_Mesh.GetMapper().GetInput();
>                 clippeme.SetInput(mygrd);// pdf.GetOutput());
>
>                 vtkImplicitDataSet func = vtkImplicitDataSet.New();
>                 func.SetDataSet(d2d.GetOutput());
>
>
>                 clippeme.SetClipFunction(func);
>                 clippeme.Update();
>                 clippeme.GenerateClippedOutputOn();
>
>                 vtkUnstructuredGrid pdcut = clippeme.GetOutput();// 
> vtkUnstructuredGrid.New();
>                 vtkDataSetMapper dscut = vtkDataSetMapper.New();
>                 dscut.SetInput(pdcut);
>                 vtkActor cuttedAc = vtkActor.New();
>                 cuttedAc.SetMapper(dscut);
>
>                 ds = null;
>
>                 vtkRenderer renderer = 
> m_VTK.RenderWindow.GetRenderers().GetFirstRenderer();
>
>                 renderer.AddViewProp(cuttedAc);
>                 renderer.ResetCamera();

Thanks in advance.
Gustavo.

-- 
Gustavo Longhin
+55(19) 99757 4509
+55(19) 3289 1800 ext 26
The First Offices
Rua Paulo Cezar Fidelis 39, Sala 306.
CEP: 13087-727 – Campinas – SP – Brasil



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170419/6bec20ba/attachment.html>


More information about the vtkusers mailing list