Cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-thread programming for NX

Valued Contributor
Valued Contributor

I am looking to do some NX customization, and I am wondering if I am able to utilize the GUI in NX while a Journal is executing? Does the Journal share a thread with anything else in the application, or is it on it's own? I wanted to utilize the the Thread.Sleep method in a Journal, and send data to NX and get a response from the GUI, and then finish Journal execution. Is this possible if I utilize multi-thread programming techniques?

 

Is there a way for me to check this?

2 REPLIES

Re: Multi-thread programming for NX

Genius
Genius

Hi,

 

I have never tried it with a journal but when you make dll with a form then the Nx interface is blocked when the form is displayed.

 

With this piece of code i made a separate thread. The idea is that i want my form in the forground, but i still want to be able to select stuff in the interface. When the user changes the workpart, the info on my form changes accordingly.

 

br

fred

 

 Sub Main()

        'Debugger.Launch()

        'callback change workpart
        idWorkPartChanged1 = s.Parts.AddWorkPartChangedHandler(AddressOf WorkPartChanged1)

        frmMain = New frmMain 'initialize form
        frmMain.Show()

        'Debugger.Launch()

        Dim checkThread As New Thread(New ThreadStart(AddressOf IsFormDismissed))
        checkThread.Start()

    End Sub

    Public Sub IsFormDismissed()

        Do
            If frmMain.IsDisposed() = True Then
                UnloadNXLibrary()
            End If
            Thread.Sleep(1000)
        Loop

    End Sub

Re: Multi-thread programming for NX

Siemens Phenom Siemens Phenom
Siemens Phenom

See the article on Multi-threading in the online documentation.