Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: NX Properties(version)

Legend
Legend

Not sure I understand, you are looking for an existing script that does this or you want us to do it for you?

 

Takes 5~10min to put together in either C# or VBS bud. Whether a console script or winform exe that you can drag your *.prt file onto and evaluate using Console.ReadLine() and/or GetCommandLineArgs(), then start the corresponding NX process based on what version it finds. Few ways to do this really...

 

What are you looking for? outsourcing/freelancer?

 

Re: NX Properties(version)

Valued Contributor
Valued Contributor

@CWilson wrote:

Not sure I understand, you are looking for an existing script that does this or you want us to do it for you?

 

Takes 5~10min to put together in either C# or VBS bud. Whether a console script or winform exe that you can drag your *.prt file onto and evaluate using Console.ReadLine() and/or GetCommandLineArgs(), then start the corresponding NX process based on what version it finds. Few ways to do this really...

 

What are you looking for? outsourcing/freelancer?

 


???

Please stop flooding this thread with unrelated stuff....your earlier posting for "Converting Units"??? & now this...???

I post questions like everyone else on here...seeking knowledge & help...certainly NOT looking for handouts/someone do the work for me...If you have something constructive to add/contribute, please do so w/o the boasting!

 

Kal.

NX 9.0.3.4 MP12 | PB 9.0.3.2 | NX11.0.2.7 MP13 | PB 11.0.2 | VERICUT 7.3.4

Re: NX Properties(version)

Legend
Legend

@Kal wrote:


???

Please stop flooding this thread with unrelated stuff....your earlier posting for "Converting Units"??? & now this...???

I post questions like everyone else on here...seeking knowledge & help...certainly NOT looking for handouts/someone do the work for me...If you have something constructive to add/contribute, please do so w/o the boasting!

 

Kal.


 

Sorry if my msg came across the wrong way.

 

I wanted to know if you planned doing this yourself; perhaps needed this commercially/professionally done -or- if you wanted us to quickly do this for ya. Like I said, it takes 5~10min to rig together (e.g drag & drop). I for one would have been quite happy to pass this over to you in a console.readline() type format/app. Suddenly changed my mind tough

ps: passed over the shell script/thread that other folks did to show you (hint?) how easy it is to pass version args in a vba script. Not flooding your thing, chill up dude

Have a nice day

Re: NX Properties(version)

Phenom
Phenom

Here is a batch file that opens a file with last release saved

 

I have not tested this with all versions 

 

Registry read part is extracted from NXcustom

 

This will open a new session of NX.

 

I'm not sure if you can route to a specific version of running NX sessions

 

Use at your own risk I hacked this together over lunch

 

EDIT for nxbin version greater than NX 10 and another to correct UGII_BASE_DIR

 

@echo off
::find ug_inspect.exe
if exist "%UGII_BASE_DIR%\NXBIN\ug_inspect.exe" (
	set INSPECT=%UGII_BASE_DIR%\NXBIN\ug_inspect.exe
) else (
	if exist "%UGII_BASE_DIR%\ugii\ug_inspect.exe" (
		set INSPECT=%UGII_BASE_DIR%\ugii\ug_inspect.exe
	) else (
		echo "Cannot find ug_inspect.exe check UGII_BASE_DIR"
		pause 
		exit
	)
)
:: Find NX Release
for /f "tokens=3" %%i in (
    '%INSPECT% -release %1 ^| FINDSTR /C:"Release: NX"'
) do (
    set NX_RELEASE=%%i
)

if %NX_RELEASE%==4   set NX_VERSION=V22.0
if %NX_RELEASE%==5   set NX_VERSION=V23.0
if %NX_RELEASE%==6   set NX_VERSION=V24.0
if %NX_RELEASE%==7   set NX_VERSION=V25.0
if %NX_RELEASE%==7.5 set NX_VERSION=V25.5
if %NX_RELEASE%==8   set NX_VERSION=V26.0
if %NX_RELEASE%==8.5 set NX_VERSION=V26.5
if %NX_RELEASE%==9   set NX_VERSION=V27.0
if %NX_RELEASE%==10  set NX_VERSION=V28.0
if %NX_RELEASE%==11  set NX_VERSION=V29.0
if %NX_RELEASE%==12  set NX_VERSION=V30.0

:: Determine where NX is installed
set rk=hklm\software\wow6432node\Unigraphics Solutions\Installed Applications
for /f "tokens=3,* usebackq" %%h in (`reg query "%rk%" /v "Unigraphics %NX_VERSION%" ^| findstr /i %NX_VERSION%` ) do (set str1=%%~dpi)
set UGII_BASE_DIR=%str1:\ugii\=%
set UGII_BASE_DIR=%UGII_BASE_DIR:\nxbin\=%
set str1=
echo UGII_BASE_DIR=%UGII_BASE_DIR%

if %NX_RELEASE% GTR 10 (
 set NX_CMD="%UGII_BASE_DIR%\nxbin\ugraf"
) else (
 set UGII_ROOT_DIR=%UGII_BASE_DIR%\ugii
 set NX_CMD="%UGII_BASE_DIR%\ugii\ugraf"
)

if not exist "%UGII_BASE_DIR%" (
    color 4f
    echo The path to the NX installation cannot correctly be determined. 
    echo Probably because your are not authorised to read the registry from your system.
    pause
    exit
)
::set NX_CMD
echo Opening %1 with NX Version = %NX_RELEASE%
start "NX" %NX_CMD% -retrieve=%1

timeout 10

Re: NX Properties(version)

Phenom
Phenom

Kal ,

A version a little bit different of agrivas , you can get the %major% and %minor% version... (eg : NX8.5 , NX7.5) and concat for name

Edit the path of %BAT_CUSTOM_KAL% to point to your custom env or use <:: Determine where NX is installed > of agriva's bat

@echo off
set stdout=%TEMP%\stdout.log
:: set UGII_BASE_DIR=
set UG_INSPECT=%UGII_BASE_DIR%\nxbin\ug_inspect.exe

if exist %UG_INSPECT% (
call %UGII_BASE_DIR%\nxbin\ug_inspect.exe -release %1 > %stdout%
) else (
call %UGII_BASE_DIR%\ugii\ug_inspect.exe -release %1 > %stdout%
)

:: Version Nx
for /f "delims=" %%i in ('type %stdout%') do set d=%%i
for %%A in (%d%) do set version=%%A

:: Corruption...
if "%version%" == "corruptions" (
cls
echo Please... upgrade 'ug_inspect.exe'
echo Change directory of : %UGII_BASE_DIR%
pause
exit
:: Message box...
:: set message=%TEMP%\message.vbs
:: echo msgbox "Please... upgrade 'ug_inspect.exe'"+chr(13)+"Change directory of : %UGII_BASE_DIR%",vbExclamation,"Error..." > %message%
:: start "C:\Windows\System32\cscript.exe" %message%
)

:: major and minor Version
:: eg : version=7.5
:: major = 7
:: minor = 5
for /f "tokens=1,2 delims=." %%a in ("%version%") do set major=%%a&set minor=%%b

:: Concat major & minor with <NX>
if "%minor%" == "" (
set NX_NUMBER=NX%major%
) else (
set NX_NUMBER=NX%major%%minor%
)

:: Dir CUSTOM_KAL
set BAT_CUSTOM_KAL=C:\app\%NX_NUMBER%_custom\%NX_NUMBER%.bat
if exist %BAT_CUSTOM_KAL% (
call %BAT_CUSTOM_KAL%
)
Production: NX11.0.2.7,VERICUT 8.1.2
Development: Tcl/Tk, Gnuplot
www.adgroupe.com

Re: NX Properties(version)

Valued Contributor
Valued Contributor
Thank you Alex & MKN for your help. I'm going to test both solutions.
Kal.
NX 9.0.3.4 MP12 | PB 9.0.3.2 | NX11.0.2.7 MP13 | PB 11.0.2 | VERICUT 7.3.4

Re: NX Properties(version)

Valued Contributor
Valued Contributor

Here is the code to open with related NXCustom version with files last saved version,

I modified code written by @agrivas just a little, added support for paths with spaces. 

 

It is also opens the file with currently running NX session/instance.

 

@echo off

::find ug_inspect.exe
if exist "%UGII_BASE_DIR%\NXBIN\ug_inspect.exe" (
	set INSPECT="%UGII_BASE_DIR%\NXBIN\ug_inspect.exe"
) else (
	if exist "%UGII_BASE_DIR%\ugii\ug_inspect.exe" (
		set INSPECT="%UGII_BASE_DIR%\ugii\ug_inspect.exe"
	) else (
		echo "Cannot find ug_inspect.exe check UGII_BASE_DIR"
		pause 
		exit
	)
)
:: Find NX Release
for /f "tokens=3" %%i in (
    'call %INSPECT% -release %1 ^| FINDSTR /C:"Release: NX"'
) do (
    set NX_RELEASE=%%i
)

if %NX_RELEASE%==10 set NX_CMD="PATH_TO_YOUR_NXCUSTOM\NX100custom\NX100.bat"
if %NX_RELEASE%==12 set NX_CMD="PATH_TO_YOUR_NXCUSTOM\NX120custom\NX120.bat"

::set NX_CMD
echo Opening %1 with NX Version = %NX_RELEASE%
call %NX_CMD% -use_file_dir %1

rem timeout 10

You need to modify PATH_TO_YOUR_NXCUSTOM part.

 

Learn online





Solution Information