<div dir="ltr"><div>Last time this came up to my knowledge was:</div><div><a href="http://markmail.org/thread/pbghkrm2zbubkj54">http://markmail.org/thread/pbghkrm2zbubkj54</a></div><span style="font-size:13px"><div><br></div>od = self.GetOutput()</span><br style="font-size:13px"><span style="font-size:13px">od.ShallowCopy(self.GetInput()</span><span style="font-size:13px">)</span><br style="font-size:13px"><span style="font-size:13px">cta = vtk.vtkIntArray()</span><br style="font-size:13px"><span style="font-size:13px">cta.SetName("</span><span style="font-size:13px">cell</span><span style="font-size:13px"> types")</span><br style="font-size:13px"><span style="font-size:13px">cta.SetNumberOfComponents(1)</span><br style="font-size:13px"><span style="font-size:13px">cta.SetNumberOfTuples(od.</span><span style="font-size:13px">GetNumberOfCells())</span><br style="font-size:13px"><span style="font-size:13px">od.GetCellData().AddArray(cta)</span><br style="font-size:13px"><span style="font-size:13px">for x in xrange(0,od.GetNumberOfCells()</span><span style="font-size:13px">):</span><br style="font-size:13px"><span style="font-size:13px"> cta.SetValue(x,od.GetCell(x).</span><span style="font-size:13px">GetCellType())</span><div><br></div><div><div><span style="font-size:13px">Which does what you originally suggested. </span>There are probably shorter incantations now in the numpy based python calculator.</div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">David E DeMarle<br>Kitware, Inc.<br>R&D Engineer<br>21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4909</div></div>
<br><div class="gmail_quote">On Wed, Dec 16, 2015 at 2:56 AM, Viktor Sip <span dir="ltr"><<a href="mailto:viktor.sip@centrum.cz" target="_blank">viktor.sip@centrum.cz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks for the helpful tips.<br>
First approach has the disadvantage that I need to specify the underlying points in each of the separate files, which leads again to some redundancy. But good to know.<br>
EnSight format looks promising though, I didn't know about it before.<br>
<br>
Thanks again,<br>
Viktor<br>
<br>
______________________________________________________________<br>
> Od: Samuel Key <<a href="mailto:samuelkey@bresnan.net">samuelkey@bresnan.net</a>><br>
> Komu: <<a href="mailto:paraview@paraview.org">paraview@paraview.org</a>><br>
> Datum: 15.12.2015 23:47<br>
> Předmět: Re: [Paraview] Filter cell type from PolyData VTK file<br>
<div><div class="h5">><br>
>Victor,<br>
><br>
><br>
><br>
>Off the top of my head, I can think of three different ways to do this:<br>
><br>
><br>
><br>
>(1) Put each cell-type in a separate *.vtp file. You can then load each cell-type separately or you can load them with a *.pvd meta-file (sample attached) as "one object" and use the Extract Block filter to display any number and combination of cell-types.<br>
><br>
><br>
><br>
>(2) You can use the EnSight format for your results. This format has a Part-construct that allows mixed-cell objects and that can be used to organize your cells any way you like, for example, by cell-type, by material, by sub-assemblies, ... Again, the Extract Block filter can be used to display any number and combination of 'Parts.'<br>
><br>
><br>
><br>
>(3) When you write the *.vtp file assign each cell its vtk-cell-type number as data, and then use the Threshold filter applied to the cell's cell-type value.<br>
><br>
><br>
><br>
>There are probably other ways as well.<br>
><br>
><br>
><br>
>Hope this helps.<br>
><br>
><br>
><br>
>Sam Key<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
>On 12/15/2015 2:54 PM, Viktor Sip wrote:<br>
><br>
><br>
><br>
>Dear all,<br>
><br>
><br>
><br>
>is there a way to filter and show only a specific cell type?<br>
><br>
><br>
><br>
>In my application I am exporting a PolyData VTK file containing some Polys and Lines. When imported into Paraview, both Polys and Lines are shown, and I did not find a simple way to show only Polys.<br>
><br>
>What I can do is to export additional CellData array with a number specifying cell type and then apply Treshold in Paraview. However that seems redundant, as the type is already stored in the file somewhere.<br>
><br>
>So my question is, is there a direct way?<br>
><br>
><br>
><br>
>Simplified example of the exported VTK file is attached.<br>
><br>
><br>
><br>
>Kind regards,<br>
><br>
>Viktor<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
>_______________________________________________ Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a> Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a> Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a> Follow this link to subscribe/unsubscribe: <a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
><br>
><br>
><br>
</div></div>>----------<br>
<div class="HOEnZb"><div class="h5">><br>
>_______________________________________________<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/opensource/opensource.html</a><br>
><br>
>Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
><br>
>Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
><br>
>Follow this link to subscribe/unsubscribe:<br>
><a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
_______________________________________________<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/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
</div></div></blockquote></div><br></div>