Showing results for 
Search instead for 
Did you mean: 

API - Get reaction force

Valued Contributor
Valued Contributor



I'm trying to write a macro that returns the force (components) of a nodal constraint.

So far I managed to obtain the nodes:


Sub Main
	Dim cList As String
	cList = ""
    Dim App As femap.model
    Set App = feFemap()
	Dim feBCNode As femap.BCNode
	Set feBCNode = App.feBCNode

	With myRange
		While feBCNode.Next
			If feBCNode.setID = App.Info_ActiveID( FT_BC_DIR ) Then
				cList = cList & Str$(feBCNode.ID ) & vbCrLf
			End If
    End With
    				MsgBox(cList) 'here they are!
End Sub

according to the APi.pdf I can use the "FABC_ND_REACTION_FORCE" which is a part of the Public Enum zAnalysisOutputRequest. Odd thing is that I can't find this Enum in the object browser in the API environment. Have they removed it because of the freebody functionality?

If so: how do I obtain the force components of a node (programmatically) using the API?

I can't seem to find a single example about using the free body.


I'm using FEMAP 11.2.2


With kind regards,





Maarten Elings | Mechanical Engineer

Re: API - Get reaction force



I'm not the biggest freebody user, but if you're just looking for node constraint reaction forces (SPCForces for NASTRAN) you can do without: it's an output like any other, if I'm not mistaken the vector ID is 52,53,54,55.


So I would do the following:

- in your run ask for SPCForces on the nodes you are interested

- run and load

- get the SPCforces, either without an API (List > Output > Query for example...) or through the API.


In the API you'll need the Output object (checkout the help on this object, its use is very straightforward). No need for freebody object or BCnode object.

This is one of many ways to do this.


Re: API - Get reaction force

Siemens Phenom Siemens Phenom
Siemens Phenom

I've attached the Femap 101 training class exercise for Freebody diagrams along with the model file used for this.

Best Regards,
Chip Fricke
Principal Applications Engineer - Femap Product Development

Re: API - Get reaction force

Valued Contributor
Valued Contributor

Thank you for your reply.


getting the nodal constraint force is a possible solution for this situation.

But I reckon we eventually do want the ability to get the nodal force of any given node (not just the nodal constraints).


Using the API.pdf I've succesfully written the code to obtain the force of a given node using the freebody tool.

As there is such a lack of examples/information regarding free bodies, here is my code:

Sub Main
    'Obtain the forces in a specific node (NodalID)
    'the values are returned in excel

Dim App As femap.model
Set App = feFemap()

Dim viewID As Long

Dim feView As femap.View
Set feView = App.feView

Dim dValues As Variant

Dim appExcel As Excel.Application
Set appExcel =  New Excel.Application

Dim wbkReport As Excel.Workbook
Dim wksReport As Excel.Worksheet
Set wbkReport = appExcel.Workbooks.Add
Set wksReport = wbkReport.Worksheets(1)

NodalID = 143 'this is the node from which we want the output

Dim ndSet As femap.Set
Set ndSet = App.feSet
rc = ndSet.Add(NodalID)

Dim fb As femap.Freebody
Set fb = App.feFreebody

rc = App.feAppGetActiveView( viewID )
rc = feView.Get(viewID)

fb.title="Nodal Freebody" 
fb.CSys = 1 'set Coordinate system
fb.UseNodalOuputCS = True

fb.SetNodes(False, ndSet.ID)

fbID = fb.NextEmptyID

wksReport.Cells( 1, 1 ) ="Node ID"
wksReport.Cells( 1, 2 ) ="Fx"
wksReport.Cells( 1, 3 ) ="Fy"
wksReport.Cells( 1, 4 ) ="Fz"
wksReport.Cells( 1, 5 ) ="Mx"
wksReport.Cells( 1, 6 ) ="My"
wksReport.Cells( 1, 7 ) ="Mz"

wksReport.Cells( 2, 1 ) =NodalID
wksReport.Cells( 2, 2 ) =dValues(0)
wksReport.Cells( 2, 3 ) =dValues(1)
wksReport.Cells( 2, 4 ) =dValues(2)
wksReport.Cells( 2, 5 ) =dValues(3)
wksReport.Cells( 2, 6 ) =dValues(4)
wksReport.Cells( 2, 7 ) =dValues(5)

appExcel.Visible = True
rc = App.feViewRegenerate( 0 ) 'regenerate FEMAP
End Sub
Maarten Elings | Mechanical Engineer