bohrT
Mechanical
- Feb 8, 2017
- 1
I am trying to extract a force balance from a set of nodes and elements for a given results set. I made sure that my results included grid point forces. When I run the below code I get:
Return code: -1
API Error (Line 43): (10023) Array index out of range.
--> App.feAppMessage( FCM_NORMAL, "Force X: " + Str$( res( 0 ) ) )
Any help on this would be great, thanks!
Code:
Sub Main
' Init model
Dim App As femap.model
Set App = feFemap()
' Init output set
Dim fOS As femap.OutputSet
Set fOS = App.feOutputSet
' Init variables
Dim nArr As Long
Dim i As Long
Dim values As Variant
Dim ents As Variant
Dim loadSetID As Long
Dim rc As Long
loadSetID = 1
' Init element and node sets
Dim fsElem As femap.Set
Dim fsNd As femap.Set
Set fsElem = App.feSet
Set fsNd = App.feSet
fsElem.Select( FT_ELEM, True, "Select them elements!" )
fsNd.Select( FT_NODE, True, "Select them nodes!" )
fOS.Get( loadSetID )
Dim bPoint(3) As Variant
bPoint( 0 ) = 1.1
bPoint( 1 ) = 2.2
bPoint( 2 ) = 3.3
' Declare number of sets and results variables
Dim nSets As Long
Dim res As Variant
' Call force balance
rc = App.feOutputForceBalance( fOS.ID, fsNd.ID, fsElem.ID, 0, bPoint, nSets, res)
' Write results and return code out
App.feAppMessage( FCM_NORMAL, "Return code: " + Str$( rc ) )
App.feAppMessage( FCM_NORMAL, "Force X: " + Str$( res( 0 ) ) )
End Sub
Return code: -1
API Error (Line 43): (10023) Array index out of range.
--> App.feAppMessage( FCM_NORMAL, "Force X: " + Str$( res( 0 ) ) )
Any help on this would be great, thanks!
Code:
Sub Main
' Init model
Dim App As femap.model
Set App = feFemap()
' Init output set
Dim fOS As femap.OutputSet
Set fOS = App.feOutputSet
' Init variables
Dim nArr As Long
Dim i As Long
Dim values As Variant
Dim ents As Variant
Dim loadSetID As Long
Dim rc As Long
loadSetID = 1
' Init element and node sets
Dim fsElem As femap.Set
Dim fsNd As femap.Set
Set fsElem = App.feSet
Set fsNd = App.feSet
fsElem.Select( FT_ELEM, True, "Select them elements!" )
fsNd.Select( FT_NODE, True, "Select them nodes!" )
fOS.Get( loadSetID )
Dim bPoint(3) As Variant
bPoint( 0 ) = 1.1
bPoint( 1 ) = 2.2
bPoint( 2 ) = 3.3
' Declare number of sets and results variables
Dim nSets As Long
Dim res As Variant
' Call force balance
rc = App.feOutputForceBalance( fOS.ID, fsNd.ID, fsElem.ID, 0, bPoint, nSets, res)
' Write results and return code out
App.feAppMessage( FCM_NORMAL, "Return code: " + Str$( rc ) )
App.feAppMessage( FCM_NORMAL, "Force X: " + Str$( res( 0 ) ) )
End Sub