### iLogic brewing-main drawing sample

This sample demonstrates the iLogic managed assembly and drawing functions. The assembly functions have been in Inventor since the 2019 release. The drawing functions are new in the 2021 release.

Note: It's recommended that you close all other documents before opening this sample. Rules in this sample can create and open a large number of drawings. It also contains buttons that run rules to save all documents and close all drawing documents. These are meant to run only on documents created by this sample. You probably don't want these rules to run on your own files.

The assembly is a model of a brewing system. It provides several options that allow you to select different configurations.

#### This sample can:

- Generate assembly configurations dynamically using iLogic Assembly functions
- Create a drawing with dimensions for the top assembly
- Create drawing files or sheets for assembly components
- Set dimension style and dimension color in drawing files
- Save all documents (see note above)
- Close all drawing documents (see note above)

#### To see the sample in action:

- Activate the project : brewing-main.ipj
- Open the top-level assembly : brewing-main.iam
- Show the iLogic browser in the Inventor UI (using the Manage > iLogic > iLogic Browser command)
- Click on the Forms tab
- Launch the Configure form
- Make changes to parameters, then click the Apply button to update the model

If the Update Assembly Drawing option is checked, an assembly drawing will be opened and updated with the changes you make. The drawing contains a rule that will add dimensions when the corresponding components are added to the assembly.

The form looks like this:

#### Driving parameters shown in the form:

1. Tiers
2. kettleSize
3. burnerType
4. boilOverTrays
5. casters
6. UpdateAssemblyDrawing

#### Rules in the sample:

The assembly contains rules to configure both the assembly and the drawing. The rules to configure the assembly occur first in the list, and they run before the drawing rules. First the assembly is updated, then the drawing.

The assembly rules configure the different elements of the brewing system: frame, kettles, burners, feet, pumps, and boil-over tray. They use managed assembly functions on the ThisAssembly object.

The iLogic managed assembly functions don't provide a way to customize components. The MakeFrameAndKettles rule gets around this limitation by using custom code (in the TubeMemberMS function) to create new model states (or reuse existing ones) in the SquareTube part file. Each length of tubing is represented by a different model state.

The AssemblyDrawing rule opens and configures the main drawing, which shows the assembly. It runs the CreateDimensions rule in the drawing document. The CreateDimensions rule uses managed drawing functions through the ThisDrawing object.

The CommonFunction rule contains a class that is used in other rules with the AddVbRule statement. This technique is useful to avoid duplicating code. The code is written once and then reused.