Skip to content

Instantly share code, notes, and snippets.

@davidtolsma
Created November 25, 2010 00:04
Show Gist options
  • Save davidtolsma/714668 to your computer and use it in GitHub Desktop.
Save davidtolsma/714668 to your computer and use it in GitHub Desktop.
inspect Unigraphics NX parts
@echo OFF
:: Alternative ug_inspect utility, requires passing in the option to retrieve
:: run ug_inspect -h for complete list of options
TITLE GET NX INFORMATION
set inputDirectory=%1
set runtype=%2
set outputFile=%3
:: Where I'm running this script from
set currentDirectory=%~d0
set currentPath=%~p0
set thisScriptPath=%~dp0
:: USER SETTINGS
set logDirectory=logs
set program=%UGII_ROOT_DIR%ug_inspect.exe
set programArguments=%runtype%
if "%inputDirectory%"=="" GOTO :ENVIRONMENTNOTSET
if "%runtype%"=="" GOTO :ENVIRONMENTNOTSET
if "%outputFile%"=="" GOTO :ENVIRONMENTNOTSET
set outputDirectory=logs
set outputFileAndPath=%thisScriptPath%%outputDirectory%\%outputFile%
:: Red
set backgroundColor=4
:: white
set foregroundColor=7
if "%UGII_BASE_DIR%"=="" GOTO :ENVIRONMENTNOTSET
if "%UGII_ROOT_DIR%"=="" set UGII_ROOT_DIR=%UGII_BASE_DIR%UGII
@ECHO OFF
cls
:: Check if UGII_BASE_DIR is set else quit
:: example: C:\Program Files\UGS\NX 3.0\
IF NOT DEFINED UGII_BASE_DIR GOTO:NOTSET
TITLE Running UG_INSPECT
Echo Running UG_INSPECT.exe
Echo Please Wait...
Echo.
set thisScriptPath=%~dp0
set corrupt=corruptFiles.txt
set logDirectory=ugInspectResults
set ugInspectCommand=%UGII_BASE_DIR%\UGII\ug_inspect.exe
:: create a directory for the results information if it does not exist
IF NOT EXIST %logDirectory% mkdir %logDirectory%
:: show me only the files with .prt extension and nothing else
:: then pass each file it finds to the utility
for /F %%f in ('dir /b *.prt') Do CALL :RUN_UG_INSPECT %%f
:: I'm done cycling through, quit the application
GOTO:QUIT
:RUN_UG_INSPECT
:: set the incoming file argument as a easy to read variable
set fileName=%*
:: check for known corruptions
%ugInspectCommand% %fileName% >> %logDirectory%\%fileName%_Results.txt
:: To display the help options of ug_inspect
::%ugInspectCommand% -help >> ug_inspect_HELP.txt
::%ugInspectCommand% -rm %fileName% >> %logDirectory%\%fileName%_RecordManagerPartition.txt
::%ugInspectCommand% -cmod %fileName% >> %logDirectory%\%fileName%_cmod.txt
::%ugInspectCommand% -ess %fileName% >> %logDirectory%\%fileName%_ExpressionPartition.txt
::%ugInspectCommand% -occ %fileName% >> %logDirectory%\%fileName%_occurrencesPartition.txt
::%ugInspectCommand% -path %fileName% >> %logDirectory%\%fileName%_pathPartition.txt
::%ugInspectCommand% -ps %fileName% >> %logDirectory%\%fileName%_parasolidPartition.txt
::%ugInspectCommand% -full %fileName% >> %logDirectory%\%fileName%_allPartitions.txt
::%ugInspectCommand% -trace %fileName% >> %logDirectory%\%fileName%_tracingInfo.txt
::%ugInspectCommand% -cookies %fileName% >> %logDirectory%\%fileName%_objectID.txt
::%ugInspectCommand% -refs %fileName% >> %logDirectory%\%fileName%_recentReference.txt
::%ugInspectCommand% -all_refs %fileName% >> %logDirectory%\%fileName%_allReference.txt
:: Look for all known corruptions
::%ugInspectCommand% -scan %fileName% >> %logDirectory%\%fileName%_corruptions.txt
:: use this option for pre version 12 files
::%ugInspectCommand% -extract_all %fileName% >> %logDirectory%\%fileName%_extractAll.txt
:: extracts parasolid transmit files
::%ugInspectCommand% -extract %fileName% >> %logDirectory%\%fileName%_extractParasolidInfo.txt
::%ugInspectCommand% -release %fileName% >> %logDirectory%\%fileName%_releaseInfo.txt
GOTO:EOF
:: If a variable is not set, tell the user then quit
:NOTSET
echo.
echo 'UGII_BASE_DIR' is not set
echo Please set this variable, then run this script again
echo.
GOTO:QUIT
:QUIT
:: reset the windows title to default
title %comspec%
ECHO.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment