I've been playing with copy tree with my addin. I'm trying to get the source folder variables and the destination folder variables. I am then planning on replacing the project number within the parts copied to the new project number for all configurations. I don't see a way to get the source files so I can pull the required variables. I'm executing copy tree from one folder and changing the destination to another (from 101 to 789). I'm assuming dispatch scripting would be better for this?
This is the code to add all events (for those that are curious how each event gets triggered):
public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr) { //Specify information to display in the add-in's Properties dialog box poInfo.mbsAddInName = "swEPDM_BOM"; poInfo.mbsCompany = "Dmitry Zamoshnikov"; poInfo.mbsDescription = "The most magnificent description of this wonderous addin"; poInfo.mlAddInVersion = 1; //Specify the minimum required version of SolidWorks Enterprise PDM poInfo.mlRequiredVersionMajor = 5; poInfo.mlRequiredVersionMinor = 2; // set up hooks //poCmdMgr.AddHook(EdmCmdType.EdmCmd_CardButton); //poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostAdd); //poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostLock); //poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreAdd); //poCmdMgr.AddHook(EdmCmdType.EdmCmd_Menu); foreach (EdmCmdType cmd in (EdmCmdType[]) Enum.GetValues(typeof(EdmCmdType))) { poCmdMgr.AddHook(cmd); // add each hook } }
These are the events that are triggered (in sequential order).
Copy Events get triggered when I copy paste (regular ctrl-c, ctrl-v). Are the copy operations w/in copy-tree not triggering the epdm copy events?
Crtl-c/v are Windows commands while Copy-Tree is a completely different SWPDM function. Since PDM does not have an actual folder structure it does not have to actually copy the files in the same way that Copy/Paste would do it. Copy-Tree would do most of the work in the database and then add a copy of it in the local view and make it ready for check in.
I have not looked into Copy-Tree in the API so I don't know if you can access it, but my thought is that if you want to use it you would have to call it directly from your add-in.