CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > ParaView

Slice origin as annotation in animation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 20, 2013, 04:47
Question Slice origin as annotation in animation
  #1
New Member
 
Pia Jensen
Join Date: Jul 2013
Location: Denmark
Posts: 3
Rep Power: 4
bozack is on a distinguished road
I am making an animation where I vary the origin of a slice through my gaussian cube data, and would like to have an annotation of what value the X-coordinate of the slice origin is, for each frame.

I have tried using the Python Annotation Filter, but I simply cannot figure out how to get to the slice origin value.

My first guess was something like
Code:
"Slice origin in X = %f" % (XSlicesOrigin[0])
but this does not work at all. How should I do it?
bozack is offline   Reply With Quote

Old   July 21, 2013, 12:07
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,488
Blog Entries: 34
Rep Power: 86
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings Pia and welcome to the forum!

How exactly are you varying the slice? Because it might be possible to generate the annotation directly in the code where you're doing the slice movement.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   July 21, 2013, 17:38
Default
  #3
New Member
 
Pia Jensen
Join Date: Jul 2013
Location: Denmark
Posts: 3
Rep Power: 4
bozack is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
How exactly are you varying the slice? Because it might be possible to generate the annotation directly in the code where you're doing the slice.
I'm working in the ParaView GUI (I didn't know that you could get to the code behind that?). I use the animation view and simply choose the slice in the dropdown menu, and afterwards the origin value, and interpolate its value along with the time in the animation.
bozack is offline   Reply With Quote

Old   August 12, 2013, 05:44
Default bump
  #4
New Member
 
Pia Jensen
Join Date: Jul 2013
Location: Denmark
Posts: 3
Rep Power: 4
bozack is on a distinguished road
I'm just bumping this thread again, in the hope that someone can help me?
bozack is offline   Reply With Quote

Old   August 16, 2013, 18:10
Default
  #5
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,488
Blog Entries: 34
Rep Power: 86
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi Pia,

Sorry, but I've been busy for the past few weeks and didn't manage to look into this until now.

And I've been playing around with ParaView 3.98.0 for the past 2 hours or so and the only solution I could manage to figure out was as follows:
  1. Prepare your post-processing case on ParaView 3.98.0 or newer, including an instance of the "Slice" filter and of the "Python Annotation" filter.
  2. Place the following code inside a python script file, e.g. "syncAnnotation.py":
    Code:
    try: paraview.simple
    except: from paraview.simple import *
    paraview.simple._DisableFirstRenderCameraReset()
    
    Slice1 = FindSource("Slice1")
    PythonAnnotation1 = FindSource("PythonAnnotation1")
    PythonAnnotation1.Expression = "'Slice origin in X = %f' % " + str(Slice1.SliceOffsetValues[0])
    
    Render()
    Adjust the names "Slice1" and "PythonAnnotation1" accordingly to your existing session. And also adapt the code for "PythonAnnotation1.Expression" to your liking; since it's based on your first post, it should be easy for you to understand what the code does.
  3. On the menu, click on "Macros -> Add New Macro" and select the file "syncAnnotation.py".
  4. You should now have this macro on the menu "Macros", as well as a button named "synAnnotation" on the Macros toolbar (on/off in the menu "View -> Toolbars -> Macros Toolbars").
  5. Now, whenever you change the time instance, use this macro and it will update the python annotation accordingly.
Here are some of the references I used:
What I've tried:
  1. Tried using a "programmable source" to run the contents of this script, but for some reason it won't reach the currently open session.
  2. Tried to use in the expression of the "Python Annotation" filter to use the following code:
    Code:
    paraview.servermanager.ProxyManager().GetProxy("sources", "Slice1").SliceOffsetValues[0]
    It's the absolute path to the following command:
    Code:
    FindSource("Slice1").SliceOffsetValues[0]
    But the first one fails for the same issue with not being able to connect to the session; and the second fails due to not having access to "paraview.simple" from these programmable filters and sources.
  3. Tried to write an XML proxy plugin, either source or filter, but the more I read the XML files, the more it looked like it would not work, due to how the proxies work. Perhaps I missed something, so here are the references for this idea:
  4. Due to the non-accessible session, I also tried to use a "programmable source" to open a new session, but the problem is that it would require a new session each time it changed the time snapshot... the code I had used was:
    Code:
    from paraview import servermanager
    
    servermanager.Connect('localhost',11111)
    servermanager.ProxyManager().GetProxy("sources", "Slice1").SliceOffsetValues[0]
    Although this required pvserver to have been executed first on another terminal. But this failed because only one session may be connected to a server, which leads to a crash the second time it tries to connect.
  5. Tried to use "--multi-clients" with pvserver, but it would lock up ParaView when I used the code from the attempt #4.


Best regards,
Bruno

Last edited by wyldckat; August 16, 2013 at 18:24. Reason: added attempt #4 and #5
wyldckat is offline   Reply With Quote

Reply

Tags
annotate, paraview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set periodic boundary conditions Ganesh FLUENT 13 January 22, 2014 05:11
ParaFoam: Slice Animation Nucleophobe OpenFOAM Post-Processing 2 August 5, 2012 16:51
Dragging Slice File = Crash cbritan OpenFOAM Bugs 3 January 6, 2011 04:58
Animation query..newbie qn derick FLUENT 2 December 9, 2005 10:45
Coordinate of axis origin Tang FLUENT 0 October 4, 2004 16:38


All times are GMT -4. The time now is 02:30.