2 Replies Latest reply on Jan 19, 2016 1:06 PM by Greg Thomson

    Calling IEdmBatchAdd::CommitAdd() within Convert Script

    Greg Thomson

      Does anyone know how to call IEdmBatchAdd::CommitAdd() via a Convert script (i.e. VBA script).  I can't reference the EPDM component within the script, and so don't have access to the EdmFileInfo structure...  doesn't appear to like any variation of Object or Variant.

       

      Dim pdmFileInfo() As Object ' EdmFileInfo

      errors = pdmBatchAdd.CommitAdd(0, pdmFileInfo, 0, Nothing)

       

      Thanks,

       

      Greg,

      EPDM 2014 SP4

        • Re: Calling IEdmBatchAdd::CommitAdd() within Convert Script
          Charley Saint

          Can you show how pdmBatchAdd is declared. BatchAdd has to be run initiated as a utility, in VB it looks like this (no idea what VAB requires):

           

          batchAdder = vault2.CreateUtility(EdmUtility.EdmUtil_BatchAdd)

            • Re: Calling IEdmBatchAdd::CommitAdd() within Convert Script
              Greg Thomson

              Here's how I get my batchAddr...  The key here is in SolidWorks VBA you have a PDM Type Library reference, but in a VBA Convert script you loose all your types... enumerations, interfaces, datatypes, etc.

               

                  ' Grab the batch add utility

                  Dim pdmBatchAdd As Object 'IEdmBatchAdd2

                  Dim utility As Long

                  utility = 16 ' EdmUtil_BatchAdd

                  Set pdmBatchAdd = pdmVault.CreateUtility(utility)

               

              This all worked fine, but couldn't get CommitAdd() to work.  So abandoned code and got it working with IEdmFolder::AddFile().  Appears the more complex data types don't easily migrate across the COM interface.  I would imagine if I was a VBA guru, there's some sort of conversion I could do.

               

              Greg