Not able Run pvpython script (Request tips and tricks for paraview automate through pvpython )

Hello,

We planning to automate paraview operation through pvpython.(ex.slice,clip,structural analysis for various object,mechanical behavior of object for various parameters)

The thing is the above said operation are currently we are doing manually.which consume huge time.

The concern is,

1.working with paraview with trace enable condition ,The traces are logged.However again trying to run same trace through python shell the result is failure(not able to reproduce the same operation again…hope u understand)
2.We create one manual file (refer below ex.) and execute paraview command one by one it is respond and produce respective output .where as if we save the file.py and run the same in “Run script” through python shell,it wont reproduce the same output.

what we need exactly is,

How to run the pvpython through “Runscript” in pythonshell?
Have you any suggestion tips/trick for paraview automation using pvpython? if so pls share.

//////
cone=Cone()

Show()
<paraview.servermanager.GeometryRepresentation object at 0x00000158357FBFD0>

Render()
<paraview.servermanager.RenderView object at 0x0000015835699F28>

camera=GetActiveCamera()
camera.SetFocalPoint(0,0,0)
camera.SetPosition(0,0,-10)
camera.SetViewUp(0,1,0)

camera.Dolly(10)
Render()
<paraview.servermanager.RenderView object at 0x0000015835699F28>

camera.Dolly(.1)
Render()
<paraview.servermanager.RenderView object at 0x0000015835699F28>

camera=GetActiveCamera()
camera.SetFocalPoint(0,0,0)
camera.SetPosition(0,0,-10)
camera.SetViewUp(0,1,0)

camera.Roll(45)
Render()
<paraview.servermanager.RenderView object at 0x0000015835699F28>

camera=GetActiveCamera()
camera.SetFocalPoint(0,0,0)
camera.SetPosition(0,0,-10)
camera.SetViewUp(0,1,0)

camera.Yaw(45)
Render()
<paraview.servermanager.RenderView object at 0x0000015835699F28>

camera=GetActiveCamera()
camera.SetFocalPoint(0,0,0)
camera.SetPosition(0,0,-10)
camera.SetViewUp(0,1,0)

camera.Pitch(45)
Render()
<paraview.servermanager.RenderView object at 0x0000015835699F28>

camera=GetActiveCamera()
camera.SetFocalPoint(0,0,0)
camera.SetPosition(0,0,-10)
camera.SetViewUp(0,1,0)

camera.Azimuth(45)
Render()
<paraview.servermanager.RenderView object at 0x0000015835699F28>

camera.Roll(45)
Render()
<paraview.servermanager.RenderView object at 0x0000015835699F28>

camera.Elevation(45)
Render()
<paraview.servermanager.RenderView object at 0x0000015835699F28>

//////

Hello sankar,

not sure if you have a fix yet.

You can run any paraview script like this: pvpython yourscript.py (ubuntu, might be different with other OS)

This starts the paraview python shell which includes the paraview.simple module needed. You can simple use this line within bash scripts or else.

Tipps:
Tracing in paraview is great, but as far as i know not everything is traced properly yet. For example when I selected cells by mouse this was not traced. In the script I had to manually add a SelectCell command.
However you can watch the tracefile while it is beeing generated and check if everything you do is properly written down there. This although helps a lot with learning how to automate using pvpythion.

Regards,
Terry

Saving a state file as .py file will indeed create a Python script that you can rerun as is with pvpython.