PDMWorks 2006 API - add links between documents
PDMWorks 2006 API - add links between documents
(OP)
We're using PDMWorks 2006 SP 5.0 to store our the CNC programs for our waterjet. We model the parts in Solidworks, make a drawing, and create the CNC program. We then add all these documents to PDMWorks, creating a link between the SLDDRW file and CNC program. (The CNC
program is an attachment of the SLDDRW). The part and drawing files go into PDMWorks easily enough, but the CNC programs are a little more difficult. We have to drag them one at a time from an Explorer window onto the appropriate SLDDRW file, tell PDMWorks that yes, I really
want to add this file as an attachment and go through the check-in screen. Since some projects may have dozens or hundreds of CNC programs, this results in mistakes or files that do not get vaulted.
Here's what I'd like to do. Since I know that every SLDDRW has an identically named CNC program, I can go through all the files in a directory, look for the CNC programs, strip off the extension, location the SLDDRW with the same name in PDMWorks, and add the CNC
program to PDMWorks as an attachment to the SLDDRW. I can do most of that, until the part where I need to add the link between documents.
Let's say I have a PDMWorks document. I can use this code to find all the attachments:
dim oDoc as PDMWorks.PDMWDocument
dim oLink as PDMWorks.PDMWLink
dim oLinks as PDMWorks.PDMWLinks
oDoc = oConnection.GetSpecificDocument("foo.SLDDRW")
oLinks=oDoc.Attachments
for Each oLink in oLinks
Debug.print (oLink.Name)
next oLink
However, I can't seem to find anything that lets me add a link to the oLinks collection, something along the lines of oLinks.Add(oPDMWDocument). There's something in the PDMWConnection.CheckIn method, but it seems to apply only to MS Excel and Word documents.
So, here's my question. How can I add the link between two documents in PDMWorks 2006 SP5.0?
Thanks,
Chris
Note: originally posted in the SolidWorks API group here:
htt p://groups .google.co m/group/So lidWorks-A PI/browse_ thread/thr ead/9a32c1 27f021c772
program is an attachment of the SLDDRW). The part and drawing files go into PDMWorks easily enough, but the CNC programs are a little more difficult. We have to drag them one at a time from an Explorer window onto the appropriate SLDDRW file, tell PDMWorks that yes, I really
want to add this file as an attachment and go through the check-in screen. Since some projects may have dozens or hundreds of CNC programs, this results in mistakes or files that do not get vaulted.
Here's what I'd like to do. Since I know that every SLDDRW has an identically named CNC program, I can go through all the files in a directory, look for the CNC programs, strip off the extension, location the SLDDRW with the same name in PDMWorks, and add the CNC
program to PDMWorks as an attachment to the SLDDRW. I can do most of that, until the part where I need to add the link between documents.
Let's say I have a PDMWorks document. I can use this code to find all the attachments:
dim oDoc as PDMWorks.PDMWDocument
dim oLink as PDMWorks.PDMWLink
dim oLinks as PDMWorks.PDMWLinks
oDoc = oConnection.GetSpecificDocument("foo.SLDDRW")
oLinks=oDoc.Attachments
for Each oLink in oLinks
Debug.print (oLink.Name)
next oLink
However, I can't seem to find anything that lets me add a link to the oLinks collection, something along the lines of oLinks.Add(oPDMWDocument). There's something in the PDMWConnection.CheckIn method, but it seems to apply only to MS Excel and Word documents.
So, here's my question. How can I add the link between two documents in PDMWorks 2006 SP5.0?
Thanks,
Chris
Note: originally posted in the SolidWorks API group here:
htt






RE: PDMWorks 2006 API - add links between documents
Chris
SolidWorks 06 5.1/PDMWorks 06
AutoCAD 06
ctopher's home (updated 02-10-07)
RE: PDMWorks 2006 API - add links between documents
The method that ctopher suggests uses the design binder to either link or embed the files into the Solidworks drawing file using the design binder. If you link them, they don't go into PDMWorks unless you explicitly add them to PDMWorks, which is the same situation we're trying to fix. If you embed them, they aren't listed as a separate file and are therefore not accessible without opening the SLDDRW file, opening the file in the editor, and saving as.
Regards,
Chris
RE: PDMWorks 2006 API - add links between documents
I suggest having a separate project folder in PDMW that is used specifically for the CNC files. Have the machine shop have read/write access to them and read access to the models.
I don't know which CNC software you use, but I know with CAMWorks there is code written with the part file than can be updated to the CNC file when they see it has changed.
Having this automated can cause errors because not all code gets updated correctly 100% into the CNC file from the part.
Chris
SolidWorks 06 5.1/PDMWorks 06
AutoCAD 06
ctopher's home (updated 02-10-07)
RE: PDMWorks 2006 API - add links between documents
The PDMWConnection.CheckIn method looks to be your best bet. From the documentation, it does not sound like it will do what you want either, but here are some things you might try.
- Check the drawing in with the CNC files listed in its references. The documentation says that this is honored for only Word and Excel files, but the documentation might be out of date.
- See if you can use the PDMWConnection.CheckIn method to check a CNC file into a project and see if it works and where it ends up. Maybe you could accomplish what you desire with a CNC file subproject.
- If you can check CNC files in with PDMWConnection.CheckIn try using the name of the drawing file (name plus extension) as the project name in the CheckIn call. This is a reach but it might work.
- Append .xls or .doc to the end of your CNC file names and then include them in the list of references while checking in the drawing. The other program that copies them to the network accessible location could possibly strip them out.
- Skip PDMWorks and have your program that is trying to check them in copy them directly to the network location.
The API developers may not have exposed the ability to do what you are trying, even though it seems legitimate. It is possibly an oversight. In the past, handleman has mentioned e-mailing SolidWorks’ API support. If all else fails, you could try contacting them.Eric