cancel
Showing results for 
Search instead for 
Did you mean: 

saving 'info window' data to a txt file using vba?

Phenom
Phenom

To all

 

Does anyone know if there is a way of accessing/saving the data contained in a 'information window'?

 

Here is the problem.

1.0 In NX.CAE simulation file (.sim), one can request 'Peak' or 'RMS' values (for a given a set of elements). One then gets a new results, usaully called 'Contour Results - Peak Results 1' containing 3 results (Peak Element Force_X,Peak Element Force_Y,Peak Element Force_z if one has requested element force)

2. one can then right-click on one of the results, say Peak Element Force_X, and display an 'informatin window' containg the peak vlaues for the elements processed. The data can then be saved to a text file.

 

See attached picture

 

I'd like to automate the 'right-click/save-as' steps. is this possible at all? Recording the steps gives a "blank" journal.

 

Loop could be something like (very high level!!)

 

Dim myRSEventName as String = "MyEvent1"

Dim theInfoData as String

 

For i =1 to 3

  if i=1 then myresult="Peak Element Force_X"

 if i=2 then myresult="Peak Element Force_Y"

 if i=3 then myresutl="Peak Element Force_Z"

 theInfoData=getInfoWindow(myRSEventName,myresult)

 FileName=myRSEventName & myresult & ".txt"

CreateTextfile(FileName,theInfoData)

Next

 

Thanks

 

Regards

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

Re: saving 'info window' data to a txt file using vba?

Siemens Phenom Siemens Phenom
Siemens Phenom

 

You will need to use a wrapped function from Open C in your VB code to do this.

 

The original function is called UF_UI_save_listing_window(filname as string).

 

Be sure you add this at the beginning of your code:

 

Imports NXOpen.UF

 

Then you will need to get the UFSession object:

 

    Dim ufs As UFSession = UFSession.GetUFSession()

 

Then when you have written everything you want to the window, call the function like this:

 

    ufs.Ui.SaveListingWindow("C:\myFolder\MyOutputFile.txt")

 

 

 

Re: saving 'info window' data to a txt file using vba?

Phenom
Phenom

Alternatively, you can direct the output of the listing window to a file by using the .SelectDevice method and choosing the .File or .FileAndWindow type. An example can be found at:

http://nxjournaling.com/content/write-text-file

Re: saving 'info window' data to a txt file using vba?

Phenom
Phenom

Thanks for the input/suggestion. Just taken a copy of the journal. I need now to find the keywor(s) to display the info related to the result I want to process. Probably not an easy thing given the documentation!

 

Regards

 

JXB

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

Re: saving 'info window' data to a txt file using vba?

Phenom
Phenom

Thanks will look into the proposed idea in line/parallele with the other suggestion made

 

Thanks

 

Regards

 

JXB

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

Re: saving 'info window' data to a txt file using vba?

Phenom
Phenom

Thanks for the pointer.

 

How does one then "automatically" open (and close) the LW to display the "List Results" (as shown in the attached picture in my original post) which is displayed in the Info Window ? My understanding so far is that the suggested function (and the method in the link provided by cowski1) will output what is in the LW once it it open.

 

Thanks

 

Regards

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

Re: saving 'info window' data to a txt file using vba?

Esteemed Contributor
Esteemed Contributor

The ListingWindow object has methods for open and close, just search the NXOpen .NET programmers reference.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: saving 'info window' data to a txt file using vba?

Phenom
Phenom

Thanks for that Stefan but the problem does not "really" relates to open/closing the LW (I use theLW.Open() and if required theLW.Close() options) but the "commands" to open and display the information window which one access "manually" by right-clicking on the result desired and select "List results" (see picture attached to original post). If one records the action in a journal one gets nothing! I suspect the right-click action calls a NX function which "gathers" the data (see below example for typical data displayed in the info window) and then write it to the info window. What I am trying to ascertian is if whether or not the following user actions

 1. Right-click seelct "List Results"

 2. Save info window to a text file

can be automatted

 

Thanks

 

Tegards

 

 

Typical results

 

============================================================
Information listing created by :  joe.bloggs
Date                           :  01/01/2015 12:00:00
Current work part              :  D:\aa\bb\cc\myfemodel.sim
Node name                      :  aabbcc123456789
============================================================

AFU File Name: D:\aa\bb\cc\myfemodel-respsim1-shock1.afu
Record Number: 1
Record Name:   1_(2643E_218931_AX)
Function Type: Time
    Min, Max = -138953, 15933
    RMS      = 24202.6
    Mean     = 9.573
    Standard Deviation = 24203.6
Spacing:       Even
Data Format:   Real Only
Abscissa Type: Time (sec)
Ordinate Type: Force (mN)

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

Re: saving 'info window' data to a txt file using vba?

Esteemed Contributor
Esteemed Contributor

If the object has a results method, you could create your own list output.

 

I have never seen any NX object that has a method to duplicate the information context menu entry for instance, you always have to build one of your own.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: saving 'info window' data to a txt file using vba?

Siemens Phenom Siemens Phenom
Siemens Phenom

 

If your object of interest inherits from NXObject, please see NXOpen -> Information -> DisplayObjectsDetails().  It is documented to do this:

 

"Displays information about geometric objects in the ListingWindow . If we call this method externally without UI, it displays the information on standard output device. The listing window output can be sent to the Information window or to a file, or to both. See ListingWindow.SelectDevice for more information."
 
We have found a small number of cases where it was not possible to get the info someone wanted for a given object with any other method, so we direct the output to a temporary file, then call this method, close the file, and write a routine to parse the temp file for a known keyword to get the info.  It isn't particularly elegant, but it does the job.