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
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