Skip to content

Instantly share code, notes, and snippets.

@bilke
Created September 28, 2015 12:15
Show Gist options
  • Select an option

  • Save bilke/fb774236504a58fbc4eb to your computer and use it in GitHub Desktop.

Select an option

Save bilke/fb774236504a58fbc4eb to your computer and use it in GitHub Desktop.
ParaView programmable filter to remove third component of texture coordinates
pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
numpts = pdi.GetNumberOfPoints()
pdata = pdi.GetPointData()
tcoords = pdata.GetTCoords()
newtcoords = vtk.vtkFloatArray()
newtcoords.SetName("textureCoords")
newtcoords.SetNumberOfComponents(2)
newtcoords.SetNumberOfTuples(numpts)
for i in range(0, numpts):
oldcoord = tcoords.GetTuple3(i)
newtcoords.SetTuple2(i, oldcoord[0], oldcoord[1])
pdo.GetPointData().SetTCoords(newtcoords)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment