3 Replies Latest reply on Mar 10, 2017 11:32 AM by Benoît Varret

    Excel API to show epdm BOM

    Joe Schaeffer

      I am new to the forums so hopefully this is all posted correctly in the right place....

       

      I am trying to make a macro in excel that will take an inputted file name and folder name and, going to epdm, grab the BOM and print it in the excel document.  I am trying to compare this BOM to another BOM grabbed from a different program and make sure they are correct, all in one click.

       

      I'm fairly new to this language, and I have tried both GetComputedBOM and GetDerivedBOMs commands with little success.  I can't seem to get the formatting right.  I have looked all over the Solidworks help and forums and haven't found an extremely clear way to do this.

       

      Any advice?

        • Re: Excel API to show epdm BOM
          Artem Taturevych

          Please post the code you have so far and also clarify what exactly do you mean by wrong formatting. I used to use GetComputedBOM API before with no problems (not in 2014 - may be this is the case i do not know).

          ______________________________________________

          Regards, Artem Taturevych | Snr. Developer | IC3D ANZ

           

          IC3DSteel – New Steel Solution for SolidWorks

          translationXpert – SolidWorks files language translator

          LinkedIn - SolidWorks API Group

            • Re: Excel API to show epdm BOM
              Joe Schaeffer

              I am using 2014 but hopefully that doesn't cause any problems.

               

              My problem is with the first input for GetComputedBOM. After using the solidworks API help, my code looks something like this:

               

                  Dim ppoRetLayout As EdmBomLayout

                 

                  bomMgr = objVault.CreateUtility(EdmUtility.EdmUtil_BomMgr)

                  bomMgr.GetBomLayouts (ppoRetLayout)

                 

                  bomview = objFile.GetComputedBOM(ppoRetLayout.mbsLayoutName, 0, "@", 1)

               

              I'm not sure what that first ppoRetLayout.mbsLayoutName input is supposed to be and how to get the correct format.

            • Re: Excel API to show epdm BOM
              Benoît Varret

              I'm trying to do the same with ePDM 2016 and Excel 2010.

              My code is :

              Public Sub Nomenclature()

                   Dim eVault              As IEdmVault9

                   Dim aFile               As IEdmFile7

                   Dim bomView             As IEdmBomView

                   Dim derivedBOMs()       As EdmBomInfo   

                   'Dim ppoRows()          As Variant

                   'Dim ppoRow             As IEdmBomCell

                   Dim sMachine            As String  

               

                  'Vault connection

                   Set eVault = New EdmVault5  

                   eVault.LoginAuto eVault.GetVaultNameFromPath("C:\BD\"), 0      

               

                  'assembly whom bom is requested  

                   sMachine = ThisWorkbook.Sheets("CONFIGURATION").Range("B4").value  

                   Set aFile = eVault.GetFileFromPath(sMachine)      

                   bomView = aFile.GetComputedBOM("NOMENCLATURE_LT", -1, "@", EdmBomFlag.EdmBf_AsBuilt)

              End Sub

               

              This is the begining of my code and I've got execution error 91 on the last line. I've checked in the vba references windows :

              • PDMWorks Entreprise 2016 Type Library
              • EPDMLib 1.0 Type Library

               

              Any Idea ?