|
[Sponsors] |
January 18, 2013, 08:08 |
Variable from point query (scripting)
|
#1 |
New Member
James
Join Date: Jan 2013
Posts: 3
Rep Power: 13 |
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. James |
|
January 19, 2013, 11:05 |
Query Variable from Script
|
#2 |
Senior Member
Kevin Colburn
Join Date: Mar 2009
Location: The Woodlands, TX
Posts: 131
Rep Power: 17 |
James,
That is fairly straight forward to extract out of EnSight. The main python function you want to use is : ensight.query(ensight.QUERY_PROBE_DATA) 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 ensight.variables.activate(varname) ensight.query_interact.select_varname_begin(varnam e) ensight.query_interact.query("xyz") ensight.part.select_begin(partid) ensight.query_interact.create(xloc,yloc,zloc) # Ask EnSight for the value at that probe location a = ensight.query(ensight.QUERY_PROBE_DATA) # Print the whole information print a # alternative, print out the first variable vname = a[0][0][0] pref = a[1][0][0] print "Value of ", vname," is ",pref Let me know if that addresses your question or not... or it inspires more. -Kevin Colburn (kevin@ceisoftware.com)
__________________
Kevin Colburn Computational Engineering International, Inc. www.ceisoftware.com kevin@ensight.com |
|
January 22, 2013, 14:15 |
|
#3 |
New Member
James
Join Date: Jan 2013
Posts: 3
Rep Power: 13 |
Hi Kevin
Thanks for your information works exactly as I wanted. Is there documentation / resource of functions such as these on-line anywhere? Thanks again, James |
|
January 22, 2013, 18:12 |
|
#4 |
Senior Member
Kevin Colburn
Join Date: Mar 2009
Location: The Woodlands, TX
Posts: 131
Rep Power: 17 |
James,
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. -Kevin
__________________
Kevin Colburn Computational Engineering International, Inc. www.ceisoftware.com kevin@ensight.com |
|
January 24, 2013, 04:15 |
|
#5 |
New Member
James
Join Date: Jan 2013
Posts: 3
Rep Power: 13 |
Hi Kevin,
Thanks for the info I wasn't aware of this document but I am now! James |
|
March 28, 2013, 03:18 |
|
#6 |
Member
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 16 |
You can also find many examples on
http://pythonexchange.com/ In these tools you find many hints how to script ensight Greets Jim |
|
July 19, 2018, 06:47 |
|
#7 |
New Member
Viswanathan
Join Date: Jul 2018
Posts: 9
Rep Power: 8 |
Hi kevin,
in query show info i could get required scalar value for particular node/ Element. how to get the same by Script. i want to use that scalar value x=getinfo('element 123') or x=get scalar value(node 1) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] error EOF in blockMesh | Ahmed Khattab | OpenFOAM Meshing & Mesh Conversion | 7 | May 17, 2012 01:37 |
Instalation on ubuntu 710 | basilwatson | OpenFOAM Installation | 17 | March 16, 2012 21:16 |
Question about making a variable function of proprities of onother variable ? | rafiktharwat | CFX | 0 | March 26, 2011 15:23 |
How to limit a variable | ash | OpenFOAM Running, Solving & CFD | 1 | June 26, 2008 21:32 |
[Gmsh] Gmsh and samplesurface | touf | OpenFOAM Meshing & Mesh Conversion | 2 | December 10, 2007 03:27 |