
Start small & build it up gradually until you have what you need.īut, if you have questions, please let me have them – they’ll help shape a follow-up issue. If automating ParaView is new to you, then you should have enough here to give it a try. This has ended up much longer than I intended & I’ve barely scratched the surface 🤔 They’re not as easy to read as a script (they’re in XML format) but a bit of syntax highlighting & some cmd/ctrl-f searching & you’ll find what you need.

pvsm) can be a treasure trove of settings for things like camera positions, lookup tables, etc that come in handy when building a Python script. Your mileage may vary, especially if you’re creating complex scenes, in which case the state file may be your best bet. I find the scripts are easier to read, understand & extend. My personal preference is to assemble the scene using the Python functions, but my scenes are pretty simple. You can create this little script using Trace of course 👍

pvsm) to save your GUI sessions – handy for jumping back in at a later date, perhaps with another dataset.įor your trickier scenes, you could save a state file & use a simple Python script to read it in & write out your images, animations, or whatever you need. You’re probably already using state files (. In that case you might want to make use of state files. But it can still take a while to assemble really complex scenes. The “Trace & Docs” combo will get you almost anywhere, even as a Python noob.
Paraview scripting plus#
Plus you get a description of what they all do (it’s the same text that pops up as a tooltip in the GUI). You might find this list of commands particularly handy, it includes all of the available readers, writers, sources, filters & animation cues – more than you’ll ever need.įor each one, you get the names of the various parameters for that command, really useful when the parameter name is slightly different to the one used in the GUI. Trace is awesome – but once you start to get more comfortable with using Python commands, the API documentation starts to come into it’s own. Trace can also be a useful way to surface additional commands to extend your basic scripts (as opposed to starting from scratch every time). I like to remove any mis-steps or intermediate renders to speed things up a bit & add a few variables to make it easier to tweak.

You can use the output as-is, or tweak it as you see fit (especially as your Python skillz improve). Voilà – a Python script to automate your post-processing, without needing any real Python knowledge – super-useful. When you’re done, click Tools > Stop Trace & up pops a “trace” of all the Python commands needed to repeat your steps. Open ParaView, click Tools > Start Trace (accept the defaults) and then do whatever you need to do in the GUI. If you’re the same, fear not, we have a secret weapon – Trace.
Paraview scripting Patch#
I can just about patch something together, but I’m no Pythonista. My Python skillz are almost non-existent. Good for prototyping and debugging scripts that then go into pvbatch.īack to the questions – how do I write a Python script to do my post-pro, especially if I’m not familiar with Python? Trace If you want to use the Python API directly in a terminal (rather than using a script) then this is a great tool.

pvpython – the interactive version of the above.Feed it your Python script & let it get on with it pvbatch – the ParaView script runner, great for unattended post-pro (especially if you’re using headless ParaView ).In case you didn’t know, pretty much everything you do in the ParaView GUI can be done in a Python script using their Python API.Īnd whilst you can use Python scripts in GUI ParaView, they really come into their own with a couple of other ParaView tools: I’ll take a stab at some simple answers to these questions, but first let’s take a moment for Python 🙏 Python for the win How do I “write a Python script to do my post-pro” ?.“write a Python script to do your post-pro & run it in batch”Īnd whilst that might be enough for some of you, for others it poses a few questions, like: The one sentence version of this email could be… It’s Robin from CFD Engine & I’m still chasing triangles 🙈īut let’s not talk about that, let’s talk about scripting your post-processing in ParaView and how you might get started instead.
