<div dir="ltr">Hello, that worked as a charm, thank you very much for your time!!</div><div class="gmail_extra"><br><div class="gmail_quote">On 29 September 2017 at 11:31, kenichiro yoshimi <span dir="ltr"><<a href="mailto:rccm.kyoshimi@gmail.com" target="_blank">rccm.kyoshimi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Fernando,<br>
<br>
This will be accomplished by using vtkCleanUnstructuredGrid class<br>
found in ParaView without triangulation. I have attached a simple<br>
code.<br>
<br>
Thanks<br>
<div class="HOEnZb"><div class="h5"><br>
2017-09-29 16:37 GMT+09:00 Fernando Nellmeldin<br>
<<a href="mailto:f.nellmeldin@open-engineering.com">f.nellmeldin@open-<wbr>engineering.com</a>>:<br>
> Hello. That did the job! (although I get a triangle mesh while the initial<br>
> surface was full of sliced hexahedron (quads).<br>
><br>
> Thank you!<br>
><br>
> On 29 September 2017 at 04:05, kenichiro yoshimi <<a href="mailto:rccm.kyoshimi@gmail.com">rccm.kyoshimi@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> Using vtkDataSetTriangleFilter is a simple way which allows you to<br>
>> convert polyData to unstructuredGrid. Something like this (VTK-8.0.0):<br>
>> ---<br>
>>   // Create cutter<br>
>>   vtkSmartPointer<vtkCutter> cutter =<br>
>>     vtkSmartPointer<vtkCutter>::<wbr>New();<br>
>>   cutter->SetCutFunction(plane);<br>
>>   cutter->SetInputConnection(<wbr>model->GetOutputPort());<br>
>><br>
>>   // Convert polyData to unstructuredGrid<br>
>>   vtkSmartPointer<<wbr>vtkDataSetTriangleFilter> triFilter =<br>
>>     vtkSmartPointer<<wbr>vtkDataSetTriangleFilter>::<wbr>New();<br>
>>   triFilter->SetInputConnection(<wbr>cutter->GetOutputPort());<br>
>>   triFilter->Update();<br>
>><br>
>>   vtkSmartPointer<<wbr>vtkXMLUnstructuredGridWriter> writer =<br>
>>     vtkSmartPointer<<wbr>vtkXMLUnstructuredGridWriter>:<wbr>:New();<br>
>>   writer->SetFileName("<wbr>unstructuredGrid.vtu");<br>
>>   writer->SetInputConnection(<wbr>triFilter->GetOutputPort());<br>
>>   writer->Write();<br>
>> ---<br>
>><br>
>> Regards<br>
>><br>
>> 2017-09-28 23:43 GMT+09:00 Fernando Nellmeldin<br>
>> <<a href="mailto:f.nellmeldin@open-engineering.com">f.nellmeldin@open-<wbr>engineering.com</a>>:<br>
>> > Hello.<br>
>> > I have a method to cut a volume in a vtkUnstructuredGrid given a<br>
>> > vtkPlane.<br>
>> > I'm using vtkTableBasedClipDataSet to extract half of the model, also as<br>
>> > vtkUnstructuredGrid. This is working.<br>
>> ><br>
>> > Now, I would like to obtain ONLY the surface of the cut, than means: I<br>
>> > want<br>
>> > a vtkUnstructuredGrid with the nodes and faces being on the surface of<br>
>> > the<br>
>> > cut.<br>
>> > How can this be achieved?<br>
>> ><br>
>> > I tried using vtkCutter with vtkStripper but the mesh I get doesn't have<br>
>> > any<br>
>> > cells, only the points and their associated data.<br>
>> ><br>
>> > Here's how my code looks like.<br>
>> ><br>
>> > Thank You!<br>
>> ><br>
>> > vtkSmartPointer<<wbr>vtkUnstructuredGrid> model =<br>
>> > vtkSmartPointer<<wbr>vtkUnstructuredGrid>::New();<br>
>> > // fill the ugrid ...<br>
>> ><br>
>> > // Create The Plane to cut<br>
>> > vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::<wbr>New();<br>
>> > plane->SetOrigin(0.0, 0.0, 0.0);<br>
>> > plane->SetNormal(1.0, 0, 0);<br>
>> ><br>
>> > // Code to cut the model in half<br>
>> > vtkSmartPointer<<wbr>vtkTableBasedClipDataSet> clipDataSet =<br>
>> > vtkSmartPointer<<wbr>vtkTableBasedClipDataSet>::<wbr>New();<br>
>> > clipDataSet->SetClipFunction(<wbr>plane);<br>
>> > clipDataSet->InsideOutOn();<br>
>> > clipDataSet-><wbr>GenerateClippedOutputOn();<br>
>> > clipDataSet-><wbr>SetInputConnection(model-><wbr>GetProducerPort());<br>
>> > clipDataSet->Update();<br>
>> ><br>
>> > // This has half the model, this is Ok but not what I want<br>
>> > vtkSmartPointer<<wbr>vtkUnstructuredGrid> halfModel =<br>
>> > clipDataSet->GetOutput();<br>
>> ><br>
>> > ////****////<br>
>> > // BEGINS code not working to extract the surface of the cut<br>
>> > vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::<wbr>New();<br>
>> > cutter->SetCutFunction(plane);<br>
>> > cutter->SetInputConnection(<wbr>model->GetProducerPort());<br>
>> > cutter->Update();<br>
>> ><br>
>> > vtkSmartPointer<vtkStripper> stripper =<br>
>> > vtkSmartPointer<vtkStripper>::<wbr>New();<br>
>> > stripper->SetInputConnection(<wbr>cutter->GetOutputPort());<br>
>> > stripper->Update();<br>
>> ><br>
>> > vtkSmartPointer<vtkPolyData> pd = vtkSmartPointer<vtkPolyData>::<wbr>New();<br>
>> > pd->SetPoints(stripper-><wbr>GetOutput()->GetPoints());<br>
>> > pd->SetPolys(stripper-><wbr>GetOutput()->GetLines());<br>
>> ><br>
>> > vtkSmartPointer<<wbr>vtkUnstructuredGrid> clipped =<br>
>> > vtkSmartPointer<<wbr>vtkUnstructuredGrid>::New();<br>
>> > clipped->ShallowCopy(pd);<br>
>> ><br>
>> > // Here I see that there is no Cells<br>
>> > clipped->Print(std::cout);<br>
>> ><br>
>> > // ENDS code to extract the surface of the cut<br>
>> > ////****////<br>
>> ><br>
>> > // Write the unstructured grid<br>
>> > vtkSmartPointer<<wbr>vtkXMLUnstructuredGridWriter> writer =<br>
>> > vtkSmartPointer<<wbr>vtkXMLUnstructuredGridWriter>:<wbr>:New();<br>
>> > writer->SetFileName("d:/<wbr>unstructuredGrid.vtu");<br>
>> > writer->SetInput(clipped);<br>
>> > writer->SetDataModeToAscii();<br>
>> > writer->Write();<br>
>> > // file doesnt have any cell, only points and pointdata<br>
>> ><br>
>> > ______________________________<wbr>_________________<br>
>> > Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>> ><br>
>> > Visit other Kitware open-source projects at<br>
>> > <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>> ><br>
>> > Please keep messages on-topic and check the VTK FAQ at:<br>
>> > <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
>> ><br>
>> > Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
>> ><br>
>> > Follow this link to subscribe/unsubscribe:<br>
>> > <a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
>> ><br>
><br>
><br>
><br>
><br>
> --<br>
> Fernando NELLMELDIN<br>
> Software Engineer<br>
> ______________________________<wbr>______________________________<wbr>___<br>
><br>
> Open Engineering s.a.<br>
><br>
> Rue Bois Saint-Jean 15/1<br>
> B-4102 Seraing (Belgium)<br>
> Tel: +32.4.353.30.34<br>
><br>
> <a href="http://www.open-engineering.com" rel="noreferrer" target="_blank">http://www.open-engineering.<wbr>com</a><br>
> <a href="https://www.linkedin.com/company/open-engineering?trk=biz-companies-cym" rel="noreferrer" target="_blank">https://www.linkedin.com/<wbr>company/open-engineering?trk=<wbr>biz-companies-cym</a><br>
> ______________________________<wbr>______________________________<wbr>_____________<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><b>Fernando NELLMELDIN</b><br>Software Engineer<div style="font-size:12.8px"><b style="font-size:12.8px"><font color="#cc0000">_______________________________________________________________</font></b><br></div><div><div style="font-size:12.8px"><b style="font-size:12.8px"><font color="#000000"><br></font></b></div><div style="font-size:12.8px"><b style="font-size:12.8px"><font color="#000000">O</font><font color="#cc0000">pen E</font><font color="#000000">ngineering s.a.</font></b><br></div><div style="font-size:12.8px"><font color="#000000"><br></font></div><div style="font-size:12.8px"><font color="#000000">Rue Bois Saint-Jean 15/1</font></div><div style="font-size:12.8px"><font color="#000000">B-4102 Seraing (Belgium)</font></div><div><font color="#000000" style="font-size:12.8px">Tel: </font>+32.4.353.30.34 </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><a href="http://www.open-engineering.com/" style="color:rgb(17,85,204)" target="_blank">http://www.open-engineering.com</a></div><div style="font-size:12.8px"><a href="https://www.linkedin.com/company/open-engineering?trk=biz-companies-cym" style="color:rgb(17,85,204)" target="_blank">https://www.linkedin.com/company/open-engineering?trk=biz-companies-cym</a><br></div><div style="font-size:12.8px"><b><font color="#cc0000"><span style="font-family:'arial black',sans-serif;font-size:12.8px">_________________________________________________________________________<br></span></font></b></div></div></div></div></div></div></div>
</div>