2 Replies Latest reply on Apr 8, 2015 10:43 AM by Chris Champions

    workgroup PDM references and whereused

    Chris Champions

      I remember to see a code sample of how to list all ref and whereused files - Now I tried to find it but I couldn't

      Anyone has any idea how to find it

      Thank you

        • Re: workgroup PDM references and whereused
          Keith Rice

          You can use the Document Manager API to get all Where Used references. This way you don't need to get any PDM system involved. See ISwDMDocument::WhereUsed.

           

          If you must accomplish this with Workgroup PDM, then there is a method called IPDMWDocument::WhereUsed that you can use. Here is a resource for how to use WPDM API: Workgroup PDM API Resources

           

          Keith

          SolidWorks API Training

            • Re: workgroup PDM references and whereused
              Chris Champions

              Here is the code and it doesn't seem working -

               

                  myPDMConn.Login sUserName, sPassword, sServerName
                  myPDMConn.Refresh
                 
                  Dim myPDMDoc As PDMWDocument
                  Set myPDMDoc = myPDMConn.GetSpecificDocument(FileName)
                  Dim myPDMDocs As PDMWDocuments
                  Set myPDMDocs = myPDMConn.Documents
                  Debug.Print "source file: " & myPDMDoc.Name
                  For Each myPDMDoc In myPDMDocs
                      If LCase(Right(myPDMDoc.Name, 6)) = "sldprt" Then
                          Dim myPDMRefList As PDMWLinks
                          Set myPDMRefList = myPDMDoc.References
                          Dim myPDMLink As PDMWLink
                          For Each myPDMLink In myPDMRefList
                              If LCase(Right(myPDMLink.Document.Name, 6)) = "sldasm" Then
                                  'lstCheckList.AddItem "Next Assemly: " & myPDMLink.Name
                                  Debug.Print "Next Assemly: " & myPDMLink.Name
                              End If
                          Next
                      End If
                  Next
                  myPDMConn.Logout