Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Query to see if part is open Journal, NX 11

Status
Not open for further replies.

3dr

Automotive
Jul 10, 2004
456
I'm trying to use the code below to test if a part is already open in the session.


If False, Show message box and don't execute the code.
If True, Execute the rest of the journal.
But I'm getting a "MessageBox is not declared" error

What am I missing here??


Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work

Dim displayPart As NXOpen.Part = theSession.Parts.Display

----------------------------------------------
Menu: Assemblies->Components->Add Component...
----------------------------------------------

Dim pfile As String = "Proj Data.prt"

For each openPart as part in theSession.Parts
if openPart.FullPath = pfile then
MessageBox.Show ("part is already open")
else
MessageBox.Show ("code to open part")
end if
next




Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX1851, Win 10 Pro
 
Replies continue below

Recommended for you

Add the following to the imports section:
Code:
Imports System.Windows.Forms

OR fully qualify the call to the message box
Code:
System.Windows.Forms.MessageBox.Show ("part is already open")

www.nxjournaling.com
 
Qualifying the Message Box did the trick.

Thanks Cowski!

Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX1851, Win 10 Pro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor