🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Get results from different subcases

User: "Christian Nörenberg"
Altair Community Member
Updated by Christian Nörenberg

Hi,

I have a model of a rotating e-motor and solved the model with 3 different speeds with OptiStruct (as different loadsteps / loadcols).
Now I'm struggeling with the tcl commands for getting the value for the max stress for all 3 subcases.

The first steps are the same as for single speed:

hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName set pageIndex [myProjectName GetActivePage] myProjectName GetPageHandle myPageName $pageIndex set windowIndex [myPageName GetActiveWindow] myPageName GetWindowHandle myWindowName $windowIndex myWindowName GetClientHandle myPostName set modelIndex [myPostName GetActiveModel] myPostName GetModelHandle myModelName $modelIndex myModelName GetResultCtrlHandle myResultName myResultName GetContourCtrlHandle contour_handle contour_handle SetDataType "Element Stresses (2D & 3D)" contour_handle SetDataComponent component vonMises contour_handle SetAverageMode advanced contour_handle SetLayer Max contour_handle SetEnableState True contour_handle SetResultSystem 0 myResultName SetCurrentSimulation 0 contour_handle SetDimensionEnabled solid True contour_handle SetDimensionEnabled shell True contour_handle SetEnableState True  # Maximum stress value myModelName GetQueryCtrlHandle myQueryName myModelName GetSelectionSetHandle mySetName [myModelName AddSelectionSet component] mySetName Add all myQueryName SetQuery "contour.max" myQueryName SetSelectionSet [mySetName GetID] myQueryName GetIteratorHandle qry_iterator

Now I can get the max stress for the first subcase with

set query_list [qry_iterator GetDataList] set max_stress [lindex $query_list 0]

and this command also works if I change the subcases manually.

image

But if I use the following for-loop to change the current subcase, the list / value is empty / "N/A":

# doesnt work set subcases [myResultName GetSubcaseList "Base"] foreach subcase $subcases { 	myResultName SetCurrentSubcase $subcase 	set query_list [qry_iterator GetDataList] }  # doesnt work either myResultName SetCurrentSubcase 1 set query_list [qry_iterator GetDataList]  myResultName SetCurrentSubcase 2 set query_list [qry_iterator GetDataList]  myResultName SetCurrentSubcase 3 set query_list [qry_iterator GetDataList] 

So what am I missing?

Thanks for your help!

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Michele Macchioni"
    Altair Employee
    Accepted Answer
    Updated by Michele Macchioni

    Hey Christian,

    a couple of different approches:

    #1 why not using default static measure max (ID = 1) and retrieve its value rather than using a query handle?

    #2 have you thought of creating an envelope load case upfront and contour it rather than use a loop?

     

    My 2 cents.

    Cheers

    Michele