'Global variables Dim App As femap.model Dim fName As String Dim usedSetIDs As femap.Set Sub Main 'Dim App as femap.model Set App = feFemap() Dim grpSet As femap.Set Set grpSet = App.feSet Dim ndSet As femap.Set Set ndSet = App.feSet Set usedSetIDs = App.feSet Dim grp As femap.group Set grp = App.feGroup Dim grpID As Long Dim grpTitle As String saveFile() If fName = "" Then End If grpSet.SelectMultiIDV2(FT_GROUP, 1, "Select Groups to Write as SET1") <> FE_OK Then End While grpSet.Next grpID = grpSet.CurrentID grp.Get(grpID) grpTitle = grp.title ndSet.clear( ) grp.GetList(FGR_NODE, ndSet.ID) If ndSet.Count > 0 Then SET1(ndSet, grpID, grpTitle + " - Nodes", True) Else App.feAppMessage(FCM_ERROR, "Group" + Str$(grpID) + " does not contain nodes") End If Wend End Sub Sub saveFile( ) Set App = feFemap() If App.feFileGetName("Enter Text File Name", "txt", "*.txt", False, fName) <> FE_OK Then End End Sub Sub writeFile(SETwrite As String ) Open fName For Append As #1 Print #1, SETwrite Close #1 End Sub Sub SET1(entSet As femap.Set, grpID As Long, grpTitle As String, ndElem As Boolean ) Set App = feFemap() Dim SET1card As String Dim SID As String Dim DES As String Dim gridID As String Dim gridID2 As String Dim position As Long Dim maxID As Long Dim startID As Long Dim prevID As Long Dim stopID As Long 'Making the comment for the group title---------------------------- SET1card = "$SET1" + Str$(grpID) + " " + grpTitle + vbCrLf 'Baseline SET3 card------------- SET1card = SET1card + "SET1 " position = 1 If usedSetIDs.IsAdded(grpID) Then 'If the SID is already used jump to a new ID. grpID = usedSetIDs.NextEmptyAfter(grpID) End If usedSetIDs.Add(grpID) SID = CStr(grpID) SET1card = SET1card + Space(8-Len(SID)) + SID position += 1 If ndElem = True Then DES = "GRID" Else DES = "ELEM" End If SET1card = SET1card + Space(8 - Len(DES)) + DES position += 1 maxID = entSet.Last entSet.Reset( ) prevID = -1 startID = entSet.First( ) While startID > 0 And startID <= maxID 'entSet.Next If position = 9 Then SET1card = SET1card + vbCrLf + Space(8) position = 1 End If prevID = startID 'entSet.CurrentID Next_Node: stopID = entSet.Next( ) If stopID = prevID+1 Then prevID = stopID GoTo Next_Node End If If prevID = startID Then 'write single gridID gridID = CStr(startID) SET1card = SET1card + Space(8-Len(gridID)) + gridID position += 1 Else 'write THRU ID If position > 6 Then SET1card = SET1card + vbCrLf + Space(8) position = 1 End If gridID = CStr(startID) gridID2 = CStr(prevID) SET1card = SET1card + Space(8-Len(gridID)) + gridID + Space(8-Len("THRU")) + "THRU" + Space(8-Len(gridID2)) + gridID2 position +=3 End If startID = stopID Wend writeFile(SET1card) End Sub