' This API finds plate elements with Jacobians greater then a threshold, ' then uses Group Operations Generate Solids to collect all the geometry associated ' with the poor quality mesh. Sub Main Dim App As femap.model Set App = feFemap() Dim BadElem As femap.Elem Set BadElem = App.feElem Dim ElemID As Long Dim elSet As femap.Set Set elSet = App.feSet ' These define an element object , and a set to collect element object ' elSet is later used to select all elements of a type. Dim JacobSet As femap.Set Set JacobSet = App.feSet ' This is a set of plate elements which have Jacobians above the threshold amount. Dim ElQual As femap.ElementQuality Set ElQual = App.feElementQuality Dim JVal As Double JVal = 0.9 Dim SurfSet As femap.Set Set SurfSet = App.feSet SurfSet.Clear() ' These are the surfaces belonging to the bad elements. Dim SolidSet As femap.Set Set SolidSet = App.feSet SolidSet.Clear() Dim Count As Long Count = 0 ' This is a cumulative counter to find how many nodes satisfy the criteria rc = elSet.Clear() ' Make sure the element set is clear. ' rc simply represents a return code, sometimes used to test success of operation. rc=elSet.AddRule(17,FGD_ELEM_BYTYPE) ' Populate the element set with elements by Type 17 = plate ' NOTE This API COULD EASILY BE CHANGED to OTHER ELEMENT TYPES. If rc <> FE_OK Then Exit Sub End If ' If elements are successfully added to the element set. rc = App.feGetReal("Specify the threshold element Jacobian",1e-9,1e9,JVal) If rc <> FE_OK Then Exit Sub End If ElQual.JacobianOn = True ElQual.JacobianLimit=JVal Set JacobSet = ElQual.CheckQuality(elSet.ID,False,False) rc = App.feViewShow(FT_ELEM,JacobSet.ID) ElemID = JacobSet.First() While ElemID > 0 BadElem.Get(ElemID) SurfSet.Add(BadElem.geomID) ElemID = JacobSet.Next() Wend rc = SolidSet.AddSetRule(SurfSet.ID,FGD_SOLID_BYSURFACE) If SolidSet.Count < 1 Then Exit Sub End If App.feViewShow(FT_SOLID, SolidSet.ID) rc = App.feAppMessageBox(2, "Auto Add Sheet Solids of poor elements to new group?") If rc = -1 Then rc = App.feGroupGenSolid(SolidSet.ID) End If App.feViewShow(FT_SURFACE,SurfSet.ID) SurfSet.Select(FT_SURFACE,False, "PRESS OK to ensure this list can be retrived using Previous." ) End Sub