2 Replies Latest reply on May 31, 2018 9:19 AM by Patrick.Cashman

    HowTo: Multi User Automation via COM API on Concurrent Design (Schematic) Project

    fuba

      Hello

       

      is it possible on a concurrent project that various users have a remote

      connection via COM-API to a concurrent Design Job ?

       

      Do I always have to have exclusive rights when I ran some Automation via COM ?

       

      The issue I am having is, that in that moment when I request the Application

      Object for control on a concurrent Schematic, all Schemtic Sheets get locked,

      for other users.

       

      Is there a way around, that different users can work to the same time on their PC

      with a certain tool via COM API on the same Design Job ?

       

      Thank you for your contribution

        • 1. Re: HowTo: Multi User Automation via COM API on Concurrent Design (Schematic) Project
          fuba

          Ok, I was seraching/debugging in the meanwhile on my own.

           

          I found out that executing the following, block sheets for other users (see red rectange on image below).

           

          Dim sheets As ViewDraw.IVdObjs

          '# this line below locks in a concurrent design

          '# all other pages on other clients which are

          '# not active open

          sheets = vdApp.QueryPages(jobSchematicName)

           

          cd.png

           

          To release this object, at least the following line is necessary.

          System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)

           

          or to make it a little more professional:

           

          sub releaseComObject

           

                   '# For programs with multiple COM objects declared, repeat the following two
                   '# lines of code for each COM object in reverse order of creation.

                   Try
                       System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
                       'System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj)
                   Catch ex As Exception
                       Me.UpdateRtb("Internal Error: " & ex.ToString, Color.Red)
                   Finally
                       obj = Nothing
                   End Try

                   '# After all of the COM objects have been released
                   '# and set to null, do the following:

                   '# Start .NET CLR Garbage Collection
                   GC.Collect()

                   '# Wait for Garbage Collection to finish
                   GC.WaitForPendingFinalizers()

           

          end sub

           

          This removes the "Locked by xxxx on Computer yyyy"  Message on top.