Run SOLIDWORKS Macro
The Run SOLIDWORKS Macro Generation Task will run a SOLIDWORKS Macro.
Properties
| Property Name | Description |
|---|
| (Name) | The unique name for this task. |
| Macro File Path | The absolute path to the SOLIDWORKS macro file, including the .swp file extension. |
| Module Name | The name of the module in the Macro file to run. |
| Sub Routine | The name of the sub routine in the specified module to run (default is Main). |
Generation Sequence
This Task can be added to the following Generation
Sequence(s):
- Pre Drive (will be run before the Main Drive Sequence)
- Post Drive (will be run after the Main Drive Sequence) - see Example 1
- Pre Close (will be run before the SOLIDWORKS file is closed)
- Post Close (will be run after the file close sequence) - see Example 2
Examples
When this task is added the properties are static and dynamic.
See How To: Change A Static Property To A Dynamic Property to enable rules to be built on static properties.
Example 1
Typical SOLIDWORKS macro run when the Task is applied to the Post Drive generation sequence.
| Property Name | Property Value |
|---|
| Macro File Path | "D:\SOLIDWORKSMacros\Chamfer.swp" |
| Module Name | DriveWorks |
| Sub Routine | Main |
When the task is applied to the Post Drive generation sequence it will run the SOLIDWORKS macro named Chamfer.swp, located in the folder D:\SOLIDWORKSMacros.
The code for the macro will be run from the module named DriveWorks in the Sub-routine named Main.
The macro will run after the main drive sequence and before the Finish Up sequence begins.
Example 2
Typical SOLIDWORKS macro run when the Task is applied to the Post Close generation sequence.
| Property Name | Property Value |
|---|
| Macro File Path | "D:\SOLIDWORKSMacros\OpenFile.swp" |
| Module Name | DriveWorks |
| Sub Routine | Main |
When the task is applied to the Post Close generation sequence it will run the SOLIDWORKS macro named OpenFile.swp, located in the folder D:\SOLIDWORKSMacros.
The code for the macro will be run from the module named DriveWorks in the Sub-routine named Main.
The macro will run after the Close sequence.
The ability to run a SOLIDWORKS macro on Post Close has certain niche applications.
In almost all circumstances the macro will need to open the SOLIDWORKS file as an initial first step.
This is most suitable when generating SOLIDWORKS files using the Manual Queued Generation method.
When generating SOLIDWORKS files using Automatic Queued Generation (DriveWorks Autopilot), ensure the macro being run also closes the model to avoid any machine resource issues that DriveWorks Autopilot will require.
Please see How To Create A Macro To Run On A SOLIDWORKS File for information on SOLIDWORKS Macros.