# Example Cases

## Area Calculation

You can measure areas of regions on a model with using the Math together with the Find Pattern and the Measure Distance functions. This example shows how to calculate the area of a rectangular part on a component.

1. Click Add and select the Find Pattern tool in the Inspect app step under Locate tools. Fixture A fixture is a coordinate location on the image that keeps the tool in the place determined by the fixture. the part so other tools can use that as a reference. For more information, see Find Pattern.

2. Click Add and select the Measure Distance tool in the Inspect app step under Measurement tools. Measure the width of the region of interest. The software sets up Find Edge tools to measure the region. Rename the tool to Width. For more information, see Measure Distance.

3. Click Add and select the Measure Distance tool in the Inspect app step under Measurement tools. Measure the height of the region of interest. The software sets up Find Edge tools to measure the region. Rename the tool to Height. For more information, see Measure Distance.

4. Click Add and select the Math tool under Math and Logic Tools. To add labels next to the values of your calculation, enter ' character in front of the name of the label. For this example, you can add Width, Height, and Area text labels as the header rows of the calculation table.

5. Link the properties of width by clicking the Insert Function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. and selecting Distance from the dropdown of the Width function. Link the properties of height by clicking the Insert Function and selecting Distance from the dropdown of the Height tool. For more information, see Math.

6. To calculate the area of the rectangular part enter the cell code of the width value, enter * for multiplying and the cell code of the height value. Math tool calculates the value.

   The cell values have references and they are visible in the Spreadsheet. Hover on the values to see the naming of the value, which can also be used for further calculations.

   You can also perform calculations using the reference names of the cell values.

   The calculations can be used in the HMI app step. For more information, see HMI.

## Assembly verification using Classify tool and Math and Logic tool

The Math tool allows you to perform assembly verification using the Classify Tool. Once the components have been located and identified, Math tool can provide a pass or fail result.

This example shows whether three components, a switch, a resistor, and a capacitor are assembled correctly on the part.

1. Click Add and select the Find Pattern tool in the Inspect app step under Locate tools. Fixture the part so other tools can use that as a reference. For more information, see Locate Tools.

2. Use the Classify tool under the Inspect app step ViDi EL tools to classify the components you need for the assembly. Label the different type of components to different classes. For more information, see Classify Tool.

   Add a new Classify tool to classify the switch. In this example there are three types of switches.

   Rename the tool to the name of the component by clicking on the icon of the Classify tool and enter the name of the component, in this case Switch, in the input field next to the Classify icon.

   The second component here is a resistor. To classify the state of the resistor add a new Classify tool. In this example there are two types of resistors and the case that the resistor is missing.

   Rename the tool to the name of the component by clicking on the icon of the Classify tool and enter the name of the component, in this case Resistor, in the input field next to the Classify icon.

   The third component here in this case a capacitor, which can have two states: properly inserted or leaning over. In this case the classification has two classes referring to whether the capacitor is placed correctly or not.

   Rename the tool to the name of the component, in this case Capacitor, by clicking on the icon of the Classify tool and enter the name of the component in the input field next to the Classify icon.

3. Go to Edit classes in the Classify tool to check if the components are labeled correctly.

4. Click Add and select the Math tool under Math and Logic Tools. For more information, see Inspect.
   1. Link each component classification result from the Classify tool to the Spreadsheet to separate cells. For more information on property linking, see Math.
   2. You can add text labels next to the values so when you load the job A job is a user-configured program in In-Sight 3D EasyBuilder consisting of functions and designed for specific applications. You can create and edit jobs using the In-Sight 3D EasyBuilder interface, and load them on a vision system for deployment in a live environment. later it is easier to identify what do the values refer to.
   3. You can use the ' character and entering the name after the ' character, or use the Name function. To use the Name tool click Link Tool Property, and select the name of the tool you want to insert, than select Name from the dropdown list.

      1. This example shows text labels for each component, switch, resistor, and capacitor, and also headers for the table:

         - The Expected column to show which are the correct components for the assembly.
         - The Found column to show the component of the assembly.
         - The Passed Column to show whether the component is correct or not.

5. Fill the Expected column with the classified names of the correct types of components using the ' character. In this case, the correct Switch is the one which is classified as YSA, the correct Resistor is the one which is classified as 5K, and the classified label for the correctly placed Capacitor is OK.

6. To set the Found column, use the Predicted Class function. Click Link Tool Property and select the name of the component and then Predicted class from the dropdown list.

   Repeat this with all the components.

7. To set the Passed column, insert or link the Exact function and enter the values you need to compare after Exact( in the format of Exact(Text1, Text2). This function allows you to perform string comparison. In this current case B1 is the cell reference for the expected and C1 is for the the found switch so the syntax of Exact is Exact(B1,C1).

   Repeat this with the values of Resistor and then the Capacitor.

   If the component is correct, Exact gives 1 as result; if the component is not correct, Exact gives 0 as a result.

8. Now you can set values for the assembly. In this example, the Score value shows the average of the three Passed values. To get an average value use the Mean function in the format of Mean(Value0,[Value1, ...]). You can set an overall tool pass threshold as a static value for the assembly verification. In this example, the pass value is set to 0.5 with a Threshold text label. You can adjust this value depending on the number of the components and the goal of the verification.

9. Then you can set a value to show whether the assembly score is above the threshold. In this example, the Score value is above the Threshold value, so the assembly verification gives a Pass result.