Cancel
Showing results for 
Search instead for 
Did you mean: 

How to use runugpost.bat and .exe files?

Genius
Genius

Hi all,

 

I want to use runugpost.bat and .exe files for working with a time scheduling. For example if I want to postprocess a job on a specific day and hour. If I have different jobs 20 or more how could I schedule them with this files and Windows Task Scheduler?

runugpost-bat.jpg

runugpost-exe.jpg

9 REPLIES

Re: How to use runugpost.bat and .exe files?

Esteemed Contributor
Esteemed Contributor

You have to call ugpost.exe from task scheduler, best you call a batch file that sets the environment variables and executes ugpost.exe

 

An example batch file would look like this.

 

@echo off
echo.
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_BASE_DIR' ) do set UGII_CAM_BASE_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_AUXILIARY_DIR' ) do set UGII_CAM_AUXILIARY_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_RESOURCE_DIR' ) do set UGII_CAM_RESOURCE_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_POST_DIR' ) do set UGII_CAM_POST_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_CONFIG_DIR' ) do set UGII_CAM_CONFIG_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_CONFIG' ) do set UGII_CAM_CONFIG=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_POST_CONFIG_FILE' ) do set UGII_CAM_POST_CONFIG_FILE=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_USER_DEF_EVENT_DIR' ) do set UGII_CAM_USER_DEF_EVENT_DIR=%%~V

set PATH=%UGII_BASE_DIR%;%UGII_BASE_DIR%\UGII;%UGII_CAM_BASE_DIR%;%UGII_CAM_AUXILIARY_DIR%;%UGII_CAM_RESOURCE_DIR%;%UGII_CAM_POST_DIR%;%UGII_CAM_CONFIG_DIR%;%UGII_CAM_USER_DEF_EVENT_DIR%;%PATH%
echo.
"%UGII_CAM_AUXILIARY_DIR%\ugpost.exe" "MySetup.prt" -p "MyPostProcessorName" -v -o "MyOutputFileFullPath" -e "MyLogFileFullPath" -tp "MyProgramGroupName"
echo.

 

Run ugpost.exe without any arguments to get the usage message displayed.

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: NX12.0

How to Get the Most from Your Signature in the Community

Re: How to use runugpost.bat and .exe files?

Genius
Genius

Hi Stefan,

 

Thanks for your post, one question on .bat file,

 

" "MySetup.prt" -p "MyPostProcessorName" -v -o "MyOutputFileFullPath" -e "MyLogFileFullPath" -tp "MyProgramGroupName"

 

The routes are changed corrrectly like this ones?

 

For parts

"PATH=C:\Program Files\Siemens\NX 9.0\MACH\resource\postprocessor\hub1_sample.prt"

 

For postprocessors

"PATH=C:\Program Files\Siemens\NX 9.0\MACH\resource\postprocessor\deckel_maho_dmcxxu.tcl"

 

For output NC code

"PATH=D:\Projects\CAM\Workgroup2"

 

For output log file

"PATH=D:\Projects\CAM\Workgroup2"

 

For output program group name

"PATH=D:\Projects\CAM\Workgroup2"

 

Thanks.

Re: How to use runugpost.bat and .exe files?

Genius
Genius

Hi Stefan,

 

I have been doing some tests, I have customized this enviroment on my .bat file.But I have the following error, that the postprocessor dosen´t exit (I don't why is a default post). How is the postprocessor route configured on the .bat file properly?

I have attached my code and error windows.

 

@echo off
echo.
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_BASE_DIR' ) do set UGII_CAM_BASE_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_AUXILIARY_DIR' ) do set UGII_CAM_AUXILIARY_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_RESOURCE_DIR' ) do set UGII_CAM_RESOURCE_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_POST_DIR' ) do set UGII_CAM_POST_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_CONFIG_DIR' ) do set UGII_CAM_CONFIG_DIR=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_CONFIG' ) do set UGII_CAM_CONFIG=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_POST_CONFIG_FILE' ) do set UGII_CAM_POST_CONFIG_FILE=%%~V
for /f "tokens=*" %%V in ( '"%UGII_BASE_DIR%\UGII\env_print.exe" UGII_CAM_USER_DEF_EVENT_DIR' ) do set UGII_CAM_USER_DEF_EVENT_DIR=%%~V

set PATH=%UGII_BASE_DIR%;%UGII_BASE_DIR%\UGII;%UGII_CAM_BASE_DIR%;%UGII_CAM_AUXILIARY_DIR%;%UGII_CAM_RESOURCE_DIR%;%UGII_CAM_POST_DIR%;%UGII_CAM_CONFIG_DIR%;%UGII_CAM_USER_DEF_EVENT_DIR%;%PATH%
echo.
"%UGII_CAM_AUXILIARY_DIR%\ugpost.exe" "C:\Users\Desktop\CAM\001_PARTS\101657_001.prt" -p "D:\1000_DEMO_NX9\000_NX9_CUSTOM\NX90custom\NX90library\CAMresource\postprocessor\mill3ax.tcl" -v -o "program1.h" -e "post_name_1.error" -tp "NC_PROGRAM_1"

batch_error_1.jpg

Thanks in advance, Igor.

Re: How to use runugpost.bat and .exe files?

Esteemed Contributor
Esteemed Contributor

You only need the postprocessor name as it is listed in the template_posts.dat file or in the postprocessor dialog in NX, this is why I wrote "Name" not "FullPath".

 

Also specify the full path for the output and log file, or you end up searching your drive for the files.

 

This is an external utility which doesn't work like an interactive NX session.

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: NX12.0

How to Get the Most from Your Signature in the Community

Re: How to use runugpost.bat and .exe files?

Genius
Genius

Hi Stefan,

 

Thanks is running.

 

A pair of questions, which is the purpose of the -tp "NC_PROGRAM"? When I postprocess with .bat file just the NC code is generated and the .error file. But I don't understand the meaning of -tp "MyProgramGroupName".

 

-tp "MyProgramGroupName"

 

Second question is, if I want to postprocess different .prt files 10 for example with different postprocessadors 5 for example. How can I schedule them on the .bat file? just paste and rename the routes? I have added other code line, is this a correct way? The .bat files is running but I am not sure that is the proper way. Example below.

 

"%UGII_CAM_AUXILIARY_DIR%\ugpost.exe" "C:\Users\Desktop\CAM\101657_001.prt" -p "MILL_3_AXIS" -v -o "C:\Users\Desktop\CAM\003_BATCH MACROS\program1.h" -e "C:\Users\Desktop\CAM\003_BATCH MACROS\post_name_1.error" -tp "NC_PROGRAM"

"%UGII_CAM_AUXILIARY_DIR%\ugpost.exe" "C:\Users\Desktop\CAM\101657_001.prt" -p "MILL_4_AXIS" -v -o "C:\Users\Desktop\CAM\003_BATCH MACROS\program2.ptp" -e "C:\Users\Desktop\CAM\003_BATCH MACROS\post_name_1.error" -tp "NC_PROGRAM"
echo.

 

Thanks, Igor.

Re: How to use runugpost.bat and .exe files?

Esteemed Contributor
Esteemed Contributor

-tp is specifying the program group displayed in the ONT in the program view.

 

You can send the batch file command line arguments where you specify a file that contains lines with part file, postprocessor, program group and output file, as an example.

If you are not good at batch files, you should use something else, like VB script or such.

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: NX12.0

How to Get the Most from Your Signature in the Community

Re: How to use runugpost.bat and .exe files?

Esteemed Contributor
Esteemed Contributor

I would play with the runUGpost dialog for a while, which displayes the command line that will be executed to get a feeling of how things work.

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: NX12.0

How to Get the Most from Your Signature in the Community

Re: How to use runugpost.bat and .exe files?

Genius
Genius

Hi Stefan,

 

The main purpose of -tp "MyProgramGroupName" is to have an option for selecting the program groups on the .PRT file? main program or subprograms or both like the photo below. So you can postprocess the main program on a NC code and subprograms on different NC codes. I have been testing at it seems this possibility.

 

 NC PROGRAM BATCH.jpg

Thanks for all.

Re: How to use runugpost.bat and .exe files?

Genius
Genius

Hi,

 

Is there anyway to create a journal .VB like this .BAT file for working with it on NX.

 

For postprocessing different parts, with same or different posts and postprocessing multiple program groups. If it possible with some time scheduling on .VB journal.

 

 

 

 

Learn online





Solution Information