How can I get the name of the current model opened in Hypermesh?

Thirukumaran
Thirukumaran Altair Community Member
edited April 4 in Community Q&A

Hi,

I need the name of the current model imported in the Hypermesh to identify the model's file directory. I have tried using [hm_info currentfile], but it did not produce the output as expected. Is there any command which could be similar to that of this and which does not require panel interaction such as [hm_info hmfilename]. Any inputs with respect to TCL and HM commands would be much appreciated. 

Thanks in advance!

Best Answer

  • Adriano_Koga
    Adriano_Koga
    Altair Employee
    edited April 4 Answer ✓

    Try these:

     

    set currentmodel [hm_info currentfile]

    set modelname [file tail $currentmodel]

    set dirname [file dirname $currentmodel]

     

Answers

  • Rajashri_Saha
    Rajashri_Saha
    Altair Employee
    edited April 2

    Hi Thirukumaran,

    Which version are you using?

    In 2023 version, once you open a .hm file you can see the file name in top left corner and file directory information under "Model Info" in main work area.

    See the below pic.

    image

    Thanks

    Rajashri

  • Adriano_Koga
    Adriano_Koga
    Altair Employee
    edited April 4 Answer ✓

    Try these:

     

    set currentmodel [hm_info currentfile]

    set modelname [file tail $currentmodel]

    set dirname [file dirname $currentmodel]

     

  • Thirukumaran
    Thirukumaran Altair Community Member
    edited April 3

    Hi Thirukumaran,

    Which version are you using?

    In 2023 version, once you open a .hm file you can see the file name in top left corner and file directory information under "Model Info" in main work area.

    See the below pic.

    image

    Thanks

    Rajashri

    Hi Rajashri,

    Thank you for your inputs. I am in search of solution for Tcl/Hm commands to retrieve the filename for my Tcl script. And, I am currently using 2022.2 version of Hypermesh.

    Thanks!

    Thirukumaran

  • Thirukumaran
    Thirukumaran Altair Community Member
    edited April 4

    Hi, 

    I have identified the missing lead regarding the question posted by me. The commands posted by Adriano is working fine and is very much useful. Likewise, Thank you Rajashri for the inputs. The reply gave clarity as well regarding the empty outputs. If the model info is Untitled*, the command will give an empty output or an output with only "."

    Thanks for the inputs both!

    Thirukumaran