Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Femap API: Import .FNO file

[ Edited ]

Hi Smiley Happy

 

I wanted to import results from NEi Nastran .FNO file. Is that possible by script?

I tried some options for example: 

App.feFileReadNeutral 

App.feFileAttachResults

 etc...

 

Unfortunatelly I cant load such file. Is there some other option that would work with .FNO file?

I have only issue with importing this type of file. I can load NEU or NAS but no FNO... 

Thanks

6 REPLIES

Re: Femap API: Import .FNO file

Hi,

Help > API > 3.4.5.5  feFileReadNastranResults

With brand = 1 I'm guessing it should take FNO files.

AP 

Solution
Solution
Accepted by topic author Grzes
‎04-14-2017 07:11 AM

Re: Femap API: Import .FNO file

Hi astrium_tls

I dont think it works, I tried couple of variations and nothing...
This is how I'm doing it maybe there is something wrong with my method (Im beginner at this):

Dim message, Title, defaultValue As String
message = "Directory of .NAS and .NEU files"
Title = "Directory"
defaultValue = "Example: D:\FolderName\"
strFolder = InputBox(message, Title, defaultValue, 100, 100)
If strFolder = "" Then strFolder = defaultValue

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Read Results
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

strFile1 = Dir(strFolder & NAS)
strFile2 = Dir(strFolder & NAS)
Do While Len(strFile1) > 0
Debug.Print strFile1
App.feFileNew()
App.feFileReadNastran(1,strFolder + strFile1) 'Importing model
strFile2=Replace(strFile1,".nas",".FNO")
App.feAppMessage(1,"OPEN FILE START")
App.feFileReadNastranResults(1 ,"To.FNO") ' I have tried also with whole path
'App.feFileReadNeutral(1 ,strFolder + strFile2,True,True,True,True,0 )
'App.feFileAttachResults(3,strFolder + strFile2,True)
App.feAppMessage(1,"OPEN FILE STOP")
Solution
Solution
Accepted by topic author Grzes
‎04-14-2017 07:10 AM

Re: Femap API: Import .FNO file

FEMAP developers will be able to say whether there is a bug with this method or not. In the meanwhile here are a few tips regarding your code:

 

- The getfilepath method will enable you to prompt the user for a file. Go to Help > Basic Languauge for more information

- the Dir method will make sure the file exists. perhaps the name you are giving is wrong, is "nas" in caps or lower case...?

 

AP

 

    Dim s As String
    s = GetFilePath("","NAS",,"Specify input file",0)
    If s = "" Then End

    App.feFileNew
    App.feFileReadNastran(1,s)

    s = Replace(s,"NAS","FNO")
    If Dir(s) = "" Then
        App.feAppMessage(FCM_ERROR,"ERROR: file " & s & " was not found")
        s = GetFilePath("","FNO",,"Specify results file",0)
        If s = "" Then End
    End If

    App.feFileReadNastranResults(1,s)

 

 

Re: Femap API: Import .FNO file

Hi astrium_tls

Thanks for hints. "nas" is ins in lower case. But I dont think this should be an issue. When I change s = Replace(s,"NAS","FNO") to s = Replace(s,"NAS","NEU") it works perfectly importing neutral file.

So I think it searches files correctly. Of course it can be done better like you suggestedSmiley Happy but I dont think this could cause issue with importing FNO...
But yeah who knows, Im just a beginnerSmiley Happy

Re: Femap API: Import .FNO file

It is embarasingSmiley Very Happy

You were right it was an issue with lower case.
Results got imported with App.feFileReadNeutral(1 ,strFolder + strFile2,True,True,True,True,0 )

Thank you Smiley Happy

Re: Femap API: Import .FNO file

I just looked at GROUP_POST_FNO.bas in the /api/PostProcessing folder that ships with FEMAP, this API is designed for large models with large amounts of output data to extract a portion of the model, together with its output data for more efficient post-processing.  In it, an FNO is created, and then attached to with -

 

rc = App.feFileAttachResults( FAP_NE_NASTRAN, fno_Name, False )

 

Mark.