[Paraview] Defining edge in Paraview

Ankush Aggarwal ankush at ices.utexas.edu
Tue Jul 31 17:48:48 EDT 2012


 I found this nice programmable filter from site 
 http://paraview.org/Wiki/Here_are_some_more_examples_of_simple_ParaView_3_python_filters.#Producing_Data_with_Timesteps_.28Source.29

 # Get the two inputs
 A = self.GetInputDataObject(0, 1)
 B = self.GetInputDataObject(0, 0)
 
 # Construct a point locator containing A's points
 locator = vtk.vtkPointLocator()
 locator.InitPointInsertion(vtk.vtkPoints(), A.GetBounds())
 for i in xrange(A.GetNumberOfPoints()):
     locator.InsertNextPoint(A.GetPoints().GetPoint(i))
 
 # Create an array to store the labels
 labels = vtk.vtkUnsignedCharArray()
 labels.SetName("common points")
 labels.SetNumberOfTuples(B.GetNumberOfPoints())
 
 # Label the points in B that are also in A
 for i in xrange(B.GetNumberOfPoints()):
     point = B.GetPoints().GetPoint(i)
     if locator.IsInsertedPoint(point) != -1:
         labels.SetValue(i, 1)
     else:
         labels.SetValue(i, 0)
 
 # Initialize the output and add the labels array
 output = self.GetOutput()
 output.ShallowCopy(B)
 output.GetPointData().AddArray(labels)

 It works for me! :D

 On Wed, 25 Jul 2012 17:13:29 -0500, Ankush Aggarwal 
 <ankush at ices.utexas.edu> wrote:
> Hi all,
>
> Lets say I have a surface polygonal (triangular) mesh. I want to add
> to it a point data saying 1 if the point is on the edge and 0
> otherwise. Is it possible to do in Paraview?
>
> I know I can feature the edges and I get a separate object with
> (fewer) edge nodes and line elements connecting them. But I can't use
> that directly in my code.
>
> Thanks in advance!
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list