As far as I can tell, you can't access the CL through Automation. The Padstacks would need to be local.
You may not realize it, but your question is vague. The simplest answer is that there is already an automated tool that brings padstacks from the CL into your design. It's Library Services. Then to replace them within the PCB design is another issue.
It would be helpful to know exactly what you are trying to do, and why. I say this because there are several ways to accomplish what you trying to do, but the details make all the difference.
Each of the following is slightly different:
- You want to replace one or just a few selected padstacks which have been locally modified with the default padstack of the same name from the CL.
- You want to replace all padstacks on a PCB design with a padstack of a different name from the CL.
- You want to do a custom modification to a padstack in the CL, give it a new and different name from the one it was created from, and then replace some padstacks on the PCB with the new one.
There are more possible scenarios.
You may want to check out this thread, where I describe a possible scenario of creating custom padstacks in a CL. It assumes you will use Library Services to pull the new padstacks into your design and then some other methods, either manual or automated, to replace some or all padstacks in a PCB design with the new ones.
So as I said, please describe exactly what you want to do, and how you'd want the script to behave, and we can take it from there to help you find a solution.
As I understand it, Mark wants/needs to update a number of padstacks in a (large) number of design - hence the use of automation instead of Library Services. There is an existing Idea (Enhancement Request) to add Automation for Library Services (https://communities.mentor.com/ideas/5758)
One possible way to attack the issue is this
1) Create a new Central Library that contains only the padstacks to get updated
2) Make a copy of the prj file (just to keep the original settings)
3) Modify the prj file to your needs, setting the pointer to the interim Central Library and desired 'Project Integration' Settings
4) Start Xpedition as a background job (from a MGC Shell with ‘mgcscript’) - see
5) Inside Xpedition, run the Forward Annotation
6) Close Xpedition again
7) Copy back prj file from the backup file.
Hints for the above process
Page 5029 (for VX.2.2) of the Xpedition Automation Manual has an example on how to use the ProjectIntegration Object.
https://communities.mentor.com/docs/DOC-3503 has code that shows how to invoke xPedition from a MGC PCB CMD Shell.
Please note that I have NOT tried the above ;-)