Showing results for 
Search instead for 
Did you mean: 

Unloading Result function in Postprocessing.


Hello all,


I am trying to unload the results in post processing so that i can move the corresponding .op2 and .bun files.


If the resultfiles are loaded in post processing it needs to be unloaded in order to move.


I have created an unload function as follows but it is dependent on the solution name. Is there a way to get all CAE.SolutionResult in the current session. I could not find this in the documentation.


To unload results, theSession.ResultManager.DeleteResult(solutionResult) needs to be executed.

''Delete all results
For Each sol In sim_sol_names
solutionResult = CType(resultManager.FindObject("SolutionResult[" + sim_rev + "_" + sol + "]"), NXOpen.CAE.SolutionResult)
Catch err1 As System.Exception
Continue For
End Try








Re: Unloading Result function in Postprocessing.

Siemens Phenom Siemens Phenom
Siemens Phenom

There is not currently a way to get a collection of all result objects loaded in the session.


This would be a good enhancement request.



You could get results for all active Postviews by looping through an array of Postview IDs (NXOpen.CAE.Post.GetPostviewIds()) and getting the result for each postview (NXOpen.CAE.Post.GetResultForPostview())

Re: Unloading Result function in Postprocessing.


Hello Jim


Thank you for your response.


I had tried that option to get result from post views.  But when there are multiple solutions and not all solutions have post views it causes problem in my case.


Dim ids() As Integer = theSession.Post.GetPostviewIds

Dim id
If ids.Length > 0 Or ids IsNot Nothing Then
For Each id In ids

   'theSession.Post.GetResultForPostview(id, result, resulparam)

End If


For now i am using Resultmanager.Findobject("Journal Identifier") method to go ahead. But i wish there was a resultmanager.getsolutionresults() method.

Re: Unloading Result function in Postprocessing.

Siemens Phenom Siemens Phenom
Siemens Phenom

Please contact GTAC to submit an enhancement request.

Re: Unloading Result function in Postprocessing.

Valued Contributor
Valued Contributor



I once made a function called GetAllResults. I think the code could help you further to see how to access solutions, solutionresults, etc..

    Function GetAllResults(ByVal SelectedresultType As String) As String()
        Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
        Dim theLW As NXOpen.ListingWindow = theSession.ListingWindow()
        Dim workSimPart As NXOpen.CAE.SimPart = CType(theSession.Parts.BaseWork, NXOpen.CAE.SimPart)

        Dim simSimulation1 As CAE.SimSimulation = CType(workSimPart.FindObject("Simulation"), CAE.SimSimulation)

        ' The SimSolutionCollection contains all solutions.
        Dim SimSolution As CAE.SimSolutionCollection = simSimulation1.Solutions
        'The following function creates an array, so they can all be individually called.
        Dim SimSolutions() As CAE.SimSolution = SimSolution.ToArray

        Dim AllResultNames = New List(Of String) From {"Dummy"}

        Dim SolutionResult As NXOpen.CAE.SolutionResult
        Dim BaseLoadCases() As CAE.BaseLoadcase
        Dim MyLoadcase As CAE.Loadcase
        Dim Iterations() As CAE.BaseIteration
        Dim MyIteration As CAE.Iteration
        Dim Resulttypes() As CAE.BaseResultType
        Dim MyResulttype As CAE.ResultType
        Dim myString As String
        Dim counter As Integer = 0

        For ii As Integer = 0 To SimSolutions.Length - 1
            SolutionResult = theSession.ResultManager.CreateSolutionResult(SimSolutions(ii))
            BaseLoadCases = SolutionResult.GetLoadcases()
            For jj As Integer = 0 To BaseLoadCases.Length - 1
                MyLoadcase = CType(BaseLoadCases(jj), CAE.Loadcase)
                Iterations = MyLoadcase.GetIterations()
                For kk As Integer = 0 To Iterations.Length - 1
                    MyIteration = CType(Iterations(kk), CAE.Iteration)
                    Resulttypes = MyIteration.GetResultTypes()
                    For ll As Integer = 0 To Resulttypes.Length - 1
                        MyResulttype = CType(Resulttypes(ll), CAE.ResultType)
                        If MyResulttype.UserName.Equals(SelectedresultType) Then
                            myString = SolutionResult.Name + ";  " + MyLoadcase.Name + ";  " + MyIteration.Name + ";  " + MyResulttype.UserName
                            If counter = 0 Then
                                AllResultNames(0) = myString
                                counter = counter + 1
                            End If
                        End If

        Dim toReturn As String() = AllResultNames.ToArray

        Return toReturn
    End Function

Hope this is of any help to you