How do you pass arguments to Mechanical stand-alone script from command line?

Options
willblatt
willblatt Member Posts: 13
Name Dropper First Comment
edited October 2023 in Structures

This other post describes passing args to a journal run in runwb2.exe, is there a way to do the same thing with a script in Mechanical stand-alone?

AnsysWBU.exe -DSApplet -AppModeMech -nosplash -notabctrl -script script.py

(I did try the -E flag, but no luck).

Best Answer

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 208
    First Answer First Comment 5 Likes First Anniversary
    Answer ✓
    Options

    This is available in 24.1, which is due for public release in January 2024:
    call "C:\Program Files\ANSYS Inc\v241\aisol\Bin\winx64\AnsysWBU.exe" -DSApplet -AppModeMech -scriptargs "1,b,99"

    Note that -nosplash -notabctrl is no longer required at 24.1.

    In the meantime, one workaround is to set environment variables, which will then be available in Mechanical.

    Another workaround is to utilize PyMechanical to pass arguements or set parameter values before running a script. See, e.g., https://discuss.ansys.com/discussion/comment/2115#Comment_2115