[vtkusers] deleting a face from polydata

Mathieu Malaterre mathieu.malaterre at kitware.com
Fri Apr 9 09:36:07 EDT 2004


John,

	I did something similar last year using a vtkBoxWidget and a 
vtkImplicitSelectionLoop (and then vtkExtractPolyData...)

	Have a look at:

Examples/GUI/Python/BoxWidget.py

	And instead of coloring, just remove cell.

HTH
Mathieu

John Hunter wrote:
>>>>>>"Goodwin" == Goodwin Lawlor <goodwin.lawlor at ucd.ie> writes:
> 
> 
>     Goodwin> Hi John, vtkPolyData::DeleteCell just marks a cells as a
>     Goodwin> VTK_EMPTY_CELL type...  It doesn't actually delete it
>     Goodwin> from the dataset.
> 
>     Goodwin> I have a class and tcl example that does what you
>     Goodwin> want. You can get the source code here:
>     Goodwin> http://www.bioengineering-research.com/vtk/vtkRemoveCellsFilter.htm
> 
> Next problem:
> 
> For real data, as opposed to the toy sphere examples, the individual
> triangle cells that make up my surface are so small and numerous that
> I'll be clicking for 2 years before I can get rid of all the ones I
> need.  I would like to create a spherical brush to get all the cells
> within a region of specified radius from the selected point, and then
> remove these cells using your code.  
> 
> I am using a vtkExtractPolyDataGeometry filter with a vtkSphere
> implicit function.  My question is: can I get the cell ids from the
> output of this filter to pass to your code?  
> 
> My picker looks like this, with some pseudo-code at the end
> 
> def pick_cell(renwinInteractor, event):
> 
>     x, y = renwinInteractor.GetEventPosition()
> 
>     picker = vtk.vtkCellPicker()
>     picker.PickFromListOn()
>     picker.AddPickList(actor)
>     picker.SetTolerance(0.01)
>     picker.Pick(x, y, 0, renderer)
> 
>     points = picker.GetPickedPositions()
>     numPoints = points.GetNumberOfPoints()
>     if numPoints<1: return
>     pnt = points.GetPoint(0)
>     #mark(*pnt)
>     implicit = vtk.vtkSphere()
>     implicit.SetCenter(pnt)
>     implicit.SetRadius(2)
> 
>     extract = vtk.vtkExtractPolyDataGeometry()
>     extract.SetImplicitFunction(implicit)
>     extract.ExtractInsideOn()
>     extract.SetInput(sphere.GetOutput())
>     extract.ExtractBoundaryCellsOn()
>     extract.Update()
> 
>     polyData = extract.GetOutput()
> 
>     # here is the pseudo code
>     for cellIds in polyData.GetCellIds():
>         remove.RemoveCell(cellId)
> 
> Is this possible?  Is there a better way to remove the cells inside
> the implicit sphere that doesn't require vtkRemoveCellsFilter?
> 
> Thanks, 
> John Hunter
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 






More information about the vtkusers mailing list