#NEWLINE# def clipRange( dataObj , arrayName , thresholdRange ) : #NEWLINE# #INDENT# if ( not dataObj . GetPointData ( ) . GetArray ( arrayName ) ) : #NEWLINE# #INDENT# raise Exception ( ( 'clipRange: could not locate array: %s' % arrayName ) ) #NEWLINE# #UNINDENT# dataObj . GetPointData ( ) . SetScalars ( dataObj . GetPointData ( ) . GetArray ( arrayName ) ) #NEWLINE# f = vtk . vtkClipPolyData ( ) #NEWLINE# f . SetInput ( dataObj ) #NEWLINE# f . SetValue ( thresholdRange [ 0 ] ) #NEWLINE# f . SetInputArrayToProcess ( 0 , 0 , 0 , vtk . vtkDataObject . FIELD_ASSOCIATION_POINTS , arrayName ) #NEWLINE# f2 = vtk . vtkClipPolyData ( ) #NEWLINE# f2 . AddInputConnection ( f . GetOutputPort ( ) ) #NEWLINE# f2 . SetValue ( thresholdRange [ 1 ] ) #NEWLINE# f2 . InsideOutOn ( ) #NEWLINE# f2 . SetInputArrayToProcess ( 0 , 0 , 0 , vtk . vtkDataObject . FIELD_ASSOCIATION_POINTS , arrayName ) #NEWLINE# f2 . Update ( ) #NEWLINE# return shallowCopy ( f2 . GetOutput ( ) )