Submitted by jon.schmidt on Tue, 05/19/2020 - 09:08
Forums:
Does anyone have any experience with starting an NX session with program and then running a journal?
For example, I wonder if there are commands that could follow ugraf.exe that would instruct it to open a part.
Then there is the problem of how to start running the journal.
Any ideas?
Best Regards
Jon Schmidt
re: run journal
There is a utility that ships with NX called "run_journal". It will take a path to a journal file and any arguments for the journal then start NX in batch mode (no visible GUI) and run your journal. I'd suggest running this utility from the NX command prompt so that the environment is correctly set for NX to run. If you search on "run_journal" on this site you will find some examples.
That is fantastic, thanks a
That is fantastic, thanks a million!
Best Regards
Jon Schmidt
Thanks to your help I have
Thanks to your help I have successfully run a journal from a command line using:
run_journal C:\Journals\journal.vb -args C:\Journals\journal_test.prt
Where a folder named journal contains:
A journal named journal.vb
A part named journal_test.prt
As one other post mentioned, it was necessary to save the part immediately after opening it while recording the journal to avoid errors when running the journal from a command line.
Note the journal would run without the save if it were to be executed from within NX.
Best Regards
Jon Schmidt
My next challenge, is running
My next challenge, is running the command line from a VB.net Windows Forms application.
I am a few hours into experiments using a method called "process".
I have it working for things like ipconfig -all but not for:
run_journal C:\Journals\journal.vb -args C:\Journals\journal_test.prt
Does anyone have any experience with running that from a Windows Forms application?
I am trying to do it in a way that can collect the response from the console application.
Best Regards
Jon Schmidt
re: run_journal
In my previous reply, I suggested starting run_journal from the NX command prompt. When you start the NX command prompt, it calls "ugiicmd.bat" which sets up the environment for NX to run. You might need to call this .bat file or replicate what it does in your code.
If I remember correctly, any calls to "listingWindow.WriteLine" in your journal when running in batch mode will be output to the stdout stream. You can read the stdout stream in your code to get a response from the journal. The code in the following link has an example of reading the stdout stream. It runs the ug_convert_part.exe and looks for the "success" message in the stdout stream.
http://nxjournaling.com/content/convert-part-units