zanestoy
Structural
- Apr 25, 2012
- 10
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
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