This question is similar to ParaView Python Script Editor but differs in that several of the editor buttons don’t change anything for me.
In particular I’d love to not be reliant on the copy/paste method for getting code into programmable sources from external files. The issue is that when I click this button nothing happens. Any tips would be greatly appreciated!
I’d also love to hear whether this is the preferred workflow for extensive use of files developed with an external editor, or if there’s another method that makes paraview watch for changes to a selected file or something.
Apologies for the delay! I think the workflow with 1. goes well, but my problems are with 2. I’m on a different machine right now with paraview 5.11 so I think the options under Scripts are slightly different. The issue appears to be the same though in that none of the buttons appear to cause anything to change. Is the idea that when I make a new tab and open a file there and then select Load script into current editor tab that my programmable script will suddenly get the text and I can hit apply?
Indeed, the option change name for a more clear one, but the workflow stays the same:
Create programmable filter
Click on the square button to open the python editor
Python editor pops up, tab is linked
in the Python Editor, Script → Load script into current editor tab → select your script
Edit if needed and save as script if needed
Close the python editor
Press Apply
However, this assume you already have a script in ParaView Scripts, if you want to load from a random .py file from your computer, it is a bit more involved (and definitely should be improved):
Create programmable filter
Click on the square button to open the python editor
Python editor pops up, tab is linked
File → Open → Select a file on your computer
File → SaveAsScript
File → CloseCurrentTab, swtich to the linked tab
in the linked tab, Script → Load script into current editor tab → select your script
I’m only going to make side mention of this here since we are talking about improvements.
I wrote a small script that I would launch in the paraview python shell that would start a thread and in the background every couple of seconds check for modifications made to a filename I was using as a script. If the changes were found it would get reference to the programmable source I added to the pipeline and it would use the file’s contents as the Script field. This worked but had a strange condition where in order for the thread’s execution to be noticed and effect changes I had to hit return in the python shell every once in a while. Any idea how I could get around that last bit of manual work?
I’ll post the code when I get to my work machine tomorrow.