zanestoy
Structural
- Apr 25, 2012
- 10
I'm new to this forum, and new to using the FEMAP API. I am having a few issues with creating a data table and populating it with the output for a selected set of elements, vectors, and outputs. I am trying to select the elements by selecting a group, and would like to loop through a selection of the groups. Is this possible, can someone take a look at my code and help/ point me in the right direction?
Here is my code thus far:
Sub Main
'Dimension the FEMAP Application Object
Dim App As femap.model
Set App = feFemap()
'Dimension Some Variables
Dim GI As Integer
Dim e As Variant
Dim s As femap.Set
Dim n As Integer
Dim m As Integer
Dim dt As femap.DataTable
Dim FileName As String
Dim g As femap.Set 'This should be a range of groups, i.e. Group 1, Group 2, Group 3
'Set Those Same Variables
Set s = App.feSet
Set e = App.feSet
Set g = App.feSet
Set dt = App.feDataTable 'Create a Data Table Object
rc = dt.Lock(False) 'Unlock the Data Table
If s.SelectMultiID(FT_OUT_CASE,1,"Select OutputSets") = FE_CANCEL Then End 'Select Output Sets Interested In
n = 1 'Set Initial Group Index, Possibly should be 0???
GI = g.Count()
Do While n <= GI 'Loop through all selected groups
m=1 'Set Initial Output Index
rc = dt.Clear() 'Clear Data Table
If e.Select(FT_ELEM,True, "Select Elements" ) = FE_CANCEL Then End 'Select All Elements in Group n
rc = dt.AddColumn(False,False,FT_ELEM, ) 'Do I need to Add Columns to populate data table
Do While m <= GI 'Loop Through All Output Sets, Vectors should be constant for each Output Set and Group, Is there a better way to do this
rc = dt.AddOutput(s,s,nC) 'Add Output to the Data Table
m = m + 1 'Step to Next Output Set
Loop
FileName=FilePath&"\Zone "&n&"\FEMAP_Output.txt" 'Look up File Path of Model and append path with Folder Name of Group, Folders previously defined outside of FEMAP
rc = Save(True,FileName,0) 'Save the Data Table to FileName
n = n + 1 'Step to Next Group
Loop
End Sub
Any help would be greatly appreciated.
Zane