Showing results for 
Search instead for 
Do you mean 

Running Nastran executable with Femap API



I would like to run multiple Nastran analyses within Femap by calling directly the executable (nastran.exe) and all the different BDF files I have, in a sort of batch mode, without going through the Femap analysis manager.


Are there API instructions that would allow me to do this?




Re: Running Nastran executable with Femap API

Use the function feFileExecute.  For example;


The HTML Clipboard

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Dim rc As femap.zReturnCode

    Dim NastranExecutable As String
    NastranExecutable = "C:\Femap\nastran\bin\nastran.exe"
    Dim NastranDeck As String
    Dim NastranCommand As String

    NastranCommand = NastranExecutable + " " + NastranDeck 

    rc = App.feFileExecute ( NastranCommand, False )

End Sub

Best Regards,
Chip Fricke
Principal Applications Engineer - Femap Product Development

Re: Running Nastran executable with Femap API

This should work just fine unless the BDF files are not created in Femap (tagged by Femap for NX Nastran).

If this is the case I could assist, if still needed. That is just ask, if nobody else helps first.


Re: Running Nastran executable with Femap API

That is indeed the case. I am generating multiple BDFs externally since Femap does not support all the Nastran cards that I need (I am doing aeroelastic analyses).


So the API code above will not work in this case? Is there a workaround?


Thank you.

Re: Running Nastran executable with Femap API

I would suggest to try Chip Fricke's method first. If that doesn't work, there are happily workarounds. I favor using Windows batch files and the approach would be to put in a such batch two lines for each BDF file to be taken:
- First use Femap to load the BDF and resave it for NX Nastran. A tiny API file will be involved, setup to auto-run in the Femap call.
- Launch Nastran with the resave file.
There are some issues as you can not learn in the Femap API the name of a start-up file, and a couple more lines might be required therefore for each BDF in the batch depending on how you intend to manage the result files further.
If you are not very familiar with either or both Femap API and Windows Batches I could assist further with actual BAS and BAT files. Unfortunately, this could only be tomorrow (I don't know about your time zone, but it is close to 1:00 AM here).
If you are by chance in the Linux world it would take me too much to recollect things and it would be better if someone else could help you.
Oh, and don't mention it.

Re: Running Nastran executable with Femap API


Thanks for the reply CAIx.


The issue with opening and resaving the BDF with Femap is that, when I do this, Femap discards some Nastran cards that I need for my aeroelastic analyses (SOL144 and 146 in Nastran), that is the main reason why I want to modify the BDFs externally with a text editor and add these cards. Or this will not be the case with the API that you mean?


Thanks for your help offer. Luckily I am Windows based. Anyway I do not need to do this right now, but, if you are still available, I may get back in touch with you to ask for assistance in a couple of weeks.

Re: Running Nastran executable with Femap API

For any cards that FEMAP does not support there are several ways that you can store them in your FEMAP model. You can enter them into the Model Notes.  Simply go to File->Notes, choose "Translation Text", make sure "Include During Write Translation" is turned on, and enter them there. In this case they will be included with every Analysis Set. Or, if you want something more specific to a particular analysis, you can create the Analysis Set, then go to the Bulk Data Section and enter them as "Start Text".  In either case, whatever cards you create will appear in the Bulk Data section when FEMAP exports the Nastran file.

Re: Running Nastran executable with Femap API

Hi adamas,

I didn't see this coming. No, my combination of batch and startup API will only help for large number of analyses for which you already have BDFs. It would be of no help for the case of lost cards.

For what you need it looks like what grudy provided below is the best advice for a small number of analyses. In am not an expert in NASTRAN, sections and cards and includes, but it looks like his solution is fully supported by API and could be easily combined with a batch/API based approach for analyses in bulk like the one I described last night. If you will still need the bulk processing I will gladly help you on that side.