Help needed trying to use vtkTableBasedClipDataSet with a ImplicitFunction

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help needed trying to use vtkTableBasedClipDataSet with a ImplicitFunction

Gustavo Longhin
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. 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

Virus-free. www.avast.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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Help needed trying to use vtkTableBasedClipDataSet with a ImplicitFunction

Raubtier
This post has NOT been accepted by the mailing list yet.
Hi Gustavo,

I meet the problem as you. Have you ever solved it? if yes, could you please show me the solution?

Thank you!

Neuer Yao