Cancel
Showing results for 
Search instead for 
Did you mean: 

API Combining vectors to a new vector

Valued Contributor
Valued Contributor

Hi,

 

I'm trying to program an API that creates an absolute beam stress vector accross selected outputsets.

so far i have succesfully created an ABS vector for all comb. stress' using feOutputCalculate.

the last step (and the step I need help with) is merging these 4 vectors together in to a new one.

 

This is what I have so far, I know its not yet that robust but its a starter.

Sub Main
Dim App As femap.model
Set App = feFemap()
Dim from_setID(4) As Long
Dim s As femap.Set, e As femap.Set, ax As femap.Set

from_setID(0)=9000000
from_setID(1)=9000001
from_setID(2)=9000002
from_setID(3)=9000003

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

Dim s_count As Integer
s_count = s.Count
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()
App.feOutputCalculate(s.ID,FT_ELEM,e.ID,"Absolute Beam EndA max Comb Stress","i","Case","Abs(vec(!Case;3164;!i))")
App.feOutputCalculate(s.ID,FT_ELEM,e.ID,"Absolute Beam EndA min  Comb Stress","i","Case","Abs(vec(!Case;3165;!i))")
App.feOutputCalculate(s.ID,FT_ELEM,e.ID,"Absolute Beam EndB max Comb Stress","i","Case","Abs(vec(!Case;3166;!i))")
App.feOutputCalculate(s.ID,FT_ELEM,e.ID,"Absolute Beam EndB min Comb Stress","i","Case","Abs(vec(!Case;3167;!i))")
App.feOutputProcessMerge(False,False,UBound(s_count),s,from_setID,0) '<- this doesn't work :( nothing happens
Wend

End Sub

 

Maarten Elings | Mechanical Engineer
3 REPLIES

Re: API Combining vectors to a new vector

Legend
Legend

Dear MaartenEl,

 

 

I've run your tool, did some changes to argument for function feOutputProcessMerge but still it does not provide what is needed. Function returns FE_OK but nothing. 

 

I have following suggestion: use feOutputCalculate and Max() function to combine vector results. There are 3 combinations: 1) Maximum among absolute vectors 3164 and 3165. 2) Maximum among absolute vectors 3166 and 3166. 3) Max among option 1 and 2:

Sub Main
Dim App As femap.model
Set App = feFemap()
Dim s As femap.Set, e As femap.Set, ax As femap.Set

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

Dim s_count As Long
s_count = s.Count
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

'Dim rc As zReturnCode

While s.Next()

App.feOutputCalculate(s.ID,FT_ELEM,e.ID,"Absolute Beam EndA Comb Stress","i","Case","Max(Abs(vec(!Case;3164;!i)); Abs(vec(!Case;3165;!i)))")
App.feOutputCalculate(s.ID,FT_ELEM,e.ID,"Absolute Beam EndB Comb Stress","i","Case","Max(Abs(vec(!Case;3166;!i)); ABs(vec(!Case;3167;!i)))")
App.feOutputCalculate(s.ID,FT_ELEM,e.ID,"Absolute Beam Comb Stress","i","Case","Max(vec(!Case;9000000;!i); vec(!Case;9000001;!i))")

Wend

End Sub

 

It is possible to replace these 3 vectors with one (if you are interested only in final result) by combining first and second formula in one.

 

Yarko

Re: API Combining vectors to a new vector

Legend
Legend

Dear Maarten El,

 

 

How did you make that in your message pasted code is with colors?

 

Yarko

Re: API Combining vectors to a new vector

Valued Contributor
Valued Contributor
By copy-pasting directly from FEMAPs API interface
Maarten Elings | Mechanical Engineer