I am looking to programmatically extract the nodal stress data at every node. I know the output set I am looking for as well as the output vector.
Dim App As femap.model
Set App = feFemap()
'Output Set object
Dim curOutputSet As femap.OutputSet
Set curOutputSet = App.feOutputSet
'Output Vector object
Dim curOutputVect As femap.Output
Set curOutputVect = App.feOutput
Dim theOutputSetID As Long
theOutputSetID = 16
Dim theOutputVectID As Long
theOutputVectID = 60031
'Get output set and output vector
curOutputSet.Get(theOutputSetID) curOutputVect.GetFromSet(curOutputSet.ID, theOutputVectorID)
The data received inside curOutputVect is for the elements. I can see that curOutputVect.values has the elemental stresses at the indices matching the Element IDs and that there are object methods like GetOutputListAtSet() that can get the same data. However, I would like to extract the averaged nodal stresses for the nodes of these elements, and unless I am missing something obvious, they don’t seem to be available through this object. I can get to these values with the GUI into the Data Table using these steps:
View->Select…->Deformed and Contour Data…
Select Contour Options…
In Contour Type, select “Nodal” radio button
In Data Conversion, select “Average”
(Make sure Data Table is open and unlocked)
Now List->Output->Contoured Results to Data Table… will write out the values to the Data Table:
Is there a way I can get these values through the API, or replicate the process above programmatically and extract directly from the generated Data Table?
Solved! Go to Solution.
The API output object does not support conversin between nodal and elemental locations. There are however at least two ways to accomplish this. You can use the application level feOutputProcessConvert( ) method to create new vectors at the desired location (see API manual 184.108.40.206). Or, you can use the Results Browsing object and use the AddConversionColumn( ) method (see API manual 220.127.116.11). For general querying of results I would recommend using the Results Browing object. If you need to do additional computations feOutputProcessConvert( ) might be more appropriate
This is exactly what I am looking for! Thank you so much.
I went with the Results Browsing object.
Resulting code (for future interest of thread):
Sub Main Dim App As femap.model Set App = feFemap() Dim getNodalData As femap.Results Set getNodalData = App.feResults Dim currentView As femap.View Set currentView = App.feView Dim curOutputSet As femap.OutputSet Set curOutputSet = App.feOutputSet Dim curOutputVect As femap.Output Set curOutputVect = App.feOutput Dim grpAllNodes As femap.Group Set grpAllNodes = App.feGroup Dim allElems As femap.Set Set allElems = App.feSet Dim allNodes As femap.Set Set allNodes = App.feSet Dim columnIndex As Long Dim nIDsArr As Variant Dim nValsArr As Variant Dim numCols As Long Dim activeViewID As Long Dim rc As femap.zReturnCode 'get a group of elements from the user for getting node stress data rc = grpAllNodes.SelectID("Select group of elements for node stresses") If Not (rc = femap.zReturnCode.FE_OK) Then Exit Sub End If 'get current view (to define the output set and output vector) App.feAppGetActiveView(activeViewID) currentView.Get(activeViewID) 'get elements from group allElems.AddGroup(FT_ELEM, grpAllNodes.ID) 'get nodes from elements allNodes.AddSetRule(allElems.ID, FGD_NODE_ONELEM) 'get current output set curOutputSet.Get(currentView.OutputSet) 'Get current output vector curOutputVect.GetFromSet(curOutputSet.ID, currentView.ContourData) 'consider only the elements in a particular group rc = getNodalData.DataNeeded(FT_ELEM, allElems.ID) 'convert to nodal stress rc = getNodalData.AddConversionColumn(curOutputSet.ID, curOutputVect.ID, femap.zResultsConvert.FRC_AVG, columnIndex ) 'populate this column with data rc = getNodalData.Populate() 'get data from the column populated rc = getNodalData.GetColumn(columnIndex, nIDsArr, nValsArr) 'Now nValsArr holds the data End Sub