How do I run a script (.tcl) on HyperMesh directly from an Excel macro (Visual Basic)?

Carlos_21231
Carlos_21231 New Altair Community Member
edited October 2021 in Community Q&A

Hi,

I am creating a script .tcl, which is generated by a Macro on Visual Basic, depending on certain inputs that are introduced into an Excel SpreadSheet.

I would like to be able to run that generated .tcl file on HyperMesh and open the Model that it contains. But all of this, without the need of opening myself the program and clicking in the Toolbar to run this .tcl file.

INPUTS -> Excel SpreadSheet -> Macro (VBA) -> .tcl script-> open HyperMesh -> run the .tcl script

(All above is done within visual Basic environment)

Does anyone how to do it? Thanks in advance!

Carlos

 

 

Best Answer

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited October 2021 Answer ✓

    Hi Adriano,

     

    Could you please show me an example? I am a nobby with -tcl language.

     

    The path to HW executable in my computer is:

    C:\Program Files\Altair\2020\hwdesktop\hw\bin\win64\hw.exe

     

    The tcl scrip I want to open is here:

    C:\Users\c.badillo\Desktop\Trial.tcl

     

    Thanks in advance!

    if it was a Windows command prompt, you would run something like:

     

    call "C:\Program Files\Altair\2020\hwdesktop\hw\bin\win64\hw.exe" -tcl "C:\Users\c.badillo\Desktop\Trial.tcl" -b -clientconfig hwfepre.dat

     

    -tcl set the path for your tcl script

    -b to run in batch mode

    -clientconfig defines that you're starting HyperMesh

     

    Probably VB has some command to execute this command line, or call a .bat file.

     

Answers

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited October 2021

    You can call hw.exe and use some arguments such as -tcl to call a tcl script automatically.

    Please take a look at the attached documentation.

     

    I don't know how to call this from VB, but i'm pretty sure Google knows some command.

  • Carlos_21231
    Carlos_21231 New Altair Community Member
    edited October 2021

    Hi Adriano,

     

    Could you please show me an example? I am a nobby with -tcl language.

     

    The path to HW executable in my computer is:

    C:\Program Files\Altair\2020\hwdesktop\hw\bin\win64\hw.exe

     

    The tcl scrip I want to open is here:

    C:\Users\c.badillo\Desktop\Trial.tcl

     

    Thanks in advance!

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited October 2021 Answer ✓

    Hi Adriano,

     

    Could you please show me an example? I am a nobby with -tcl language.

     

    The path to HW executable in my computer is:

    C:\Program Files\Altair\2020\hwdesktop\hw\bin\win64\hw.exe

     

    The tcl scrip I want to open is here:

    C:\Users\c.badillo\Desktop\Trial.tcl

     

    Thanks in advance!

    if it was a Windows command prompt, you would run something like:

     

    call "C:\Program Files\Altair\2020\hwdesktop\hw\bin\win64\hw.exe" -tcl "C:\Users\c.badillo\Desktop\Trial.tcl" -b -clientconfig hwfepre.dat

     

    -tcl set the path for your tcl script

    -b to run in batch mode

    -clientconfig defines that you're starting HyperMesh

     

    Probably VB has some command to execute this command line, or call a .bat file.

     

  • Carlos_21231
    Carlos_21231 New Altair Community Member
    edited October 2021

    Thanks for the answer Adriano. It worked perfectly.