Showing results for 
Search instead for 
Do you mean 
Reply

Femap API via Matlab COM/OLE

I've been utilizin the Femap API via VBA in Excel but since many of my projects are in Matlab it would be more preferrable to perform my task via a central program like Matlab. Does anyone know how to implement the first commands to get the femap active model object in Matlab?

 

There is a discussion here about the same issue, but without a resolution. I've tried using actxcserver() command without avail.

https://www.mathworks.com/matlabcentral/newsreader/view_thread/49131

 

Since it can be done in Python, I'm sure it can be done in Matlab. Any help would be much appreciated.

 

Best regards.

2 REPLIES

Re: Femap API via Matlab COM/OLE

I'm very familiar with using the FEMAP API from Matlab.

 

If you want to start a new FEMAP session, do

 

>> happ = actxserver('femap.model');

 

If you want to attach to an existing session, do

 

>> happ = actxGetRunningServer('femap.model');

 

From there, you can use get/set to get and set properties, and invoke() to invoke methods.  For example, to make the FEMAP session visible, do

 

>> rc = invoke(happ,'feAppVisible',true);

 

Overall this works pretty well.  However, if you attempt to use methods that have both input and output arguments in the calling arguments (which is a lot of them), it will not work since Matlab doesn't really pass by reference (that's a complicated subject).  The only way I've found around that is to write a C++ Mex file that encapsulates these API calls.  This is not for the faint of heart--COM in C++ is not trivial.  ATA has developed a toolbox called IMAT that includes this functionality, including the FEMAP API wrapper.  We (ATA) use it extensively with our Vibrata software.  You can learn more about IMAT at www.ata-e.com/software/imat.

Re: Femap API via Matlab COM/OLE

Hello Dan,

 

That wasn't the answer I was hoping for but it does tell me to move on with another method. I'd like to automate dynamic modal runs and use the free-body methods to query results so a limited functionality via Matlab won't do. I'll continue to write the API via Python.

 

IMAT looks useful but as we don't have access to it, I'll just stay in a conventional route.

 

Thank you for your assistance.

 

Best,

Alex