Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pull freebody summation load from FEMAP to Excel using feFreebody - FE_NOT_EXIST error

Status
Not open for further replies.

VH88

Aerospace
Feb 20, 2020
9
Hi all,

I write a simple API code to create a freebody object and specify all its properties using FEMAP API window like in Sub Main below (sorry I omitted some other commands to ask user select elements and nodes, display mode, etc). It worked for me, no error, dVals (0), dVals (1)... had real values and matched with hand extraction

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

Dim feFreebody As App.Freebody
Set feFreebody = App.feFreebody
Dim feOutput Set as

Dim dVals as Variant

' The code to create freebody object inside FEMAP is not shown here

rc = feFreebody.GetSumAtNode(SumNodeID,feOutput.ID,dVals)

End Sub

I then brought the tested code into Excel VBA 2010, connected all the objects to current opening femap application like in the Sub SummationLoad() below. Before hitting the line to run "GetSumAtNode", it successfully created freebody object inside the running FEMAP as intended (these commands are not show below). It returns rc of 4 when it hit "rc = feFreebody.GetSumAtNode(SumNodeID,feOutput.ID,dVals)". Has anyone had issue like this with feFreebody or other objects that have variant-output type when you are trying to run FEMAP from VBA?

Sub SummationLoad()
Dim App As femap.Model
Set App = GetObject(, "femap.model")

Dim feFreebody As App.Freebody
Set feFreebody = App.feFreebody

Dim dVals as Variant

' The code to create freebody object inside FEMAP is not shown here

rc = feFreebody.GetSumAtNode(SumNodeID,feOutput.ID,dVals)

End Sub
 
Replies continue below

Recommended for you

Hi Vu Hoang,

As you got RC code 4, it means FE_NOT_EXIST (see Return Codes part in Femap API manual). So probably, the method feFreebody.GetSumAtNode can't find some of Femap entities. It can be: feFreebody doesn't have freebady object itself, or SumNodeID has the wrong node ID.

And regarding feOutput.ID as an argument in GetSumAtNode. It looks like you try to use the ID of single output set, but it should be an ID of the Set (femap set) which contains outputsets lists. If you wanna use exact single Outputs set ID, it should come with negative number, like -1*feOutput.ID.

Below the citation from FEmap API manual / GetSumAtNode description:
INT4 nSetID -> The ID of a Set object containing a list of output sets. Alternatively,
specify a negative number to specify the ID of a single
output set

If you still can't solve the issue, better provide complete code here.
 
Hi ship_sftwr_dev ,
I specified an output ID instead of an output set ID. I modified my code below like you said and it worked perfectly! Thank you so much!

Set feOutput = App.feOutputSet
rc = feFreebody.GetSumAtNode(SumNodeID,-1*feOutput.ID,dVals)".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor