Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help in runing an example journal in batch mode

Status
Not open for further replies.

Ehaviv

Computer
Jul 2, 2003
1,012
Hi
The following example found in plm forum.
I follow its instruction the result its an error.
THANK YOU FOR ANY HELP.

THE ERROR:

Code:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly
 'NXOpen, Version=11.0.0.33, Culture=neutral, PublicKeyToken=null' or one of its
 dependencies. The system cannot find the file specified.
File name: 'NXOpen, Version=11.0.0.33, Culture=neutral, PublicKeyToken=null'
   at batch_2.Main(String[] args)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

THE JOURNAL:

Code:
'I don't see anyplace where you open a part.  A batch program can open
' a part either by having it hard-coded in your program, or more commonly
' by passing it on the command line.  If you have built the .EXE,
' something like this should work:
 
'Run the program from the command line like this:
 
'myProgram.exe D:\Path\to\Part\thePart.prt

Option Strict Off
Imports System
Imports NXOpen

Module open_part_from_command_line_argument

    Sub Main(ByVal args As String())
        Try
            Dim theSession As Session = Session.GetSession()
            Dim loadStatus As NXOpen.PartLoadStatus = Nothing

            Dim thePart As Part = theSession.Parts.OpenDisplay(args(0), loadStatus)

            Console.OpenStandardOutput()
            Console.WriteLine()
            Console.WriteLine("Part " + thePart.FullPath + " was opened successfully.")
            Console.WriteLine()

            theSession.Parts.CloseAll(BasePart.CloseModified.CloseModified, Nothing)

        Catch ex As Exception
            Console.OpenStandardOutput()
            Console.WriteLine(ex.ToString)
            Console.WriteLine()
        End Try

    End Sub

End Module


Thank you.
 
Replies continue below

Recommended for you

The Executable calls for an Argument (in this case the path to the part which you want to open). Did you give that argument when you try to run it?

When you are talking about batch mode I assume you want it to get that path from a list of parts. For this you need to rebuild this code to read from that list.

Ronald van den Broek
Senior Application Engineer
Winterthur Gas & Diesel Ltd
NX9 / TC10.1.2

Building new PLM environment from Scratch using NX12 / TC11
 

myProgram.exe D:\Path\to\Part\thePart.prt


I simply used the above syntax shown
In the example.

Maybe something wrong in the example.

Thank you.
 
Exactly as it was written there? or did you use your own path?


Ronald van den Broek
Senior Application Engineer
Winterthur Gas & Diesel Ltd
NX9 / TC10.1.2

Building new PLM environment from Scratch using NX12 / TC11
 
No!

Path to my part.

Thank you.
 
Maybe You have to use " " on path, because spaces are not properly recognized?

With best regards
Michael
 
The error message is telling you that your code cannot find the NX dll files. There are a few ways to fix this:
[ul]
[li]use NX's run_managed utility to start your program[/li]
[li]run your program from the NX command prompt[/li]
[li]copy the NX dll files to your program's working directory (don't forget to update them when NX is patched)[/li]
[li]add the NX location to your PATH environment variable[/li]
[/ul]

ref:

www.nxjournaling.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor