hi how can i fix this problem
File “”, line 1, in
NameError: name ‘self’ is not defined
hi how can i fix this problem
File “”, line 1, in
NameError: name ‘self’ is not defined
please update your post with relevant information about your problem.
i try to execute this code :
from paraview.simple import *
from paraview import vtk
reader = OpenDataFile(’/home/ikram/Bureau/C0002.vtk’)
pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
pdo.Allocate()
for i in range(0, numPoints-1):
points = [i, i+1]
# VTK_LINE is 3
pdo.InsertNextCell(3, 2, points)
Show(reader)
but it bugs :
NameError: name ‘self’ is not defined
how can i fix it
from paraview.simple import *
from paraview import vtk
reader = OpenDataFile(’/home/ikram/Bureau/C0002.vtk’)
Show(reader)
This part if pvpython code.
pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
pdo.Allocate()
for i in range(0, numPoints-1):
points = [i, i+1]
# VTK_LINE is 3
pdo.InsertNextCell(3, 2, points)
This part is vtkPython, probably to put in a Programmable Filter. Are you trying to create lines between points ?
Looks like you are trying to put vtkPython code in pvpython or python shell. Is that the case ?
yes !
So use your code in a ProgrammableFilter instead.
how i do this ! sorry
but i already start using paraview !
pvpython is available in ParaView
View -> Python Shell
i found python shell in tools , and i did run script test.py , it contains
pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
pdo.Allocate()
for i in range(0, numPoints-1):
points = [i, i+1]
# VTK_LINE is 3
pdo.InsertNextCell(3, 2, points)
but it show me this
nameError: name ‘self’ is not defined
how can i fixe it
This code is for a programmable filter, not the python shell.
Filters -> ProgrammableFilter
ok
i think is not installed !
how can i fix it !
Download ParaView here:
https://www.paraview.org/download/
excuse me for my stupid question !
i download ParaView-5.7.0-RC1-osmesa-MPI-Linux-64bit.tar.gz
and i extracted it
after that , how i install it !
Just untar it somewhere and run paraview.
hi mathiew , i uninstall parview and reinstall it , and i have the same issue , no programmable filter !!
how can i fixe it please ?
actually i fixed it , but when i click on apply of the programmable filter, the paraview shutdown !
i need a solution please