Variable from point query (scripting)
Hi- wondering if anyone can help me with a simple problem but couldn't find anything from a search. I'm using Ensight 9.2
I'm looking to save the result of a query on a cursor position as a variable in a python script. So what I'd like is to set:
pref = Value of pressure on part 1 at position (x,y,z)
Many thanks in advance.
Query Variable from Script
That is fairly straight forward to extract out of EnSight. The main python function you want to use is :
I've provided below a few other items in terms of setup and use of the xyz query. You may or may not need this additional information, but should provide further context for your inquiry. So, the following example I set the xyz location with the "xloc, yloc, zloc" variables, the variable name and part to query from. The next block is the creation of the query, while the final block is the extraction of the query variable, and do with it what I want.
# Setup first the xyz location, the variable of interest, the parent part.
xloc = 0.94095
yloc = 0.22981
zloc = 0.03521
varname = "Energy"
partid = 1
# Standard EnSight commands to create a probe at this XYZ location
# Ask EnSight for the value at that probe location
a = ensight.query(ensight.QUERY_PROBE_DATA)
# Print the whole information
# alternative, print out the first variable
vname = a
pref = a
print "Value of ", vname," is ",pref
Let me know if that addresses your question or not... or it inspires more.
Thanks for your information works exactly as I wanted.
Is there documentation / resource of functions such as these on-line anywhere?
The "Interface Manual", chapter 6 has the majority of what you are looking for in terms of Python-EnSight. In the User Defined Tools area for EnSight 10, there are some links to our Google Docs which has a bit more low-level Python operation which may help.
Thanks for the info I wasn't aware of this document but I am now!
You can also find many examples on
In these tools you find many hints how to script ensight
|All times are GMT -4. The time now is 08:49.|