CFD python API - cutPlane attributes

CFD python API - cutPlane attributes

matthieu.griveletAH26V
Enthusiast Enthusiast
748 Views
1 Reply
Message 1 of 2

CFD python API - cutPlane attributes

matthieu.griveletAH26V
Enthusiast
Enthusiast

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)

 

0 Likes
Accepted solutions (1)
749 Views
1 Reply
Reply (1)
Message 2 of 2

matthieu.griveletAH26V
Enthusiast
Enthusiast
Accepted solution

Okay so I finally got answers from Autodesk's dev team and apparently the CutPlaneAttributes class has not been implemented in the API, so there is nothing to get, set or work with. The plane extraction is thus impossible and this API is kinda useless if you hope to automate data extraction.

Good to know huh?

0 Likes