Code snippets provide "short cuts" for frequently used pieces of code. You can insert snippets in your rules to enter strings of characters that you would normally have to type in using the keyboard. Snippets also reduce the possibility of typographical errors in your code.
You access the available snippets from the Snippets area of the Edit Rule dialog box. This area features two tabs:
Favorites allow you to choose which snippets appear on the System tab. You can mark specific snippets as favorites, and then toggle the display of the list to show only those snippets marked as favorites.
The Edit Snippet dialog box displays, with a copy of the snippet text in the Code text box.
Snippets are also saved when you click OK in the Edit Rule dialog box. The first time you save custom snippets, you are prompted to choose the save location.
Manage custom snippet categories
Once you have created custom snippets, arrange them in different categories.
Replace custom snippets from external file
Merge custom snippets from external file
Move or hide the Snippets area
Use the Pin symbol at the top of the Snippets area to customize its behavior.
Work with part and assembly parameters. Get or set single and multiple values, Excel spreadsheet values, or xml read/write parameters.
Suppress or activate (unsuppress) a component, replace one component with another component or an iPart, change the appearance of a component, or find a subcomponent.
Read data from and store data to an Excel spreadsheet. The spreadsheet can be an external file or embedded in the Inventor model.
Obtain path information about the current document, save the document, update the document, or open a new document.
Run other iLogic rules, rules in other components, external rules, Autodesk Inventor macros, and rules defined in VB.NET.
Access several mathematical routines and functions. Refer to the VB.NET documentation for complete details.
You can also access math snippets by right-clicking from within the rule text area and selecting Math Functions.
Declare and manipulate variables. Create shared variables to use between rules.
This category also includes snippets for “pure” VB.NET functions that allow you to use local (temporary) VB.NET variables in rules. Refer to the VB.NET documentation for complete details.
Use this dialog box to define or modify the contents of a snippet, or to change its name or category..
Access: | In the Edit Rule dialog box, right-click on a snippet in the Snippets area and select Edit. This dialog box also displays when you select the text of a snippet in the rule text area and select Capture Snippet from the context menu. |
| Title | The name of the snippet to display in the list. |
| Category | The category in which the snippet is placed. |
| Tooltip | The text of the tooltip to display when the mouse pointer hovers over the snippet in the list. |
| Use Code as Tooltip | Copy the text of the snippet into the Tooltip text box. The text can then be used as it appears in this field, or it can be edited as necessary. |
| Code | The text of the snippet, which can be edited in this field. |
| OK | Saves the edits. |
| Cancel | Cancels the operation. |