Hi,
I’m trying to cut a box out of a polygon and pass the clip area to a FeatureEdges filter, but what I’m doing doesn’t seem to work. Is it possible? and if so, how?
Here’s my (not working) code:
'python
from paraview.simple import *
import paraview.vtk as vtk
reference /usr/pack/paraview-3.14.1-gm/./paraview-3.14.1-linux-64bit/lib/paraview-3.14/site-packages/paraview/
Importing the vtk file
reader = OpenDataFile("./tm-mag-xyz_slice.vtk")
Show(reader)
SetDisplayProperties(Representation = “Surface”)
SetDisplayProperties(ColorArrayName = “scalars”)
SetDisplayProperties(LookupTable = MakeBlueToRedLT(-100, 1e10))
Render()
collecting shape’s bounds
(xmin, xmax, ymin, ymax, zmin, zmax) = reader.GetDataInformation().GetBounds()
selecting points inside the comb
clipArea = Clip(reader)
clipArea.ClipType = ‘Box’
clipArea.ClipType.Bounds = [xmin, xmax, ymin + 160.0, ymax - 160.0, zmin, zmax]
0 to keep inside, 1 to keep outside
clipArea.InsideOut = 0
clipArea.UpdatePipeline()
finding holes inside the polygon
featureEdges = FeatureEdges(clipArea)
selecting only the holes boundaries
featureEdges.BoundaryEdges = 1
featureEdges.FeatureEdges = 0
featureEdges.NonManifoldEdges = 0
featureEdges.UpdatePipeline()
connectivityFilter = Connectivity(featureEdges)
connectivityFilter.UpdatePipeline()
adding programmable filter to remove false CD channels
programmableFilter = ProgrammableFilter()
programmableFilter.Input = [reader, connectivityFilter]
progrFilterFile = open("./programmable_filter_holes.py")
programmableFilter.Script = progrFilterFile.read()
programmableFilter.UpdatePipeline()
w = CreateWriter("./modified_data.vtk")
w.UpdatePipeline()
’