×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

FEMAP API Using feOutputCalculate

FEMAP API Using feOutputCalculate

FEMAP API Using feOutputCalculate

(OP)
I am new to working with the FEMAP API and am trying to calculate some vectors using the API. I have used the Model->Output->Calculate feature to calculate these in the past, but the models I am working on are very large, and I want to be able to run the API at night while I go home and the computer cranks away. Here is the code I am using:

Sub Main
Dim App As femap.model
Set App = GetObject(,"femap.model")
Dim s As femap.Set
Dim v As femap.Set
Dim e As femap.Set
Set e = App.feSet
Dim ov As femap.Output
Set ov = App.feOutput
Dim mx As Double
Set mx =App.feOutput
Dim my As Double
Set my = App.feOutput
'Select Output Set and Output Vectors of interest
If App.feSelectOutput("Select Output Vectors",0,FOT_ANY,FOC_ANY,FT_ELEM,False,s,v) = FE_OK Then
If e.Select(FT_ELEM,True, "Select Elements" ) = FE_OK Then
While s.Next()
v.Reset()
While v.Next()
'Calculate Mx'
mx.feOutputCalculate(s.CurrentID(),8,e.CurrentID(),"Mx'","i","Case","(Abs(Vec(!Case;9000003;!i))+Abs(vec(!Case;9000005;!i)))*Abs(vec(!Case;9000003;!i))/vec(!Case;9000003;!i)")
'Calculate My'
my.feOutputCalculate(s,8,e,"My'","i","case","(Abs(Vec(!Case;9000004;!i))+Abs(vec(!Case;9000005;!i)))*Abs(vec(!Case;9000004;!i))/vec(!Case;9000004;!i)")
Wend
Wend
End If
End If
End Sub

The errors I get are on the lines with the feOutputCalculate and are both Invalid Instruction.

Any ideas would be greatly appreciated.

Thanks

RE: FEMAP API Using feOutputCalculate

Hello,

Here's a shot at a cleaner version of your code (bottom).
One point needs to be explained: from your code I assumed you use static vector IDs (9000003 4 and 5), meaning for all output sets you have created equivalent output vectors with the same IDs before running this. If this is not the case then my code won't do.

AP


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

Dim s As femap.Set, e As femap.Set

Set s = App.feSet
Set e = App.feSet

'Select Output Set and Output Vectors of interest
If s.SelectMultiID(FT_OUT_CASE,1,"Select OutputSets") = FE_CANCEL Then End
If e.Select(FT_ELEM,True, "Select Elements" ) = FE_CANCEL Then End

While s.Next()
'Calculate Mx'
App.feOutputCalculate(s.CurrentID,FT_ELEM,e.ID,"Mx'","i","Case", _
"(Abs(Vec(!Case;9000003;!i))+Abs(vec(!Case;9000005;!i)))*Abs(vec(!Case;9000003;!i))/vec(!Case;9000003;!i)")

'Calculate My'
App.feOutputCalculate(s.CurrentID,FT_ELEM,e.ID,"My'","i","Case", _
"(Abs(Vec(!Case;9000004;!i))+Abs(vec(!Case;9000005;!i)))*Abs(vec(!Case;9000004;!i))/vec(!Case;9000004;!i)")
Wend
End Sub

RE: FEMAP API Using feOutputCalculate

(OP)
Thanks APav, I am still playing around with this, though it seems to have a division by zero error that keeps popping up. It looks like vectors 9000003/4 are zero in a lot of spots, but I don't think that is the case.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources