A script that asks user for criteria & parameter file for batch mesh

BHARGAV PANCHAL_22437
BHARGAV PANCHAL_22437 New Altair Community Member
edited October 2022 in Community Q&A

Hi,

Since I am new to scripting I have created a sample script that creates a batchmesh of surface using following code:

*createmarkpanel surfaces 1 "Select Surfaces";
*createstringarray 1 "breakconnectivity 0";
*hm_batchmesh2 surfaces 1 1 1 "D:/BatchMesh/durability_3mm_chk_tria.criteria" "D:/BatchMesh/durability_3mm_tria.param";

Can the above code be modified such that it asks input from user for the criteria and parameter file for different mesh sizes?

Thanks!

Bhargav

Answers

  • Brett Ramsey_20633
    Brett Ramsey_20633 New Altair Community Member
    edited October 2022

    Howdy, 

     

    The command you are looking for is [tk_getOpenFile]. This will open the file open file dialog, and you can pick the param file. Another command you might want to use is *readbatchparamsfile. 

     

    Hope this helps

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited October 2022

    The command you are looking for is hm_getfilename.

    https://2022.help.altair.com/2022.1/hwdesktop/hwd/topics/reference/hm/hm_getfilename.htm

    So your code would look like this:

    set paramfname [hm_getfilename "Please select a param file"]<br />*createmarkpanel surfaces 1 "Select Surfaces";
    *createstringarray 1 "breakconnectivity 0";
    *hm_batchmesh2 surfaces 1 1 1 "$criteriafname" "$paramfname";set criteriafname [hm_getfilename "Please select a criteria file"]<br />
  • BHARGAV PANCHAL_22437
    BHARGAV PANCHAL_22437 New Altair Community Member
    edited October 2022
    Thanks a lot guys for your input. Now the script is running successfully ????