Created
November 25, 2010 15:39
-
-
Save davidtolsma/715541 to your computer and use it in GitHub Desktop.
Unigraphics NX Teamcenter Managed Refile utility to the latest version of NX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo OFF | |
TITLE REFILE | |
:: Where I'm running this script from. | |
set currentDirectory=%~d0 | |
set currentPath=%~p0 | |
set thisScriptPath=%~dp0 | |
:: Set FMS | |
set IPR=%IMAN_ROOT%\portal | |
set FMS_HOME=%IPR%\fms | |
call TcEngEnvironment.bat | |
set inputFileDirectory=%1 | |
set outputFile=%2 | |
:: verify input arguments are correct | |
IF "%inputFileDirectory%"=="" GOTO :ENVIRONMENTNOTSET | |
IF "%outputFile%"=="" GOTO :ENVIRONMENTNOTSET | |
:: Set Login Information if it doesn't exist | |
if "%user%"=="" CALL :GETLOGINCREDIANTIALS | |
if "%password%"=="" CALL :GETLOGINCREDIANTIALS | |
set errorLog=errors%outputFile% | |
:: the Login credentials are set, capture in a variable | |
set LoginInformation=-u=%user% -p=%password% | |
:: OPTIONS | |
set compressParts=FALSE | |
set createTrueShapeData=FALSE | |
set partCleanup=FALSE | |
set bypass=yes | |
set refileReleased=yes | |
set keep_volume=yes | |
:: structure_sync options: from_ug | |
set structure_sync=no | |
set force_structure_sync=no | |
set update_mod=no | |
IF "%compressParts%"=="TRUE" (set compressParts=-co) ELSE (set compressParts= ) | |
IF "%createTrueShapeData%"=="TRUE" (set createTrueShapeData=-ts) ELSE ( set createTrueShapeData= ) | |
IF "%partCleanup%"=="TRUE" (set partCleanup=-cleanup) ELSE ( set partCleanup= ) | |
set arguments= -i=%inputFileDirectory% %compressParts% %createTrueShapeData% %partCleanup% -bypass=%bypass% -refile_released=%refileReleased% -out=%thisScriptPath%\%logDirectory%\%errorLog% -keep_volume=%keep_volume% -structure_sync=%structure_sync% -force_structure_sync=%force_structure_sync% -update_mod=%update_mod% | |
:: System Variables | |
set programName=ugmanager_refile | |
::Set the colors for the command prompt when running | |
set backgroundColor=4 | |
set foregroundColor=7 | |
if "%UGII_BASE_DIR%"=="" GOTO :ENVIRONMENTNOTSET | |
if "%UGII_ROOT_DIR%"=="" set UGII_ROOT_DIR=%UGII_BASE_DIR%UGII | |
::Put the Time and Day into the top of the file when it was started | |
echo %DATE% %TIME% >> %outputFile% | |
echo. | |
:: Set the background and foreground color to show that it is working | |
color %backgroundColor%%foregroundColor% | |
echo Working... | |
echo %outputFile% | |
pause | |
::echo %outputFile% | |
::echo. >> %outputFile% | |
::echo %UGII_BASE_DIR%\UGMANAGER\%programName% %LoginInformation% %arguments% >> %outputFile% | |
::echo. >> %outputFile% | |
::Put the Time and Day into the top of the file when it was Completed | |
echo. | |
echo STARTED AT: %DATE% %TIME% >> %outputFile% | |
call %UGII_BASE_DIR%\UGMANAGER\%programName% %LoginInformation% %arguments% >> %outputFile% | |
::Put the Time and Day into the top of the file when it was Completed | |
echo. | |
echo COMPLETED AT: %DATE% %TIME% >> %outputFile% | |
GOTO :QUIT | |
::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
:CREATEDIR | |
set argument=%* | |
:: If the folder does not exist this will create it | |
if not exist %thisScriptLocation%\%argument% md %argument% | |
GOTO :EOF | |
:RUN_REFILE | |
set fileName=%* | |
echo. | |
echo %programName% %fileName% %arguments% >> %outputFile% | |
echo. | |
echo Processing: %fileName% | |
%programName% %fileName% %arguments% >> %outputFile% | |
GOTO :EOF | |
:ENVIRONMENTNOTSET | |
cls | |
echo. | |
echo USAGE: %~0 inputFile outputLogFile | |
echo. | |
echo EXAMPLE: %~0 C:\inputList.txt c:\logs\refileLogFile.txt | |
echo. | |
GOTO :QUIT | |
:GETLOGINCREDIANTIALS | |
:: set a Prompt for username and password | |
cls | |
echo Enter Your Teamcenter Username | |
echo. | |
SET user= | |
SET /P user=username: | |
if not "%user%"=="" set user=%user:~0,25% | |
cls | |
echo Enter Your Teamcenter Password | |
echo. | |
SET password= | |
SET /P password=password: | |
if not "%password%"=="" set password=%password:~0,25% | |
cls | |
GOTO :EOF | |
:QUIT | |
:: Sets the background and foreground color back to standard | |
color 07 | |
:: Set the Toolbar back to CMD | |
title %comspec% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment