<div dir="ltr"><span style="font-size:12.8px">Maximilian,</span><br><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I am confused why any arbitrary vtkPolyData object would be castable to "Mesh". It will only return non-null, if it's is indeed created as a Mesh. Is it? Where's the "<vtkPolyData object>" coming from?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Utkarsh</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 9, 2017 at 11:50 AM, Maximilian Weiherer <span dir="ltr"><<a href="mailto:weiherer.maximilian@gmx.de" target="_blank">weiherer.maximilian@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="DE" link="#0563C1" vlink="#954F72"><div class="m_3987841914009693506WordSection1"><p class="MsoNormal">Hi all, <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I defined my own mesh class (named <b>Mesh</b>) by inheriting from vtkPolyData. Now I am struggling with the SafeDownCast method in order to cast a vtkPolyData object into a <b>Mesh</b> object. Whenever I am applying a SafeDownCast to a vtkPolyData object, NULL is returned.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The <b>Mesh</b> class looks as follows:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">class</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> : </span><span style="font-size:9.5pt;font-family:Consolas;color:blue">public</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">vtkPolyData</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">{<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">  </span><span style="font-size:9.5pt;font-family:Consolas;color:blue">public</span><span style="font-size:9.5pt;font-family:Consolas;color:black">:<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">    </span><span style="font-size:9.5pt;font-family:Consolas;color:blue">static</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black">* New();<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">    </span><span style="font-size:9.5pt;font-family:Consolas;color:#6f008a">vtkTypeMacro</span><span style="font-size:9.5pt;font-family:Consolas;color:black">(</span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black">, </span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">vtkPolyData</span><span style="font-size:9.5pt;font-family:Consolas;color:black">);<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">    </span><span style="font-size:9.5pt;font-family:Consolas;color:blue">void</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> PrintSelf(</span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">ostream</span><span style="font-size:9.5pt;font-family:Consolas;color:black">& </span><span style="font-size:9.5pt;font-family:Consolas;color:gray">os</span><span style="font-size:9.5pt;font-family:Consolas;color:black">, </span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">vtkIndent</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span><span style="font-size:9.5pt;font-family:Consolas;color:gray">indent</span><span style="font-size:9.5pt;font-family:Consolas;color:black">);<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">  </span><span style="font-size:9.5pt;font-family:Consolas;color:blue">protected</span><span style="font-size:9.5pt;font-family:Consolas;color:black">:<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">    Mesh();<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">    ~Mesh();<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> <u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">  </span><span style="font-size:9.5pt;font-family:Consolas;color:blue">private</span><span style="font-size:9.5pt;font-family:Consolas;color:black">:<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">    Mesh(</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">const</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black">&); </span><span style="font-size:9.5pt;font-family:Consolas;color:green">// Not implemented.</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">    </span><span style="font-size:9.5pt;font-family:Consolas;color:blue">void</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span><span style="font-size:9.5pt;font-family:Consolas;color:teal">operator=</span><span style="font-size:9.5pt;font-family:Consolas;color:black">(</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">const</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black">&); </span><span style="font-size:9.5pt;font-family:Consolas;color:green">// Not implemented.</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> };<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="color:black">…and this is the cast that does not work properly:<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black">* mesh = </span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Mesh</span><span style="font-size:9.5pt;font-family:Consolas;color:black">::SafeDownCast(<<wbr>vtkPolyData object>); </span><span style="font-size:9.5pt;font-family:Consolas;color:green">// mesh always equals NULL<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:green"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="color:black">Any help would be appreciated. Thanks!<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"><u></u> <u></u></span></p><p class="MsoNormal">Best regards<u></u><u></u></p><p class="MsoNormal">Maximilian<u></u><u></u></p></div><div id="m_3987841914009693506DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br> <table style="border-top:1px solid #d3d4de">
        <tbody><tr>
      <td style="width:55px;padding-top:18px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width:46px;height:29px"></a></td>
                <td style="width:470px;padding-top:17px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virenfrei. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" style="color:#4453ea" target="_blank">www.avast.com</a>                </td>
        </tr>
</tbody></table>
<a href="#m_3987841914009693506_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></div><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>
<br></blockquote></div><br></div>