Hello,
Is there any way that I can generate a Macro from a State file?
Basically I want to repeat the same things that are saved in the state but to another .e file.
So it would be great if I can generate a Macro form the state file. Is there any easy way to do that?
Thanks!
mwestphal
(Mathieu Westphal (Kitware))
July 25, 2019, 6:58am
2
Save your state as a python state file by changing the extension when saving the state
Edit the beginning of your state file so that, instead of opening a file it applies on the current active source
Add it as a macro
Alternatively, you can use the “Tools -> Python Trace” mechanism.
Thank you for your response.
I have created a state file long time ago.
I want to reproduce what I did before, but the state file is already saved. Can I edit this generated file as a Macro or python script ?
mwestphal
(Mathieu Westphal (Kitware))
July 25, 2019, 7:23am
4
is it a .pvsm or a .py state file ?
mwestphal
(Mathieu Westphal (Kitware))
July 25, 2019, 7:27am
6
Ok, so you can do the following :
Open ParaView
File -> Load State -> your .pvsm file, Ok
File -> Save State -> pythonState.py, Ok
Edit -> Reset Session
File -> Load State -> pythonState.py, Ok
Check everything is allright
Edit -> Reset Session
Edit your pythonState.py with a text editor
remove your reader instanciation and recover the current active source instead
Macros -> Add new macros -> pythonState.py, Ok
A new macros should have been added
2 Likes
wascott
(Walter Alan Scott)
July 25, 2019, 5:02pm
7
Thanks Mathieu - excellent suggestion.
I have noticed over the years that .py state files aren’t as robust as .pvsm files. Please post any issues you have here in Discourse, or even better, on the gitlab bug tracker site.
Thanks, Alan
1 Like
yopology
(Yi-Min Huang)
October 19, 2019, 6:57pm
8
Hi,
I am following this with great interest. But I couldn’t figure out how to do this step:
remove your reader instanciation and recover the current active source instead
Could you please elaborate on this?
Many thanks,
Yi-Min
mwestphal
(Mathieu Westphal (Kitware))
October 21, 2019, 3:52am
9
in the python state file, there is a line like :
reader1 = XMLUnstructuredGridReader("/path/to/your/file")
replace it by :
reader1 = GetActiveSource()
2 Likes