1 Reply Latest reply on Jun 7, 2017 12:02 AM by matthias.cosaert

    How to get the Time Stamp of a cell in xPCB

    christopher.branch

      Hi There,

       

        Iam trying to pull a cell`s "Time Stamp" information in Expedition PCB but haven`t found a way yet.

      Does anyone have an idea?

       

       

      Regards Christopher

        • 1. Re: How to get the Time Stamp of a cell in xPCB
          matthias.cosaert

          Hi,

           

          You can get this in the cell editor, see example:

           

          '---------------------------------------------------------------------------------------------
          ' connect to expedition PCB (internal script)
          '---------------------------------------------------------------------------------------------
          Scripting.AddTypeLibrary("MGCPCB.ExpeditionPCBApplication")
          Scripting.AddTypeLibrary ("CellEditorAddin.CellEditorDlg")

          ' Global variables
          Dim pcbAppObj  : Set pcbAppObj = Application                 'Application object
          Dim pcbDocObj  : Set pcbDocObj = pcbAppObj.ActiveDocument    'Document object

          ValidateServer(pcbDocObj)
          '---------------------------------------------------------------------------------------------
          Dim CellEdObj,CellDB


          Set CellEdObj = pcbDocObj.CellEditor

           

          Set CellDB = CellEdObj.ActiveDatabase

          for each Partition in CellDB.Partitions
          For each Cell in Partition.cells

            str = str & Cell.name & ":" & Cell.LastModification & vbnewline

          Next
          Next

          Set CellDB = nothing
          Set CellEdObj = nothing

          msgbox str

          '=============================================================
          ' Validate server function
          '=============================================================
          Private Function ValidateServer(doc)
             
              Dim key, licenseServer, licenseToken

              ' Ask Expedition’s document for the key
              key = doc.Validate(0)

              ' Get license server
              Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")

              ' Ask the license server for the license token
              licenseToken = licenseServer.GetToken(key)

              ' Release license server
              Set licenseServer = nothing

              ' Turn off error messages.  Validate may fail if the token is incorrect
              On Error Resume Next
              Err.Clear

              ' Ask the document to validate the license token
              doc.Validate(licenseToken)
              If Err Then
                  ValidateServer = 0   
              Else
                  ValidateServer = 1
              End If

          End Function
          '=============================================================

          1 of 1 people found this helpful