NX9: Listing all assemblies in a folder and with blank character in part name
NX9: Listing all assemblies in a folder and with blank character in part name
(OP)
Hi,
In this post thread561-335673: Listing all assemblies in a folder jmarkus and jptach help me to list all assemblies in a folder with the following .bat
____________________________________________________________________
@echo off
set base="C:\softs\ugnx9\"
set base_dir=%base:"=%
set UGII_BASE_DIR=%base_dir%
set UGII_ROOT_DIR=%base_dir%\UGIIset PATH=%base_dir%\ugii;%PATH%
if exist "%base_dir%\ugopen\ufvars.bat" call "%base_dir%\ugopen\ufvars.bat" "%base_dir%"
if "%DISPLAY%" == "" set DISPLAY=LOCALPC:0.0
REM Begin CODE
REM Jeff Markus, April 2009
REM
echo ===========================
echo MTC NX 5.0 Assembly File Determine
echo Scanning UG NX PRT files...
mkdir c:\temp\asmtemp
mkdir c:\temp\asmtemp\confirmed
for %%X in (*.prt) do (ug_inspect %%X | find "no components? FALSE" > c:\temp\asmtemp\%%X & echo %%X >> c:\temp\asmtemp\%%X)
echo The following files are assemblies:
pushd
c:
cd c:\temp\asmtemp
for %%X in (*.prt) do (findstr /M FALSE %%X) > c:\temp\asmtemp\confirmed\%%~nxX
cd confirmed
for %%X in (*.prt) do (if %%~zX EQU 0 del %%X)
i:
popd
for %%X in (c:\temp\asmtemp\confirmed\*.prt) do (ugpc %%~nxX & echo --)
del c:\temp\asmtemp\*.prt
del c:\temp\asmtemp\confirmed\*.prt
rmdir c:\temp\asmtemp\confirmed
rmdir c:\temp\asmtemp
echo Scan complete.
pause
____________________________________________________________________________
But I discovered that it doesn't work if part name contain blank characters like "Bande CVS 6HU 710 GPC.prt"
And I have sometimes the following message: Error File ...... is a pre-V10 part file
Any idea ?
TIA
In this post thread561-335673: Listing all assemblies in a folder jmarkus and jptach help me to list all assemblies in a folder with the following .bat
____________________________________________________________________
@echo off
set base="C:\softs\ugnx9\"
set base_dir=%base:"=%
set UGII_BASE_DIR=%base_dir%
set UGII_ROOT_DIR=%base_dir%\UGIIset PATH=%base_dir%\ugii;%PATH%
if exist "%base_dir%\ugopen\ufvars.bat" call "%base_dir%\ugopen\ufvars.bat" "%base_dir%"
if "%DISPLAY%" == "" set DISPLAY=LOCALPC:0.0
REM Begin CODE
REM Jeff Markus, April 2009
REM
echo ===========================
echo MTC NX 5.0 Assembly File Determine
echo Scanning UG NX PRT files...
mkdir c:\temp\asmtemp
mkdir c:\temp\asmtemp\confirmed
for %%X in (*.prt) do (ug_inspect %%X | find "no components? FALSE" > c:\temp\asmtemp\%%X & echo %%X >> c:\temp\asmtemp\%%X)
echo The following files are assemblies:
pushd
c:
cd c:\temp\asmtemp
for %%X in (*.prt) do (findstr /M FALSE %%X) > c:\temp\asmtemp\confirmed\%%~nxX
cd confirmed
for %%X in (*.prt) do (if %%~zX EQU 0 del %%X)
i:
popd
for %%X in (c:\temp\asmtemp\confirmed\*.prt) do (ugpc %%~nxX & echo --)
del c:\temp\asmtemp\*.prt
del c:\temp\asmtemp\confirmed\*.prt
rmdir c:\temp\asmtemp\confirmed
rmdir c:\temp\asmtemp
echo Scan complete.
pause
____________________________________________________________________________
But I discovered that it doesn't work if part name contain blank characters like "Bande CVS 6HU 710 GPC.prt"
And I have sometimes the following message: Error File ...... is a pre-V10 part file
Any idea ?
TIA
Regards
Didier Psaltopoulos
http://www.psi-cad.com





RE: NX9: Listing all assemblies in a folder and with blank character in part name
CODE
for %%X in (*.prt) do (ug_inspect "%%X" | find "no components? FALSE" > c:\temp\asmtemp\%%X & echo %%X >> c:\temp\asmtemp\%%X)There may be other places in the code where you will need to do similar, but that's the one that stuck out to me.
www.nxjournaling.com
RE: NX9: Listing all assemblies in a folder and with blank character in part name
The folowing code works well
@echo off
REM Begin CODE
REM Jeff Markus, April 2009
REM
mkdir asmtemp
mkdir asmtemp\confirmed
for %%X in (*.prt) do (ug_inspect "%%X" | find "no components? FALSE" > asmtemp\"%%X" & echo "%%X" >> asmtemp\"%%X")
echo The following files are assemblies:
pushd
for %%X in (asmtemp\*.prt) do (findstr /M FALSE "%%X") > asmtemp\confirmed\"%%~nxX"
for %%X in (asmtemp\confirmed\*.prt) do (if "%%~zX" EQU 0 del "%%X")
popd
setlocal ENABLEDELAYEDEXPANSION
set dir_list=
for /d %%i in (*) do @(echo "%%i" && set dir_list=-p%%i !dir_list!)
for %%X in (asmtemp\confirmed\*.prt) do (ugpc -s4 !dir_list! "%%~nxX" > %%~nX_list_ass.txt & echo --)
echo Scan complete.
pause
But I have the following error with many parts : Error File ...... is a pre-V10 part file What does it mean ?
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: NX9: Listing all assemblies in a folder and with blank character in part name
www.nxjournaling.com
RE: NX9: Listing all assemblies in a folder and with blank character in part name
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Digital Factory
Cypress, CA
Siemens PLM:
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
RE: NX9: Listing all assemblies in a folder and with blank character in part name
OK for ug_inspect and the pre V10 part
I found a solution by using only ugpc and I have now a more simple code when all part are in the same assembly
@echo off
setlocal ENABLEDELAYEDEXPANSION
set dir_list=
for /d %%i in (*) do @(echo "%%i" && set dir_list=-p%%i !dir_list!)
for %%X in (*.prt) do (ugpc -s4 !dir_list! "%%~nxX" & echo ----------------------------------------------------------)
echo Scan complete.
pause !
Regards
Didier Psaltopoulos
http://www.psi-cad.com