🎉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

Problem in contour plotting using TCL

User: "Rachit Semalty"
Altair Community Member
Updated by Rachit Semalty

Hi all. I was trying to plot the signed von-mises stress contour for a component named "2D" with ID 4. I did it using the hwc commands in hyperview 2021 but those commands do not work in the 2019 version. With some help online, I wrote the following code:

hwi OpenStack;
hwi GetSessionHandle ses_h;
ses_h GetProjectHandle pro_h;
pro_h GetPageHandle pg_h [pro_h GetActivePage];
pg_h GetWindowHandle win_h [pg_h GetActiveWindow];
win_h GetClientHandle cli_h;

i
cli_h AddModel $fileName
cli_h GetModelHandle mod_h [cli_h GetActiveModel];
mod_h SetResult $fileName

# isolating 2D component
set id1 [mod_h AddSelectionSet element]; 
mod_h GetSelectionSetHandle sel_s_h_e $id1; 
sel_s_h_e Add "component 4"; # component 2D has ID 4
sel_s_h_e Reverse; 
mod_h Mask $id1; 
sel_s_h_e ReleaseHandle; 

# setting the result
mod_h GetResultCtrlHandle res_h; 
res_h GetContourCtrlHandle cont_h; 
cont_h SetEnableState true; 
cli_h SetDisplayOptions "contour" true;
cont_h SetDataType "Element Stresses"; 
cont_h SetShellLayer "max";
cont_h SetDimensionEnabled shell true
cont_h SetDataComponent shell "2D";
#cont_h SetDataComponent "SignedVonMises"; 
cont_h SetAverageMode "simple"; 
cli_h Draw; # draw the contour

 

_________________________________________

 

The above script does not seem to work as no contours are plotted. Also, how may I include "signed von Mises" results in this script? Please help me correct this script. 

Also, is there any way to run hwc commands in version 2019 and lower?

Regards,

Rachit

Find more posts tagged with

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

    Hi Adriano. Thanks for your reply. I tried writing the exact name as in HV but it still does not work.

    It seems that I have not selected any component for plotting. In hwc command there was a line for marking components. But I don't think that I have selected any component in the above code. Is that the problem? If yes, then how may I select the components?

     

    Regards,

    Rachit

    You can re-use the selection set commands before contouring:

    # isolating 2D component
    set id1 [mod_h AddSelectionSet element]; 
    mod_h GetSelectionSetHandle sel_s_h_e $id1; 
    sel_s_h_e Add "component 4"; # component 2D has ID 4

     

    Just take care of the Object name, so that is not the same as before, to avoid conflicts.

    Then, for applying a contour only to the Selection Set, use this

     

    cont_h SetSelectionSet id_of_your_slection_set

     

    image