Call Journal from Another journal

How I can call the journal from another journal?

You can't call uncompiled journal code from uncompiled journal code. One of the limitations of journaling is all the code must be in one file.

If you can compile your code to .dll's, you should be able to call them at will.

There is a similar thread found here:
http://nxjournaling.com/content/calling-journal-within-journal

Does anyone have a specific example of calling a *.dll , from inside a Journal?
Does it need to be added to Project Resources or Imports , etc.. ?
thanks

Carlo Tony Daristotile

Look up the Session.Execute method in the API documentation. One of the arguments that need to be passed in is the file name of the .dll (including the full path).

You will not have to add it to the "imports" section. The "imports" directives simply include the desired namespace into your project so that you don't have to fully qualify the names of the objects that you use. It helps cut down on the amount of typing that you have to do, but it does not add the proper references to external .dll's. Adding it to the "imports" section is optional.

Code that's running in the Journal Editor can only call functions in certain DLLs. The list of legal system DLLs is mscorlib, System, System.Windows.Forms, System.Drawing, System.XML, System.Data. This is all described in the NXOpen Programmers' Manual. One that's missing is System.Collections.Generic, so you can't use generic lists.

Of course, you can call functions in all the NXOpen DLLs: NXOpen, NXOpen.UI, NXOpen.UF, NXOpenUI, NXOpen.Utilities.

You can also use MiniSnap.dll.

To call functions in Snap.dll, you need a SNAP authoring license.

"One that's missing is System.Collections.Generic, so you can't use generic lists."

I believe that Collections.Generic is contained within the System.dll; as such generics can be used within "uncompiled" journal code. All of the code that I post can be run as a journal and many of the examples use a generic list. A few examples use a dictionary object and at least one uses a stack object.

I highly recommend using a generic list in place of an array. Lists make it much easier to add or remove items and you can specify a custom sort order for the objects. In short, generics make your programming task easier.

Option Strict Off
Imports System.IO
Imports NXOpen

Module Module1
Sub main()
Call sub1()
Call Sub2()
Call sub3()

End Sub

Sub Sub1()

'Your first script here

End Sub

Sub Sub2()
'Your second script here
End Sub

Sub Sub3()

'Your third script here
End Sub

End Module

This will help u to add 'N' no of subs to your main procedure ....

Regards,

Joe

NXJournaling is correct -- the System.Collections.Generic namespace is in the System assembly, so you can use generic lists. I mixed up namespaces and assemblies. Apologies for my mistake. And I agree that using generic lists is extremely useful.

Regarding the reply from Alto Joe ... yes, you can call other subroutines, as shown, as long as they are in the same file. But the original question was about calling functions in other files or other DLLs (probably).