Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: API to list out the grid point forces of a few nodes

Builder
Builder

Right!, I would like to be able to select them using the dialog window.

 

Thanks for your help.

Re: API to list out the grid point forces of a few nodes

Legend
Legend

Dear Aero1,

 

 

I've updated the tool. Now you can select output sets and it also prints rx, ry, rz - applied moments. 

 

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

    'vectors for applied gp forces  T1, T2, T3
    Dim appliedGPForceX ,appliedGPForceY, appliedGPForceZ As Integer
    appliedGPForceX = 172
    appliedGPForceY = 173
    appliedGPForceZ = 174

     'vectors for applied gp moments  T1, T2, T3
    Dim appliedGPMomentX ,appliedGPMomentY, appliedGPMomentZ As Integer
    appliedGPMomentX = 176
    appliedGPMomentY = 177
    appliedGPMomentZ = 178

    Dim outputSetIds As femap.Set
    Set outputSetIds = App.feSet
    If App.feSelectOutputSets("Select Output Sets for Grid Point Forces", outputSetIds) = FE_CANCEL Then End
      Dim setIds As Variant
      Dim setCount As Long
    outputSetIds.GetArray(setCount, setIds)

    'exit if zero output sets were selected
    If setCount = 0 Then End

    'select nodes to display results
    Dim nodeSet As femap.Set
    Set nodeSet = App.feSet
    If nodeSet.Select(FT_NODE,True, "Select Nodes" ) = FE_CANCEL Then End
    Dim nodeIds As Variant
    Dim count As Long
    nodeSet.GetArray(count, nodeIds)

    Dim Output1 As femap.Output
    Set Output1 = App.feOutput
    'use output set with Id = 19

    Dim outputSet1 As femap.OutputSet
    Set outputSet1 = App.feOutputSet

    For j = 0 To setCount - 1
        outputSet1.Get(setIds(i))
        App.feAppMessage(FCM_NORMAL, "Output Set = " & setIds(j) & ".." & outputSet1.title)

        Output1.setID =setIds(j)
        For i = 0 To count -1

            Dim x As Double, y As Double, z As Double
            Output1.Get(appliedGPForceX)
            x = Output1.Value(nodeIds(i))
            Output1.Get(appliedGPForceY)
            y = Output1.Value(nodeIds(i))
            Output1.Get(appliedGPForceZ)
            z = Output1.Value(nodeIds(i))

            Dim rx As Double, ry As Double, rz As Double
            Output1.Get(appliedGPMomentX)
            rx = Output1.Value(nodeIds(i))
            Output1.Get(appliedGPMomentY)
            ry = Output1.Value(nodeIds(i))
            Output1.Get(appliedGPMomentZ)
            rz = Output1.Value(nodeIds(i))

            Dim message As String
            message = "Node ID = " & nodeIds(i) & "   Tx = " & x & "    Ty = " & y & "  Tz =  " & z
            message = message & "  Rx =  " & rx & "   Ry =  " & ry & "   Rz = " & rz

             App.feAppMessage(FCM_NORMAL, message)

            Next

            App.feAppMessage(FCM_NORMAL, "***********************************************")

    Next



End Sub

 

Yarko

Re: API to list out the grid point forces of a few nodes

Builder
Builder
Thank you very much for your work, you did a very well job!.

Re: API to list out the grid point forces of a few nodes

Builder
Builder

Yarko, Is it easy to develope this tool so it can import the node ID's from an excel file and then export the results back into the same excel file?

Re: API to list out the grid point forces of a few nodes

Builder
Builder

BTW, I noticed that for nodes 600100-600102 (for instance), the results are all zero values (please see attached snapshots, as well as the DAT file), do you know how I can fix this issue?

 

Thanks,

Aero1

Re: API to list out the grid point forces of a few nodes

Legend
Legend

Dear Aero1,

 

 

It is not that hard to read/write data to excel. Here you can find example how to work with excel:

https://community.plm.automation.siemens.com/t5/Femap-Discussion-Forum/API-to-read-data-from-a-text-...

 

Yarko