Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Start a new session from NX Open?

Status
Not open for further replies.

MarcusMang

Automotive
Jul 17, 2015
3
0
0
DE
Hi everybody!

Since first dipping my toe into the NX Open water, I always wondered if there was a way to start a new session from an NX Open stand-alone executable?
I know I can do [pre]Session.GetSession()[/pre] but this will always attach to the same session when starting multiple instances of my executable.
(The first call will start, let's say, Session 10 and then all subsequent calls will also get me this session.)

I just conducted a little experiment with a simple Journal:

[pre]Option Strict Off

Imports System
Imports System.Windows.Forms

Imports NXOpen

Module RenameToolboxParameters

Sub Main(ByVal args() As String)
MessageBox.Show(Session.GetSession().Tag.ToString())
End Sub

End Module[/pre]

When I manually start two instances of NX and then run the Journal from each of them - the session's tag always is [tt]10[/tt].
I expected to get a different session (and thus tag) when running the Journal from the second instance.
To me it seems, that even when starting two UI instances, I still have only one session available through NX Open.
Is this the case? Or am I missing something?

If so, does somebody have deeper insight into sessions/UI sessions?
(Even starting a UI session from an NX Open executable (started via NX command line) would be very, very interesting!)

I'm really looking forward to your answers and hope I somehow made my question clear :)

Thanks in advance!
Marcus

 
Replies continue below

Recommended for you

I can't say if the sessions objects are unique or not, but I would not rely on the Tag to tell them apart.
If you open 2 interactive NX sessions and create 2 parts, one in each, the objects in those parts could have the same Tags (I believe). So I think the Tags for the session object could also be the same.
I think what I'm trying to say is that Tags are only unique within an NX session.

Graham Inchley, Systems Developer, Sandvik Coromant. HP EliteBook 8760w, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP4 64bit
Testing: NX9.0.2.5
 
That sounds quite reasonable [bigsmile]
Thank you for pointing that out, maybe I just haven't found a way to tell them apart correctly...

I will definitely experiment with that a little more, but I'm still wondering if there is a way to force a new session/UI window into existence [ponder]
 
Status
Not open for further replies.
Back
Top