<div dir="ltr"><div>Hi, </div><div><br></div><div>I need to convert vtkActor to vtkPolyData and save as stl file.</div><div><br></div><div>I followed ReverseAccess example from VTK wiki </div><div><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ReverseAccess">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ReverseAccess</a></div>
<div>Unfortunately  it does not work in this case.</div><div><br></div><div>I am trying with following code :</div><div>I don't know exactly about SafeDownCast </div><div>It seems to be that I am doing something wrong in SafeDownCast  .. </div>
<div><br></div><div>.....</div><div><span class="" style="white-space:pre">       </span>   actorLower = vtkSmartPointer<vtkActor>::New();</div><div><span class="" style="white-space:pre">    </span>   actorUpper = vtkSmartPointer<vtkActor>::New();</div>
<div><br></div><div><b><font color="#ff0000"><span class="" style="white-space:pre">    </span>  vtkSmartPointer<vtkAlgorithm> algoSafeLower = actorLower->GetMapper()->GetInputConnection(0, 0)->GetProducer();</font></b></div>
<div><b><font color="#ff0000"><span class="" style="white-space:pre">     </span>   refLower = vtkPolyData::SafeDownCast(algoSafeLower));</font></b></div><div><br></div><div><b><font color="#ff0000">vtkSmartPointer<vtkAlgorithm> algoSafeUpper = actorUpper->GetMapper()->GetInputConnection(0, 0)->GetProducer();</font></b></div>
<div><b><font color="#ff0000"><span class="" style="white-space:pre">     </span>   refUpper = vtkPolyData::SafeDownCast(algoSafeUpper);</font></b></div><div><br></div><div><span class="" style="white-space:pre">    </span>   safeAppendFilter = vtkSmartPointer<vtkAppendPolyData>::New();</div>
<div><span class="" style="white-space:pre">    </span>   safeAppendFilter->AddInput(refUpper);</div><div><span class="" style="white-space:pre">        </span>   safeAppendFilter->AddInput(refLower);</div><div><span class="" style="white-space:pre">        </span>   safeAppendFilter->Update();</div>
<div><br></div><div><span class="" style="white-space:pre">   </span>   stlWriter = vtkSmartPointer<vtkSTLWriter>::New();</div><div><span class="" style="white-space:pre"> </span>   stlWriter->SetFileName("output_file.stl");</div>
<div><span class="" style="white-space:pre">    </span>   stlWriter->SetInputConnection(safeAppendFilter->GetOutputPort());</div><div><span class="" style="white-space:pre"> </span>   stlWriter->Write();</div><div><br>
</div><div>I would appreciate for any help please. </div><div><br></div><div>agatte</div></div>