I have a PDM add-in that performs some activities when a document is released. To implement this, I add a hook using:
poCmdMgr.AddHook(eCmdType:=EdmCmdType.EdmCmd_PostState)
Then, in the OnCmd function, I check for the correct command type and destination state, then execute the desired code.
Now I want the same add-in to perform some activities when a file is added to the vault using a template (i.e. using a template file with a template card). I tried to add this hook:
poCmdMgr.AddHook(eCmdType:=EdmCmdType.EdmCmd_PostAdd)
But OnCmd was not called. So I tried all these other hooks as well:
poCmdMgr.AddHook(eCmdType:=EdmCmdType.EdmCmd_PreAdd)
poCmdMgr.AddHook(eCmdType:=EdmCmdType.EdmCmd_PreCopy)
poCmdMgr.AddHook(eCmdType:=EdmCmdType.EdmCmd_PostCopy)
poCmdMgr.AddHook(eCmdType:=EdmCmdType.EdmCmd_PostUnlock)
And the only hook that calls OnCmd is EdmCmd_PostUnlock. I don't want my code running on every file check-in, so this is not ideal. I really want to be notified when the file is added via the template... How can I do this? Why does it seem like the hooks aren't working for template adds?
SolidworksSolidworks Pdm/enterprise Pdm