- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello there,
I'm trying to automate cutplane extractions to workaround the lack of volume statistical results in CFD.
The issue is the default planes are shaded and have thus empty tables...
The html doc on the pyhton API lacks the attributes names and types, so I don't know how to setAttributes to shaded mesh.
Here is my bit of code, with the line 19 comment being where I want to set the attribute, it's .txt instead of .py because we can't uplaod .py....
My code certainly can be optimised, but I'm just a regular engineer.
Thank you for your help,
Matthieu
Plain text script here :
# An example to create a cutplane and then access its parameters
from CFD import Setup
from CFD import Results
from CFD import DSE
def CreateCutPlane(zed):
# Initialize all thats needed to create a cutplane
params = Results.CutPlaneParameters()
location = Setup.Vector(0, 0, zed)
normal = Setup.Vector(0, 0, 1)
params.scalarResType = Results.STATIC_TEMP
# Create cutplane with the above arguments
cp = Results.CutPlane.Create(results, "Cutplane"+str(zed), location, normal, params)
DSE.UI.ShowMessage("Cutplane " + str(zed) + " created!")
#I'd like to set a shaded mash for results export cp.setAttributes(SHADED_MESH)
cp.setGridSpacing(112)
return cp
# This is how you get the handle to the Design Study (theres only one in a SimCFD session)
study = Setup.DesignStudy.Create()
# To do anything with results, we must first activate results. Below is how you do it
scenario = study.getActiveScenario() # get active scenario of the study
results = scenario.results() # get results from scenario
if results is None:
DSE.UI.ShowMessage( "There are no results !" )
results.activate() # activate the current results
# Call the above function
for x in range (20) :
height = 50*(x+1)
cutplane = CreateCutPlane(height)
name = str(height) +"plane.csv"
DSE.UI.ShowMessage(name)
cutplane.saveTable(name)
Solved! Go to Solution.