Manage Scripts
The Manage Scripts node in the ATR CustomTools Administration is used to manage the ATR CustomTools script add-ins. Script add-ins can be associated with several ATR CustomTools features such as Export, available in the SOLIDWORKS Add-In. Script add-ins are usually used for generating customized reports with the Export feature, but they can also be used to customize other ATR CustomTools operations like file conversion.
Script add-in development is not included in the ATR CustomTools maintenance subscription of any license level. If your ATR CustomTools environment needs functionality customizations that require a script add-in, please contact the ATR CustomTools Sales Team or use the Contact form available on the ATR CustomTools website for further information about script add-in possibilities and pricing.
Scripts whose assembly file (.dll) is missing, and scripts that have changed since the last compilation, are automatically compiled on the next startup of ATR CustomTools Administration, ATR CustomTools Viewer, and/or the ATR CustomTools add-in in SOLIDWORKS.
The script files are located in the following path on the local hard drive:
| Selected script |
Open the desired script for editing. The script code appears in the editor area automatically once the script is selected.
If your script does not exist in the list that opens from the Selected script box, click
Select <New Script> to create a new script. |
| Remove Script | Removes the selected script from the ATR CustomTools database. The script is not deleted from the disk with the Remove script command. |
| Name | Sets the name for the new script. |
| Language | Determines the programming language used to develop the script. When you open an existing script, the Language is read from the script and the correct programming language appears automatically in the Language box. |
| Class name |
Sets the startup method of the script. Scripts may have several methods. A class selected in the Class name box determines the one to be called on script startup. If the script has only one class, the class name appears automatically in the Class name box on load and no alternative startup classes are available. |
| Load at start-up | Enable or disable automatic loading of the selected script on startup of ATR CustomTools Administration, ATR CustomTools Viewer, and the ATR CustomTools add-in in SOLIDWORKS. |
| Debug add-in | The Debug add-in option allows you to develop your script add-in on the fly with Microsoft Visual Studio. With Visual Studio, you can debug and develop the source code of your add-in script implemented, for example, using the Microsoft C# programming language. |
The line number and character number are shown below the script area to make it easier to locate issues if the script does not compile successfully.
| Add | Add a new referenced assembly. Referenced assemblies (.dll files) you have added appear in the Referenced assemblies list. |
| Edit | Edit reference. |
| Remove | Remove the selected assembly reference. |
| Additional Files | Upload any kind of files used by the script into the database. |
You can define the required Referenced assemblies in the script code using @AUTO-REFERENCE tags. Only one referenced assembly can be on the same row, so if the script needs more referenced assemblies, add each as its own row.
For Example:
In a script that is written in C# programming language which needs the referenced assemblies called, Interop.CTEngineLib.dll, CTInterface.dll and System.Windows.Forms.dll, the referenced assemblies are defined in the beginning of the script code (even before the "using..." statements) as follows:
- //@AUTO-REFERENCE { [CT_INSTALL_PATH]\Interop.CTEngineLib.dll }
- //@AUTO-REFERENCE { [CT_INSTALL_PATH]\CTInterface.dll }
- //@AUTO-REFERENCE { [ASSEMBLY_PATH]\ExampleReference.dll }
- //@AUTO-REFERENCE { C:\Windows\Microsoft.NET\Framework64\v2.0.50727\System.Windows.Forms.dll }
The referenced assemblies defined in the script code are parsed and added to the Referenced assemblies list when you compile the script by clicking Compile or check in the script into the database by clicking Check In.
ATR CustomTools script add-ins should be developed using the same version of Microsoft .NET Framework as ATR CustomTools uses. Since ATR CustomTools 2015, at least Microsoft .NET Framework 4.5 is required. Microsoft .NET Framework 4.5.1 is recommended.
| Compile | Compiles the script. |
| Check In |
Compile the script and save changes into the database. The script is always compiled before its changes are saved. If compiling does not succeed, you are prompted to decide whether or not to save the script anyway. After Compile and Check-In, a message box indicates whether the compile was successful. If any errors occurred, they are included in the message. |
| Ln | Shows the current line number where the cursor is located vertically. |
| Ch | Shows the character number where the cursor is located horizontally. |
While compiling the script in ATR CustomTools Administration, automatic references are parsed. All references with the [ASSEMBLY_PATH] attribute in the path are verified during compilation to ensure the reference files exist in the script add-in's output path.