Cancel
Showing results for 
Search instead for 
Did you mean: 

Help with macro for converting abaqus (.inp) to Patran (.pat)

Experimenter
Experimenter

Dear fellow Femap users,

 

I am currently trying to automate a conversion of Abaqus input-files to the Patran file format by running from a batch-file. In the midst of the conversion I would also like to create some boundary conditions based on node-sets in the abaqus input file.

 

I created a Program File (.prg) (see attached file) by recording my actions when using FEMAP. By doing so I manage to semi-automate the process but unfortunately this is very slow (having to see each and every keystroke is tedious even though it is performed at relatively high speeds), and additionally I am not successful in scripting FEMAP to close itself this way.  

 

Therefore I started on a .bas file with VBA scripts (see attached file) based on tidbits I found in the manual. Unfortunately I have not found exactly what I am looking for in the Manual, and is therefore hoping any of you have the necessary knowledge/experience to help me complete this.

 

My script so far:

Sub Main
   Dim femap As Object
   Set femap = GetObject(, "femap.model")
   femap.feFileNew
   femap.feFileReadAbaqus(0 ,"Test.inp")
   femap.feFileWriteDyna(0 ,"Dyna2.inp")
   femap.feFileExit
End Sub

 

Note that I wrote "feFileWriteDyna" because I only wanted to see if the script managed to successfully import the abaqus inputfile. Also I was unsuccessful in finding any API-reference to the "export to patran" (i.e. a feFileWritePatran) anywhere in the manual. Could it be that it Is not possible? And also I have not gotten that far as to creating boundary conditions based on sets in the abaqus-input file, so if you have any advice on that too I would greatly appreciate it!

 

I have also included the principle model I have used for this in case any of you would like to try this for yourself.

 

I am using Femap v10.3.1 64bit.

 

Any help would be appriciated!

 

Best Regards

Kristoffer

 

3 REPLIES

Re: Help with macro for converting abaqus (.inp) to Patran (.pat)

Phenom
Phenom

Hello,

 

FEMAP can write 2 types of files: geometry (for CAD software) and analysis models (for FEA solvers). What you are looking for is a NASTRAN file, so feFileWriteNastran,  cf Help > API > 3.4.9.6. You can use "brand = 0" (MSC).

 

Next comes exporting a run. If you want this to be fully automatised (no popup window during execution), then FEMAP needs to have all required information. I'm primarily talking about the analysis manager, which is the listing of all necessary parameters for a run (run type, loads, bcs, output...etc). Are there subcase already defined in your abaqus input file? If no then you'll need to have a look at the AnalysisMgr object, Help > API > 5.7.

One thing which will be important for you is in §5.7.1: look for Master Case Options > BCSet. This property is where you will link the boundary you create with the analyses set which will be exported. In other words let's say you create a BCset with an ID = 13 (cf next paragraph), then this must appear in the analysismgr as BCset(0) = 13.

 

Finally comes creating boundary conditions, cf Help > API §5.9 to 5.13 depending on what you want to create. The first thing you need is a BCset, and take a look at §5.13.1: it says "BCSets are always stored with a SetID=1, and the ID equal to the constraint set ID". In other words, for the example above, you would have to make sure that you specify something like "myBCset.ID = 13", that way you know that this is the boundary condition which will be written in your file.

 

After that you have not detailed what kind of BC you have in mind, so have a look at the 3 types FEMAP allows: node, equations (MPCs) and geometry related.

 

AP

Re: Help with macro for converting abaqus (.inp) to Patran (.pat)

Experimenter
Experimenter

Thank you for your reply!

 

To be clear, I wish to export the analysis-model to the format "PATRAN 2.5 Neutral file." Interactively in Femap I do this by File > Export > Analysis Model > Other Interfaces > Patran (added a figure for illustrative purposes). 

 

I am no expert in the various variants of NASTRAN formats, but to further clarify my reasons for needing the specific output-format is due to a custom script designed to read the "Patran 2.5 neutral file format". I am only interested in exporting nodal, constraint and load -information, hence no further analysis-specific information is needed. It would save me a lot of time on re-programming my script if it was possible to script the FEMAP-export to this specific PATRAN file format. Could the answer lie in the feFileWriteNeutral or feFileWriteNeutral2 ?

 

Let me know if you require more information?

 

Re: Help with macro for converting abaqus (.inp) to Patran (.pat)

Phenom
Phenom

If you got 90% of the way there with your .prg macro, you may just need to familiarise yourself with the   #SILENT(1)   command which allows the macro to run without showing the dialog boxes.

#SILENT(0) shows the dialogs (default), and these lines can be placed throughout your macro to toggle between whether operations are visible or not.

You may also be interested in the   <USER>   command, which allows you to substitute explicitly specified selections (or filenames) with a pause in the macro while it waits for you to make a selection or type some input.

And finally, you may be interested in the #OPT() command.  For example, if you wanted Femap to close using your macro, but it gets stuck because it asks the question about whether you want to save the model, then #OPT(N) will answer the question and close the program.  Eg. these lines in your macro will close Femap without saving the model, but make sure you have already tested and saved (the rest of) your macro before adding these lines and saving the macro again:

 

$ Exit
{~1025}
#OPT(N)