[vtk-developers] Extracting cells based on type

David E DeMarle dave.demarle at kitware.com
Tue Oct 2 11:28:38 EDT 2012


I've used this python programmable filter in paraview before which simply copies
each cell's type to a new cell associated integer array.

od = self.GetOutput()
od.ShallowCopy(self.GetInput())
cta = vtk.vtkIntArray()
cta.SetName("cell types")
cta.SetNumberOfComponents(1)
cta.SetNumberOfTuples(od.GetNumberOfCells())
od.GetCellData().AddArray(cta)
for x in xrange(0,od.GetNumberOfCells()):
  cta.SetValue(x,od.GetCell(x).GetCellType())

After that use either threshold to extract one contiguous range of
cell types, or selection by thresholds to extract any number of
ranges.

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Tue, Oct 2, 2012 at 10:05 AM, Andy Bauer <andy.bauer at kitware.com> wrote:
> When I've tried to do this in ParaView I've used the Mesh Quality filter
> along with the Threshold filter. I've had somewhat limited success with that
> though.
>
>
> On Tue, Oct 2, 2012 at 10:03 AM, Robert Michael O'Bara
> <bob.obara at kitware.com> wrote:
>>
>> Hi All,
>>
>> Does anyone know if there is a filter that can extract cells based on cell
>> type?  I have an unstructured grid that is composed of both surface and
>> volumetric cells and I have a writer that assumes that the mesh consists of
>> only volumetric cells.
>>
>> Thanks in advance for your time and help!
>>
>> Bob
>>
>> Robert M. O'Bara, MEng.
>> Technical Leader
>>
>> Kitware Inc.
>> 28 Corporate Drive
>> Suite 101
>> Clifton Park, NY 12065
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>



More information about the vtk-developers mailing list