Showing results for 
Search instead for 
Did you mean: 

use of function AskNMinMaxLocation()


To all


Query is related to a previous similar query. See link at end of the query. I have found this function in the doc and it might be doing what I am after i.e. extract the top 10 max value. I am however unsure on how to use it


Public Sub AskNMinMaxLocation ( _
	numExtreme As Integer, _
	<OutAttribute> ByRef location As Result.Location, _
	<OutAttribute> ByRef min As Double(), _
	<OutAttribute> ByRef max As Double(), _
	<OutAttribute> ByRef minID As Integer(), _
	<OutAttribute> ByRef minSubID As Integer(), _
	<OutAttribute> ByRef maxID As Integer(), _
	<OutAttribute> ByRef maxSubID As Integer() _

CAE.Result.Location will return where the result is defined. If it is an element-nodal result subIDs will be filled with node index and IDs will contain element index. For all other cases subIDs will be 0.


The question is the following

If one knows/has 

  • a list of FEElement
  • establised the target solution and the iteration (the normal modes of a SOL103 reps. sim)
  • numExtreme = 10

how does one use the function AskNMinMaxLocation() to extract the VonMises stress?





related query:

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: use of function AskNMinMaxLocation()


DISCLAIMER: I have never programmed anything with CAE in NX :-)


but I think you have to go this way:


you need your session object (e.g. theSession) I think you know how to get it.


with "theSession.ResultManager.CreateResultAccess( Result result, ResultParameters parameters) You will get an Object of the type "ResultAccess"


An this object has the function "AskNMinMaxLocation"


Do you know how to call this function?


you need something like:


Dim numExtreme As Integer = 10

Dim min As Double()

Dim max As Double()

Dim minID As Integer()

Dim minSubID As Integer()

Dim maxID As Integer()

Dim maxSubID As Integer()


yourResultAccessObject.AskNMinMaxLocation(numExtreme, min, max, minID, minSubID,maxID, maxSubID)


and then you have the values filled with your data.




Re: use of function AskNMinMaxLocation()


Thanks for that josh. Mus appreciated. Seems obvious now that you point this out! Will try a bit later


I have already set up the result using


Dim results As CAE.Result = GetResults(solution)

 and I have a function (not fully tested yet) to get the result access


Dim solResultsAccess As CAE.ResultAccess = 
theResultManager.CreateResultAccess(results, resultParameter)

Return solResultsAccess


 What I am not sure if what to set up the access only a specific list of elements. I am currently extracting the Von Mises stress result from a solution for a specific Load Case and iteration. I am assuming that the VM stress result returned contain the stress value of all the elements. I am only interested in a sub-set of these elements


Dim resultType As CAE.Result.Type
        resultType.Quantity = CAE.Result.Quantity.VonMisesStress
        resultType.Location = CAE.Result.Location.Nodal
        resultType.Section = CAE.Result.Section.NotApplicable


Return solResultsAccess



Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: use of function AskNMinMaxLocation()


Was just about to test the suggestion when I realised that one of the output is "missing". The function AskNMinMaxLocation() requires


<OutAttribute>  ByRef location As Result.Location

and cannot quite make sense of what NX wants. I have tried the following but it fails


Dim results As CAE.Result = GetResults(theTargetSolution)
Dim theAccessedResult As CAE.ResultAccess = GetResultAccess(results,0,iIterID,1.0)
Dim iTopNValue As Integer =10		
Dim location As results.Location.Nodal
Dim min, max As Double()
Dim minID,minSubID,maxID,maxSubID As Integer()
theAccessedResult.AskNMinMaxLocation(iTopNValue,location,min, max, minID, minSubID,maxID,maxSubID)


Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: use of function AskNMinMaxLocation()

Honored Contributor
Honored Contributor

For the location variable try this:

Dim location As CAE.Result.Location = CAE.Result.Location.Nodal

Re: use of function AskNMinMaxLocation()


Thanks cowski1. Looks like it is working. Test program is failing a bit later but that's another problem!

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)