How to execute a python script in batch mode for HyperView?

Akash Purushothaman
Akash Purushothaman Altair Community Member
edited October 24 in Community Q&A

I have a small script to fetch contour data in HyperView using python APIs. 
I would like to execute this script in batch mode.

Q1. In classic versions, we used to use "\<INSTALL_DIR>\hwdesktop\hw\bin\win64\hw.exe" -b -tcl
Similarly how to execute a python script in batch mode inside HyperView?

Q2. Since 2023 version does not have classic HyperView/HyperMesh anymore.
How to call HM or HV using batch commands? When I use the same command as above, I get the following error
image

This error does not occur when I open the GUI from the start menu.. But when I try to open it from batch window, I get this error.

Best Answer

  • Michal Stefuca
    Michal Stefuca
    Altair Employee
    Answer ✓

    Hi Akash,

    With the new interface, you can call the runhwx.exe executable in batch (-b option) together with a Python script (-f option followed by the Python file path). I have also attached a small script you can use for testing (it produces a text file in the same location as the script resides).

    "C:\Program Files\Altair\2024.1\hwdesktop\hwx\bin\win64\runhwx.exe" -cfg -client HyperWorksDesktop -plugin HyperworksPost -profile HyperworksPost -f C:\Temp\batch_test.py -b

    Thanks,

    Michal Stefuca (Altair)
    Automation & Customization

Answers

  • Vladimir_Gantovnik
    Vladimir_Gantovnik Altair Community Member
    edited October 24

    I hope somebody will reply. I also run tcl scripts in batch version in old versions of HyperMesh, but I did not try it in -2023 and -2024 versions. I used it for optimization problem with external optimizer like HEEDS where I needed to create model, run it, get results without time-consuming HyperMesh GUI. 

  • Michal Stefuca
    Michal Stefuca
    Altair Employee
    Answer ✓

    Hi Akash,

    With the new interface, you can call the runhwx.exe executable in batch (-b option) together with a Python script (-f option followed by the Python file path). I have also attached a small script you can use for testing (it produces a text file in the same location as the script resides).

    "C:\Program Files\Altair\2024.1\hwdesktop\hwx\bin\win64\runhwx.exe" -cfg -client HyperWorksDesktop -plugin HyperworksPost -profile HyperworksPost -f C:\Temp\batch_test.py -b

    Thanks,

    Michal Stefuca (Altair)
    Automation & Customization