DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Use LDOOP_UI to get a shared LD UI Application

 ' from Samples/Src/LDXAPIExamples/Example_LDOOP.vb

    <APIHelpAttribute(APIHelpModes.None, {APIHelpModes.None}, "", "LDXApplication~Example_LDOOP_UI_Shared", "Use LDOOP_UI to get a shared LD UI Application")>
 Public Shared Sub LDOOP_UI_Shared()
     ' In a desktop application, you might want to spawn a new Liftdesigner process or connect to a running one

     ' reference Interop.LDOOP_UI.dll, set 'embed interop types' to 'false'
     Dim ldoopSharedApplication As LDOOP_UI.ILDOOP_UISharedApplication = New LDOOP_UI.LDOOP_UISharedApplicationClass()

     ' you need to start the actual user interface via StartUI. In case we attached to an existing app, this does nothing.
     Dim version = Assembly.GetEntryAssembly().GetName().Version
     Dim majorVersion As Integer = version.Major ' you may want to hardcode this version
     ldoopSharedApplication.StartUI("DigiPara Liftdesigner 20" + majorVersion.ToString())

     Dim ldoopApplication As LDOOP_UI.ILDOOP_UIApplication = ldoopSharedApplication.Automation

     ' retrieve LDX application
     ' here in VB.NET, the cast from object/IDispatch to LDXApplication via QueryInterface happens implicitly,
     ' in C# you need an "as LDX.LDXApplication" cast.
     Dim ldxApp As LDX.LDXApplication = ldoopApplication.Application5
     ' it is running in a separate LDOOP_UI.exe process and accessed over an internal network link.

     ' create a new document
     Dim document = ldxApp.CreateDocument()

     MessageBox.Show("Pool Path : " + ldxApp.PoolPath)

     ' close the document again
     document.Close()

     ' as you might have connected to an existing application with unsaved data, you should NOT quit here
     ' ldoopApplication.Quit()
 End Sub