Hypermesh and MatLab
Hi everyone,
Is there a way to control HyperMesh from MatLab? In other words, how can I write code in MatLab which can call functions and processes in HyperMesh? Or is this possible by using C/C++?
I tried looking for COM (Component Object Model) objects, but unfortunately HyperMesh does not expose such components. What about other Windows API, such as OLE (Object Linking and Embedding) or DDE (Dynamic Data Exchange)?
Thank you in advance for any suggestions.
Best regards,
Lucian.
Answers
-
Hi Lucian,
In your matlab session, you output a Tcl file which includes hypermesh functions and tcl commands
then you can call hypermesh with command argument -tcl [Tcl file]. Hypermesh will process those procedures
Results can be arranged in Tcl file to be output to a file, and your session can get them.
0 -
Hello Tinh,
Thank you for answering. So... you say I should generate a TCL script file 'script.tcl' using MatLab and then manually start HyperMesh with the '-tcl' argument. This is a good idea, but I still have some related questions:
1. Is there a way to do this automatically, from inside the MatLab environment?
2. How can I know when the TCL script has finished? Because I want to finish executing the rest of my MatLab code.
To better understand my problem, let me give you a simplistic example:
% write script file here
...
% how to run the script?
hw = Interface ('HyperWorks');
hw.Execute ('-tcl', 'script.tcl');
...
if hw.Execute ('Status') == 'Finished'
% continue executing the rest of MatLab code
...
end
Best regards,
Lucian.
0 -
Hi Lucian
I am not sure the matlab command to call a .exe program but i think it is similar to the call in TCL script
you try this:
#call hypermesh:
system([C:/Altairwin64/hm10.0/hm/bin/hmopengl.exe -tcl TCL_FileName])
#you append 'hm_exit' to the Tcl file to exit hypermesh,
#when hypermesh exit, the command 'system' in matlab will return, and you can continue processing output file
I see there are some ways to call .exe program in matlab, you can search for the way that command call a program but wait for program exit instead of return immediately
0 -
Hey Tinh,
Yes, you are right. This might be the solution I was looking for. Thank you! /emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'>
Best,
Lucian.
0 -
Hello,
I want to do the same program with matlab could you help me ?
Thank you.
0