3 Replies Latest reply on Apr 29, 2014 9:28 PM by Artem Taturevych

    trying to login to PDMworks

    Craig Makarowski

      Hi all, had this work once today now its broken when it gets to

       

           connection.Login "pdmwadmin", "pdmwadmin", "localhost"

      MacroErrorVB_Pdm.png

       

      I'm currently using SW2013 SP5 and Win 7 x64

       

      AM I missing something fundamental?

      I have my Environment Varible pointing to the correct place for SW2013 for the PDMworks dll

       

      Code as follows from an example

       

      Option Explicit

      Dim swApp As Object

      Dim swModel As ModelDoc2

      Dim swModelPart As ModelDoc2

      Dim swModelAssy As ModelDoc2

      Dim swModelDocExt As ModelDocExtension

      Dim swModelDocExtPart As ModelDocExtension

      Dim swCustProp As Object 'CustomPropertyManager

      Dim connection As PDMWConnection

      Dim user As String

      Dim password As String

      Dim Vault As String

      Dim value As Integer

      Dim doc As PDMWDocument

       

      Sub main()

       

      Set swApp = Application.SldWorks

      user = "pdmwadmin"

      password = "pdmwadmin"

      Vault = "loclhost"

           ' connect to pdmworks and login

           Set connection = CreateObject("PDMWorks.PDMWConnection")

           connection.Login "pdmwadmin", "pdmwadmin", "localhost"

       

          Dim alldocs As PDMWDocuments

       

          Set alldocs = connection.Documents

       

          Dim adoc As PDMWDocument

       

          Dim msgBoxStr As String

       

          For Each adoc In alldocs

       

              If LCase(Right(adoc.Name, 6)) = "sldprt" Then

       

                  msgBoxStr = msgBoxStr & "Part: " & adoc.Name & vbNewLine

       

                  msgBoxStr = msgBoxStr & "Assemblies where it is used:" & vbNewLine

       

                  Dim whereUsedList As PDMWLinks

       

                  Set whereUsedList = adoc.WhereUsed

       

                  Dim l As PDMWLink

       

                  For Each l In whereUsedList

       

                      If LCase(Right(l.Document.Name, 6)) = "sldasm" Then

       

                          msgBoxStr = msgBoxStr & "    " & l.Document.Name & vbNewLine

                          Debug.Print msgBoxStr

                     ' Stop

       

                      End If

       

                  Next

       

                  msgBoxStr = msgBoxStr & "----" & vbNewLine

       

              End If

       

          Next

       

          'Output.data = msgBoxStr

       

          'Output.Show

       

          connection.Logout

       

      End Sub