Blog 5.21.2012 4 Comments


Enterprise PDM is, no doubt, SolidWorks Corp’s flagship PDM package. This has been the case already for a few years. That being said, Workgroup PDM is not dead and remains a great data management solution for small to mid-sized companies. Savvy CAD managers will still want to use the Workgroup PDM API, and for that reason I am pleased to present to you some WPDM API resources I have collected over the years.

First, let’s review how to create a very simple WPDM macro using VBA. This code simply saves out revision “A-02+” of part “block.sldprt” from the vault to “C:\Shop Floor”. You will see that I am using the default WPDM user name and password. The vault is located on a server with DNS name “dataserver”. Also note that before this code will run you must have the “SolidWorks Workgroup PDM 1.0 Type Library” referenced under Tools –> References (if using VBA).

And now the code.

Dim myPDMConn As New PDMWConnection
Dim myDoc As PDMWDocument
Dim strDocName As String
Sub Main()
    Set myPDMConn = CreateObject("PDMWorks.PDMWConnection")
    myPDMConn.Login "pdmwadmin", "pdmwadmin", "dataserver"
    myPDMConn.Refresh
    strDocName = "block.sldprt"
    Set myDoc = myPDMConn.GetSpecificDocument(strDocName, "A-02+")
    myDoc.Save "C:\Shop Floor"
    myPDMConn.Logout
End Sub

As you can see, the API calls are fairly straightforward. If you want to see what else is available in the WPDM API then just go to the local API Help and under the top level of the Contents tab look for “SolidWorks Workgroup PDM API Help”. For the online version go here. Some of the more notable capabilities of the WPDM API include:

  • Checking data in and out
  • Saving from the vault
  • Querying the vault
  • Export queried data to Excel, Access, SQL Server, or Oracle
  • Triggers (notifications)
  • Store trigger information in a database

A great PDF that covers all of this was written by Jerry Winters as part of an excellent presentation delivered at SolidWorks World 2008 called “Making the most of the PDMWorks API”. Most of the examples are in VB.NET, by the way.

Another notable WPDM API presentation was delivered at SolidWorks World 2004 called “Using the PDMWorks API to Automate PDM Communication, Integration, and Analysis”. That presentation is still available here. Note that the code samples are written in VB6, so unless you still have an old copy of Visual Studio 6.0 installed, you might have a tough time getting to the code.

Finally, don’t forget about the SolidWorks API forums. Presently, within the documents section, there is one WPDM API example covering triggers.

Know of any other useful WPDM API resources? Please share in the comments.

Enjoy!

Want to keep up with new CADSharp.com content? Sign up for our newsletter.


4 Comments

  1. shabbaranks

    Hi,

    Im looking to learn EPDM API I have a basic knowledge of VBA and have found your videos useful but Im looking to take it a step further – do you have any suggestions?

    Thanks

  2. dmctiernan

    Hi Keith,
    Do you know of an alternative link for the presentation given at SolidWorks World 2004 called “Using the PDMWorks API to Automate PDM Communication, Integration, and Analysis”? Or maybe you could share a copy?

    Thanks,
    Declan.

Questions and Comments

You must be logged in to post a comment.