Home

Moving files and making PDF's from Pro/ENGINEER

This batch file is to be executed from the "printer.pcf" file after a mapkey is run to create IGES, eModel, BOM, Parameter and Postscript files. It will parse the parameter file and rename the output files with the Revision appended to the file name. Then it will invoke Ghostscript to create a PDF file.

prompt $_

SET PS_IN=<The folder where the Data files should end up>
SET BOM_IN=<The folder where the BOM files should end up>
SET GHOSTSCRIPT=<Ghostscript folder>
SET PS_INPUT=%1
SET PATH=%GHOSTSCRIPT%;<ProE Loadpoint\bin;>%PATH%
FOR %%I IN ("%PS_INPUT%") DO SET PS_NAME=%%~nI

IF EXIST param.inf FOR /F "tokens=1,3" %%I IN (param.inf) DO IF %%I==REV (
    set REV_LEVEL=%%J
    DEL /F /Q param.inf
    goto File_Moving
)

IF EXIST %PS_NAME%_par.txt FOR /F "tokens=1,2" %%I IN (%PS_NAME%_par.txt) DO IF %%I==REV (
    set REV_LEVEL=%%J
    DEL /F /Q %PS_NAME%_par.txt
    goto File_Moving
)


:File_Moving

MOVE /Y "%PS_INPUT%" "%PS_IN%\%PS_NAME%-%REV_LEVEL%.ps"

IF EXIST "%PS_NAME%.bom.*" CALL PURGE "%PS_NAME%.bom"
IF EXIST "%PS_NAME%.bom.*" MOVE /Y "%PS_NAME%.bom.*" "%BOM_IN%\%PS_NAME%-%REV_LEVEL%.tdv"
IF EXIST "%PS_NAME%.txt.*" CALL PURGE "%PS_NAME%.txt"
IF EXIST "%PS_NAME%.txt.*" MOVE /Y "%PS_NAME%.txt.*" "%BOM_IN%\%PS_NAME%-%REV_LEVEL%.txt"
IF EXIST "%PS_NAME%*.igs" MOVE /Y "%PS_NAME%*.igs" "%BOM_IN%\%PS_NAME%-%REV_LEVEL%.igs"
IF EXIST "%PS_NAME%.eASM" MOVE /Y "%PS_NAME%.eASM" "%BOM_IN%\%PS_NAME%-%REV_LEVEL%.eASM"
IF EXIST "%PS_NAME%.ePRT" MOVE /Y "%PS_NAME%.ePRT" "%BOM_IN%\%PS_NAME%-%REV_LEVEL%.ePRT"
FOR %%I IN (%PS_NAME%*.dxf) DO MOVE /Y "%%I" "%BOM_IN%\%%~nI-%REV_LEVEL%.dxf"

IF EXIST "*.log.*" del /q "*.log.*"
IF EXIST "current_session.pro" del /q "current_session.pro"


:PDF_Processing

start /b /belownormal /wait %GHOSTSCRIPT%\gswin32c -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE#pdfwrite -sOutputFile#%PS_IN%\%PS_NAME%-%REV_LEVEL%.pdf -I%GHOSTSCRIPT% -dPDFSETTINGS#/printer -dCompatibilityLevel#1.4 -c -f %PS_IN%\%PS_NAME%-%REV_LEVEL%.ps

exit