2 Replies Latest reply on Sep 2, 2016 10:00 AM by Joe Pickens

    API PDM PRO get description from datacard

    Joe Pickens

      I am trying to use api to get the component info

       

      first off i am having issues based on if checked in or out status

       

      If the sheet is checked out i get an error in this code. it runs fine when the sheet is checked in.

         Set EPDMRefs2 = EPDMRefs.GetNextChild(EPDMPos)

       

      Secondly I cant figure out how to pull an item description. I am attempting to use this code to do it but it puts noting in the EPDMVar variable.

       

      boolstat = EnumVar.GetVarAsText("Description", configname, EPDMSearchR.ParentFolderID, EPDMVar)

        • Re: API PDM PRO get description from datacard
          Joe Pickens

          Is there any way in with API ti get the Discription from the datacard in PDM PRO

          • Re: API PDM PRO get description from datacard
            Joe Pickens

            here is the answer

            so in my code i have

            Dim EnumVar             As IEdmEnumeratorVariable10

            Dim EPDMFile2          As IEdmFile9

            Dim boolstat               As Boolean

            Dim Var                      As Variant

             

            'where my EPDMFile2 is my solidworks part.

             

            Set EnumVar = EPDMFile2.GetEnumeratorVariable()

             

                        'when you look in the solidworks help it shows this as the def

             

            'Function GetVar2( _

            '   ByVal bsVarName As System.String, _

            '   ByVal bsCfgName As System.String, _

            '   ByVal lFolderID As System.Integer, _

            '   ByRef poRetValue As System.Object _      (In VBA Define as Variant)

            ') As System.Boolean

             

            ' as you may notice and what gave me the most issues until i figured it out is that the last value stated to be a system object

                 'dose not work in the VBA/Macro world you have to define it as a variant not an object. and then it will give you the text value

                 ' where as you can see here i am writing to an Excel cell.

             

                        boolstat = EnumVar.GetVar2("Description", "@", EPDMFile2.LockedInFolderID, Var)

             

                        Sheets(1).Range("B9").Offset(i, 0).value = Var