Custom Check

Writing Macros

Use SOLIDWORKS macros to perform custom Design Checker validations. Create a macro, then register it with the Design Checker.

To create a macro:

Click Tools > Macro > New. The macro procedure cannot have arguments. Call SetCustomCheckResult in the Design Checker API to indicate what to show on the result page, passing one of the following values:

true

the check passes

false

the check fails

Read about Custom Check in the Design Checker API Help for information about Design Checker objects and methods.

Registering Macros

Register the macro in the Custom Checks dialog box in the Build Checks application:

Name Assign a name to the validation check.
Macro File Path Path to the file containing the macro. Click to browse to the file.
Module Name.Procedure Name Select the macro name, for example, custom_check1.main
Applicable SW Document Select the type of document to validate, one of drawings, parts, or assemblies.

Storing Macros

Custom check macros are stored with the standards file to make it easier to distribute the correct combination of standards and macros to multiple users.

  • When you save a standards file that includes a custom check, the associated macro is saved with that standards file.
  • To use an updated macro:
  • Go to the Document's Custom Check window where you added the macro. Reselect the Macro File Path and the Module Name.Procedure Name.