[vtkusers] Iterative subdivision causes holes

sebastian_a seb.an at icloud.com
Thu Sep 28 16:35:13 EDT 2017


Hello again,

I found a great filter which subdivides till a certain face size:
vtkAdaptiveSubdivision.

But still it seem like the vtkAppendPolyData won't put the two extracted
PolyDatas together correctly and is causing holes on the common edges.

The thing is: If I don't subdivide the cells, vtkAppendPolyData isn't
causing holes. With any subdivision filter applied on the selected cells it
is.

So the workflow is: extract selected and unselected -> subdivide selected ->
append subdivided and unselected.

In the picture, the red cells have bin selected (cellIds) and then
subdivided. Also there are cut throughs from 3 angles. I tried to fill the
model, which caused errors as you see in the incomplete filling on the three
pictures.

<http://vtk.1045678.n5.nabble.com/file/t341915/ErrorHole.png> 


def extractCells(polydata, ids, inverse):
    selectionNode = vtk.vtkSelectionNode()
    selectionNode.SetFieldType(vtk.vtkSelectionNode.CELL)
    selectionNode.SetContentType(vtk.vtkSelectionNode.INDICES)
    selectionNode.SetSelectionList(ids)

    if inverse == True:
        selectionNode.GetProperties().Set(vtk.vtkSelectionNode.INVERSE(),1)
    else:
        selectionNode.GetProperties().Set(vtk.vtkSelectionNode.INVERSE(),0)

    selection = vtk.vtkSelection()
    selection.AddNode(selectionNode)

    extractSelection = vtk.vtkExtractSelection()
    extractSelection.SetInputData(0, polydata)
    extractSelection.SetInputData(1, selection)
    extractSelection.Update()

    geometryFilter = vtk.vtkGeometryFilter()
    geometryFilter.SetInputData(extractSelection.GetOutput())
    geometryFilter.Update()

    return geometryFilter.GetOutput()



selectedPolyData = extractCells(inputPolyData, cellIds, False)

# subdivide selected cells
ids = vtk.vtkIdFilter()
ids.SetInputData(largeFacePolyData)
adapt = vtk.vtkAdaptiveSubdivisionFilter()
adapt.SetInputConnection(ids.GetOutputPort())
adapt.SetMaximumEdgeLength(edgeLength)
adapt.SetMaximumTriangleArea(vtk.VTK_INT_MAX)
adapt.SetMaximumNumberOfPasses(vtk.VTK_INT_MAX)
adapt.Update()

unselectedPolyData = extractCells(inputPolyData, cellIds, True)

appendFilter = vtk.vtkAppendPolyData()
appendFilter.AddInputConnection(adapt.GetOutputPort())
appendFilter.AddInputData(unselectedPolyData)
appendFilter.Update()

outputPolyData = appendFilter.GetOutput()


Thank you for your help,
Sebastian



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list