Does anyone have any C# sample code to get me started using the PDMWorks API?
I have a couple of vba macros. If you think you could dissect them to figure out what you need, I could send them to you.
Are you asking about Workgroup or Enterprise? The API documentation for Enterprise PDM 2014 has newly added examples in C#.
This is for Workgroup, not EPDM.
I would like to stick to C# because I am more familiar with it.
I'm having trouble figuring out how to initialize the connection object before calling login on it.
I am only familiar with VBA so I can't attest to how to initialize in C#.
In VBA the prodedure goes:
Dim pdmConn as PDMWConnection
set pdmConn = CreateObject("PDMWorks.PDMWConnection")
pdmConn.LogIn "user", "password", "server name or IP address"
Hopefully, you can find someone that can convert this to C#.
Well I gave up and went to VB.
Could you please send those examples you mentioned?
I am sending the .txt versions to you. Make sure you reference the Solidworks Workgroup PDM 1.0 Type Library under Tools>References to access the members.
You can init the connection in c# something like this:
PDMWConnection pdmConn;pdmConn = Activator.CreateInstance(Type.GetTypeFromProgId("PDMWorks.PDMWConnection")) as PDMWConnection;pdmConn.LogIn ("user", "password", "server name or IP address");
pdmConn = Activator.CreateInstance(Type.GetTypeFromProgId("PDMWorks.PDMWConnection")) as PDMWConnection;
pdmConn.LogIn ("user", "password", "server name or IP address");
Artem Taturevych, Application Engineer at Intercad (Australia)
translationXpert – add-in to translate SolidWorks models
myIntercad – an integrated tool for SolidWorks Professionals
LinkedIn SolidWorks API Education Group
Hi Artem Taturevych,
I have tryed to establish a connection as you proposed. Unfortunetly it doesn't works. The Expression Type.GetTypeFromProgId("PDMWorks.PDMWConnection")) returns null. I have also tryed it with Version dependent progID as you can see in the following snapshot:
But both expressions returns null, so that the connection throws an error.
I have installed SolidWorks 2017 SP5 and PMD Workgroup 2017 in an Windows 10 environment. The links to the PDM libraries you can see in the following snapshot:
What else am I doing wrong?
Thanks for ur help!
dll files wasn't proper registered in the registry.
Fix it first with regsvr32 in Windows\System32 like this
regsvr "C:\Program Files\Common Files\SolidWorks Shared\pdmworks.dll"
then Register it with regasm somewhere in Microsoft.NET Folder like this:
regams "C:\Program Files\Common Files\SolidWorks Shared\PDMWorks.Interop.pdmworks.dll /codebase"
restart your PC and after opening Visual Studio check if in Project properties the Checkbox prefer 32 Bit System is unchecked.
Retrieving data ...