<div dir="ltr"><div><div><div>Hello<br><br></div>For the cast to work, the object need to be of the right type. If the output is a vtkPolyData, it cannot be a vtkUnstructuredGrid.<br></div>Take a look at the polymorphism here.<br><br><a href="https://www.vtk.org/doc/nightly/html/classvtkDataSet.html">https://www.vtk.org/doc/nightly/html/classvtkDataSet.html</a><br><br></div>Best,<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Mathieu Westphal<br></div></div></div>
<br><div class="gmail_quote">On Thu, Nov 16, 2017 at 5:30 AM, landings <span dir="ltr"><<a href="mailto:landinghere@163.com" target="_blank">landinghere@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am writing a reader that outputs an unstructured solid mesh.<br>
<br>
I am referring to vtkSTLReader, in its RequestData() method I can see the<br>
following code:<br>
<br>
    vtkInformation *outInfo = outputVector-><wbr>GetInformationObject(0);<br>
    vtkPolyData *output =<br>
vtkPolyData::SafeDownCast(<wbr>outInfo->Get(vtkDataObject::<wbr>DATA_OBJECT()));<br>
<br>
But when I do similar things:<br>
<br>
    vtkInformation* outInfo = outputVector-><wbr>GetInformationObject(0);<br>
    vtkUnstructuredGrid *output =<br>
vtkUnstructuredGrid::<wbr>SafeDownCast(outInfo->Get(<wbr>vtkDataObject::DATA_OBJECT()))<wbr>;<br>
<br>
I get a nullptr for output. I am sure<br>
outInfo->Get(vtkDataObject::<wbr>DATA_OBJECT()) exists before downcasting.<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/VTK-Users-f1224199.html</a><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 <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: <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>
</blockquote></div><br></div>