Showing results for 
Search instead for 
Do you mean 

Access to data of graphs created in PostView

Hi everyone,


I am very new to NXOpen and I hope this is the right place to post this:

I want to run an NX journal in batch mode to access stress values of an FE analysis (done in advanced simulation) along a given path and write the data to an external file (e.g. csv). I use NX9.


So far I have found out how to create a path (by defining coordinates) and how to get the respective graph. This is the code snippet without all the loading and initialization stuff:

Dim points1(5) As Double
points1(0) = 5.0
points1(1) = 0.0
points1(2) = 1.0
points1(3) = 100
points1(4) = 0.0
points1(5) = 5.0
Dim pathId1 As Integer
pathId1 = theSession.Post.CreatePathFromPoints(1, "Path 1", points1, 0)

Dim postGraphAlongPathBuilder1 As CAE.PostGraphAlongPathBuilder
postGraphAlongPathBuilder1 = theSession.ResultManager.CreateGraphAlongPathBuilder(1)
postGraphAlongPathBuilder1.XaxisOption = CAE.PostGraphAlongPathBuilder.Xaxis.PathLength
postGraphAlongPathBuilder1.DefineByPathOption = True
postGraphAlongPathBuilder1.PathId = pathId1
postGraphAlongPathBuilder1.IncludeItersectionsOption = True
postGraphAlongPathBuilder1.NoDataOption = CAE.PostGraphBuilder.DataErrorHandling.UserValue
postGraphAlongPathBuilder1.UserData = 0.0
postGraphAlongPathBuilder1.NodalCombinationValue = CAE.PostGraphBuilder.NodalCombination.Average
postGraphAlongPathBuilder1.GraphTitle = "Stress - Element-NodalPath 1"
Dim nXObject1 As NXObject
nXObject1 = postGraphAlongPathBuilder1.Commit()

This already works fine in the NX GUI when I run the journal.


Is there any easy way to access the information (distance along path and requested stress value) that is given in the Listing Window when I use "right-cllick -> List" on the created graph, so I can export the data to a different file?


Best regards,



Re: Access to data of graphs created in PostView

I only know one way of doing it

you 'll need to output the data to a file rather than the listingwindow itself. Check the DeviceType option


theLW.SelectDevice(ListingWindow.DeviceType.Window, "")
theLW.SelectDevice(ListingWindow.DeviceType.File, sFileNameOutput)

once you have the data written to your specified file then you'll need to parse this file for the info you want

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

Re: Access to data of graphs created in PostView

Well, exporting the data is not the problem (I need the data in a separate file for parsing anyway).

But I have no idea how to access this information outside of the GUI. Recording my actions to a Journal when I access the information in the GUI does nothing and I couldn't find anything helpful in the reference guide that would give me an idea on how to access the actual data.

Re: Access to data of graphs created in PostView

not sure I understand but you cannot access the data "directly". By default the right-click  "list info" display the info in the listing window. If I recall recording this action wonlt give you anyting.  In your program you need to set the DeviceTpye to a file and then parse the data

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

Re: Access to data of graphs created in PostView

just a thought
Why not use the .Exportafu option? Once you have created your path, etc you should end up with a record in an afu file.

As far as I know you can't do much with a curve/graph in the post view because you don't know from which afu file the record come from

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

Re: Access to data of graphs created in PostView

[ Edited ]

Sorry, if didn't make myself clear enough.

What I mean by accessing the data directly is, getting the data points that are used to plot the graph as seen in the listing window:

Graph Title:   Stress - Element-NodalPath 1
Abscissa Label:Path Length 
 Abscissa Unit: mm
 Ordinate Label:Stress - Element-Nodal
 Ordinate Unit: N/mm^2(MPa)

Data Format:   Real Only

Record Name:   At Path ID 1
           X Value          Y Value

     1.    0.000000E+000    9.168579E+001
     2.    5.677890E-002    8.734012E+001
     3.    1.392358E-001    8.282309E+001
     4.    1.909994E-001    8.486837E+001
     5.    2.262526E-001    7.646778E+001
     6.    3.135331E-001    7.067844E+001
     7.    4.038294E-001    6.475407E+001
     8.    4.990768E-001    5.872158E+001
     9.    5.993963E-001    5.510352E+001
    10.    6.827652E-001    5.317160E+001

Changing the device type to a file won't help me, if I am not able to call this information from my program as well. All I get from recording the procedure is:

Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String) 

Dim theSession As Session = Session.GetSession()
Dim workSimPart As CAE.SimPart = CType(theSession.Parts.BaseWork, CAE.SimPart)

Dim displaySimPart As CAE.SimPart = CType(theSession.Parts.BaseDisplay, CAE.SimPart)

' ----------------------------------------------
'   Menu: Tools->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module

As you can see, there is nothing that indicates how to call the list of the data points.

Of course, I can do this step manually inside the GUI but this would destroy the entire purpose of my little program. Anyway, I appreciate your help but it seems like there is no easy way to do this and I'll have to do a workaround outside of NXOpen.



EDIT: Oh and about the afu file, it is binary isn't it? So I cannot actually do anything with it outside of NX?

EDIT2: formatting

Re: Access to data of graphs created in PostView

[ Edited ]

you can access the the afu  record data very easily and then manipulate it the way you want. AFU data can be accessed using functions in the NXOpen AfuManager class.

if you simply want to write a csv file of the data then use .ExportAfu



Dim myAfuData As CAE.AfuData
theSession.AfuManager.GetAfuData(sInTheAFUile, iInRecordID, myAfuData)
TheYValues = myAfuData.GetRealData(theXvalues)

For jj = 0 To theXvalues.Length - 1 'numPts
ThweLW.WriteLine("pair " jj.toString & ":" & theXvalues(jj).ToString & "," & theYvalues)
Next jj


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

Re: Access to data of graphs created in PostView

Oh this is interesting. I didn't know you could do that. From what I understand the GetAfuData function accesses the information of a given AFU file (after I have already created an AFU file), right? So, how would I go about creating the AFU file in the first place? I only know how to do this manually in the GUI (right click on the graph > save as afu) but this isn't journaled either.

Re: Access to data of graphs created in PostView

I can't remember top of my head where the record is created when using the "create data along path'. This should be "obvious". Either the record is created in a brand new afu file or in a file "related" to the solution/subcase selected. Either way once you know the AFU file name (with path) and the record ID is straighfoward to extract the data. The .GetAFUData provides access to the information of a Record in the AFU file specified



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

Re: Access to data of graphs created in PostView

Thanks for your help so far! But this does not seem obvious to me at all Smiley Sad

I have found the SaveAfuOption in the PostGraphAlongPathBuilder Class now. So I guess I have to switch that one to True but I am still confused as to which afu file this record will be saved to...

I cannot find any newly created AFU files on my local disk (neither in the directory where all the sim and fem files are stored nor in any temporary folders I have looked into)

Or do you refer to something entirely different than PostGraphAlongPathBuilder when you say "create data along path"?