Caleb Honeycutt

How to obtain the drawing that contains a part, from the part modelDoc itself?

Discussion created by Caleb Honeycutt on Feb 13, 2020
Latest reply on Feb 14, 2020 by Deepak Gupta

    Currently, we are working on trying to programmatically aid ourselves in migrating a massive amount of data into PDM from a flat file structure. There was no enforcement of rules in this structure, so the name of the drawing document that represents a part could possibly not have the same name as a part, while a majority of the drawings will have the same name as the part model document.

 

   So far, I have been successful in getting and sorting all the model documents contained in an assembly, and scanning PDM for a duplicate file name (even though adding it throws an exception for duplicate file names in the vault). Then in case there's multiple duplicates that it finds, there's an ActiveX wrapper with edrawings to visually compare the two files before replacing. The file then gets added and checked into PDM and a form pops up to enforce that data entry on the data card.

 

   Now that the file has been added to PDM, I go and delete the file from the file folder structure on the network and replace it with a txt file that says for the user to go to PDM to find their file. The part I'm stuck at is at this point is I have a model doc for the PDM file, a model doc for the network folder structure location, and the only way I can look at if there is a drawing associated to the part models is if it has the same name and is located in the same parent directory as the model document was located originally.

 

Without API, its easy to find the drawing by clicking the button to "Open drawing from Part", and when I try to do a macro record, it just magically comes up with the file name of the drawing and I don't know where it's getting all the info from to get there. The solidworks explorer tool comes up with sort of a best-case where used tool to use if I wanted to do this manually, but I want to do this all with API. Is there a way to use either document manager API or even 'regular' solidworks API to get to this magic link to the drawing from the part?

 

Thanks a TON for any help!! I'll be cruising the internet in the meantime, looking for something of any help.

Outcomes