Submitted by maayansv on Fri, 12/05/2014 - 02:31
Forums:
Hi,
Is there a way to find the minimal required version required to open a part in NX, using VB.Net?
In other words, i would like to know in which version of NX a part is saved, without opening the part in NX?
Regards,
Maayan
re: part version
There is a command line utility that ships with NX called "ug_inspect.exe"; it can be found in the UGII dir. It has several functions, one of which is reporting the version of NX the part was last saved in. You can use VB to run the utility and parse the output.
I have a VBScript version that I made some time ago; copy and paste into a text file with a ".vbs" extension. The easiest way to run it is to drag and drop an NX part file onto the script file.
The syntax is very similar to VB, though not exact; it will require a few tweaks to get a VB.net version running.
VBScript code:
'NX part file version
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FileExists(WScript.Arguments(0)) Then
wscript.echo("Invalid file")
wscript.quit
End If
Set objShell = CreateObject( "WScript.Shell" )
Set objEnv = objShell.Environment("Process")
strProgramPath = objEnv("UGII_ROOT_DIR") & "\ug_inspect.exe"
Set objWshScriptExec = objShell.Exec(strProgramPath & " -release " & chr(34) & WScript.Arguments(0) & chr(34))
lineTest = "Release: NX "
'create object to catch external program's output
Set objStdOut = objWshScriptExec.StdOut
Do While Not objStdOut.AtEndOfStream
strLineTest = objStdOut.ReadLine
pos = instr(strLineTest, lineTest)
if pos > 0 then
NX_version = Right(strLineTest, Len(strLineTest) - Len(lineTest))
end if
Loop
wscript.echo("NX part version: " & NX_version)