<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Try to add this after Delaunay3D:<br>
<br>
</p>
<div> vtkGeometryFilter* geom = vtkGeometryFilter::New();<br>
geom->SetInputData(delaunay3DAlpha->GetOutput());<br>
geom->Update();</div>
<br>
<p></p>
<span>writer->SetInputData(geom->GetOutput());</span><br>
<br>
<p>Moreover: </p>
<pre>#include <vtkUnstructuredGrid.h></pre>
<br>
<p></p>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>Von:</b> Kailu Shan <kailushan@163.com><br>
<b>Gesendet:</b> Dienstag, 17. Jänner 2017 12:08<br>
<b>An:</b> M. Jordan<br>
<b>Cc:</b> vtkusers@vtk.org<br>
<b>Betreff:</b> Re:AW: [vtkusers] How to write vtkDelaunay3D into .vtk file</font>
<div> </div>
</div>
<div>hi, <br>
Thanks for your reply!<br>
which version are you using? I am using vtk 5.10 and also test with vtk 6.1.<br>
Below is my revised code:<br>
<br>
vtkSmartPointer<vtkDataWriter> writer=<br>
vtkSmartPointer<vtkDataWriter>::New();<br>
writer->SetFileName("delaunay3.vtk");<br>
writer->SetInputData(delaunay->GetOutput());<br>
writer->Write();<br>
<br>
error C2664: 'void vtkWriter::SetInputData(vtkDataObject *)' : cannot convert parameter 1 from 'vtkUnstructuredGrid *' to 'vtkDataObject *'<br>
<br>
在 2017-01-17 17:32:38,"M. Jordan" <mjordan@live.at> 写道:<br>
<blockquote id="isReplyContent" style="padding-left:1ex; margin:0px 0px 0px 0.8ex; border-left:#ccc 1px solid">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi,<br>
<br>
I use this code for it.<br>
(the extract surface/smooth part is optional)<br>
<br>
</p>
<div>// clean the polydata<br>
vtkSmartPointer<vtkCleanPolyData> cleanPolyData =<br>
vtkSmartPointer<vtkCleanPolyData>::New();<br>
cleanPolyData->SetInputConnection(INPUT->GetOutputPort());<br>
cleanPolyData->Update();<br>
// use delaunay3D<br>
vtkSmartPointer<vtkDelaunay3D> delaunay3DAlpha =<br>
vtkSmartPointer<vtkDelaunay3D>::New();<br>
delaunay3DAlpha->SetInputData(cleanPolyData->GetOutput());<br>
//delaunay3DAlpha->SetTolerance(0.0001);<br>
<span>//</span>delaunay3DAlpha->SetAlpha(20); <br>
<span>//</span>delaunay3DAlpha->SetAlphaLines(0);<br>
<span>//</span>delaunay3DAlpha->SetAlphaTris(0);<br>
<span>//</span> delaunay3DAlpha->SetAlphaTets(1);<br>
<span>//</span>delaunay3DAlpha->SetAlphaVerts(0);<br>
<span>//</span>delaunay3DAlpha->SetBoundingTriangulation(0); <br>
delaunay3DAlpha->Update();<br>
// extract surface<br>
vtkGeometryFilter* geom = vtkGeometryFilter::New();<br>
geom->SetInputData(delaunay3DAlpha->GetOutput());<br>
geom->Update();<br>
// smooth<br>
vtkSmoothPolyDataFilter* smooth22 = vtkSmoothPolyDataFilter::New();<br>
smooth22->SetInputConnection(geom->GetOutputPort());<br>
smooth22->SetNumberOfIterations(15);<br>
smooth22->SetRelaxationFactor(0.3);<br>
smooth22->Update();<br>
// write output file<br>
vtkSmartPointer<vtkPolyDataWriter> writer =<br>
vtkSmartPointer<vtkPolyDataWriter>::New();<br>
writer->SetInputData(smooth22->GetOutput());<br>
writer->SetFileName(PATH + FILENAME.vtk);<br>
writer->Write(); </div>
<br>
<p></p>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>Von:</b> vtkusers <<a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>> im Auftrag von Kailu Shan <<a href="mailto:kailushan@163.com">kailushan@163.com</a>><br>
<b>Gesendet:</b> Dienstag, 17. Jänner 2017 10:05<br>
<b>An:</b> VTK Users<br>
<b>Betreff:</b> [vtkusers] How to write vtkDelaunay3D into .vtk file</font>
<div> </div>
</div>
<div>
<div style="line-height:1.7; color:#000000; font-size:14px; font-family:Arial">
<div>How to write the vtkDelaunay3D data into .vtk file?</div>
<div>Thanks!</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>