By registering to the correct hooks in the GetAddInInfo method and by using poCmd.Cancel = 1 in the OnCmd method, your add-in can cancel certain events in PDM to prevent users from performing operations like deleting a critical file, checking in a document with incomplete metadata, or renaming an inappropriate part. This is the primary tenet for best practice data management and enforcement.
PDM Event Hooks: Your Control Panel
| You can also cancel tasks during the EdmCmd_TaskLaunch hook. The following table provides an overview of the cancellable events that are available in your local SOLIDWORKS PDM vault. The use of these hooks is crucial to develop an add-in that will validieren mit PDM (validate with PDM) and maintain data integrity. |
| Command Type | Description |
| EdmCmd_PreExploreInit | Executed before a new instance of File Explorer is created. Used to personalize vault view tabs before display. |
| EdmCmd_PreAdd | Raised when a file is on the verge of being included in the vault. Utilized to provide naming conventions or verify file types. |
| EdmCmd_PreAddFolder | Raised when a new folder is on the verge of being added. Utilized for pre-creation verification or logic. |
| EdmCmd_PreCopy | Raised before copying a file. Provides an opportunity for custom processing or verification. |
| EdmCmd_PreCopyFolder | Raised prior to copying a folder. Utilized for pre-copy logic. |
| EdmCmd_PreDelete | Raised before deleting a file. A critical precaution against mistaken or unauthorized deletions. |
| EdmCmd_PreDeleteFolder | Triggers before a folder is deleted. Allows pre-deletion checking. |
| EdmCmd_PreGet | Triggers before getting a file from the vault (e.g., Get Latest/Get Version). Offers control over get. |
| EdmCmd_PreLabel | Triggers before creating a label. Useful in checking the creation of our content in the label. |
| EdmCmd_PreLabelDelete | Triggers before deleting a label. Allows checks before deletion. |
| EdmCmd_PreLabelModify | Triggers before changing a label. Allows checking or pre-modification processing. |
| EdmCmd_PreLabelAddItem | Occurs before putting an item in a label. Suits validation or custom processing. |
| EdmCmd_PreLock | Occurs before check-out of a file. Suitable for pre-check-out validation. |
| EdmCmd_PreMove | Occurs before moving a file. Supports pre-move validation or processing. |
| EdmCmd_PreMoveFolder | Occurs before moving a folder. Supports folder move validation. |
| EdmCmd_PreRename | Occurs before renaming a file. Suitable for pre-rename checks or custom processing. |
| EdmCmd_PreRenameFolder | Occurs before renaming a folder. Suits pre-rename validation. |
| EdmCmd_PreShare | Occurs before a file is shared between two folders. Implements pre-share logic. |
| EdmCmd_PreState | Triggered before setting the state of a file in a workflow. A strong hook for implementing challenging business rules. |
| EdmCmd_PreUndoLock | Triggered before undoing a check-out (equivalent to check-in of an unmodified file). |
| EdmCmd_PreUnlock | Triggered before the check-in of an updated file. Employs significant pre-check-in validation. |
A Practical Approach to API-Based PDM Customization
Here’s how you would do this using the SOLIDWORKS PDM API Tip:
- Subscribe to the Hook: For Example, in your add-in’s GetAddInInfo method, subscribe to the EdmCmd_PreUnlock hook. This tells PDM to call your add-in before a file check-in.
- Intercept the Command: When a user attempts to check in a file, your OnCmd method is invoked.
- Check for the Comment: In OnCmd, you get the properties of the command to determine if a user comment has been input.
- Cancel if Needed: If no comment is provided, you set poCmd.Cancel = 1. That will cancel the check-in operation immediately. You can then return an empty, short message to the user, like “A check-in comment is needed to finish this action.”
As an example, you could use the EdmCmd_PreState hook to cancel certain events in PDM and prevent a file from moving into a “Released” state if all required data card variables are not filled out. This method of validation with PDM Blue guarantees that all files in your environment are complete and correct, protecting your data integrity right from the beginning.
Our Experts Are Here to Help You
For expert add-in development and professional SOLIDWORKS support, visit Blue Byte System Inc. We specialize in offering services to improve productivity and streamline your workflows.

