What are snippets?
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:
What are favorite snippets?
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.
Work with System snippets
Define favorite snippets
Display favorite snippets
To display only your favorite snippets, click the favorites toggle at the top of the System tab.
To display all snippets, click the favorites toggle again.
Copy System snippets to Custom snippets
A copy of the snippet is placed on the Custom tab, in the same category as it appears on the System tab. If the category does not exist, it is created.
Work with Custom snippets
Create a Custom snippet
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.
Edit a custom snippet
Replace custom snippets from external file
Merge custom snippets from external file
Delete a custom snippet
To delete a custom snippet, right-click on the snippet, and select Delete.
Create custom snippet collections for specific projects
Move or hide the Snippets area
Use the Pin symbol at the top of the Snippets area to customize its behavior.
System snippet categories
Work with part and assembly parameters. Get or set single and multiple values, Excel spreadsheet values, or xml read/write parameters.
Turn a feature on or off, change the color, or work with threads.
Suppress or activate (unsuppress) a component, replace one component with another component or an iPart, change the color of a component, or find a subcomponent.
Access several different iProperties of a part, assembly, or component.
Excel Data Links
Read data from and store data to an Excel spreadsheet. The spreadsheet can be an external file or embedded in the Inventor model.
Manipulate table-driven iFeatures.
Manipulate assembly model constraints.
Measure distances, angles, areas, perimeters, and extents.
Provide access to Inventor work features.
Display messages or quickly construct a simple UI to obtain user input while a rule is running.
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 Autodesk Inventor Bill of Material functionality.
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.
Access several string routines. Refer to the VB.NET documentation for complete details.
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.
Access various material properties stored on the component definition in the Inventor API model.
Manipulate sheet metal models from iLogic rules.
Reflect changes to the model in the drawing sheets and views.
Advanced Drawing API
Can be used to take advantage of API functions in drawings.
Access the Autodesk Inventor API.
Use this dialog box to define or modify the contents of a snippet, or to change its name or category..
|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.|