Try to launch Nastran from Hypermesh

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi, i'm trying to add a button to launch nastran directly from inside Hypermesh. This is what i wrote (that doesn't work):

 

*createbutton(5,'Nastran 2013.0',10,5,5,RED,'Open Nastran 2013.0','LaunchNastran')

 

*beginmacro(LaunchNastran)

exec cmd.exe /c start /wait C:\MSC.Software\MSC_Nastran\20130\bin\nastranw.exe

*endmacro()

 

 

Any suggestion?

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited February 2014

    in tcl, file path use '/' as in Unix and not '\' as windows, you could use file normalize. Also use '\\' instead of '\'

     

    Try using:


    exec cmd.exe /c start /wait [ file normalize  'C:\\path\\to\\nastran\\bin\\nastranw.exe' ];

    or just


    exec [ file normalize 'C:\\path\\to\\nastran\\bin\\nastranw.exe' ];

    Hope this helps.

  • tinh
    tinh Altair Community Member
    edited February 2014

    hi,

    try using *evaltclstring to run tcl commands inside macro file

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited February 2014

    ok, thanks to your help this code actually works:

    *createbutton(5,'Launch Nastran 2013.1',-5,0,10,RED,'Wanna launch Nastran?',EvalTcl,'LaunchNastran.tcl')

    in userpage.cmd

     

    and 

    exec cmd.exe /c start /wait [file normalize \\MSC.Software\\MSC_Nastran\\20131\\bin\\nastranw.exe'];

    in LaunchNastran.tcl....

    I was wondering if there was a way to write everything in a single file... i tried with *evaltclstring but it doesn't work (or i wrong wrote it! image/emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'> )

     

    (yes, i updated Nastran to 2013.1 in the meanwhile ahahha)
     

  • tinh
    tinh Altair Community Member
    edited February 2014

    hi

    to use single file, put *evaltclstring into a macro:

    *beginmacro('LaunchNastran')

    *evaltclstring('exec cmd.exe /c start /wait [file normalize ...nastranw.exe]',0)

    *endmacro()

     

    and point your button to this macro

    *createbutton(5,'Launch Nastran 2013.1',-5,0,10,RED,'Wanna launch Nastran?','LaunchNastran','LaunchNastran.tcl')