# Pick&Place programs¶

The following chapter contains variants of the Pick&Place program that build on each other:

1. Create a basic Pick&Place program
2. Extension: Movement optimization
5. Extension: Add case distinction and user dialog

What you will learn

• Parameterization of "Compare-String", "Condition" and "User Dialog" functions
• Linking of output values in function blocks
• Flow logic of the "Condition" function block

## Extension: Add case distinction and user dialog¶

### Step-by-step Guide¶

1. The basis of the program is the Pick&Place program with input parameters from the previous chapter. Make sure that the naming of the function blocks is identical to this program.

2. Duplicate and name the previous program.

3. Duplicate the third Move Cartesian Block.

4. Remove the 4th waypoint in the original Move Cartesian Block Now name the function block "Move to Test Position".

5. Remove the first three waypoints in the duplicated Move Cartesian Block.

#### NOK distinction¶

1. For the now following NOK distinction add three new function blocks after the Move Cartesian Block "Move to test position": User Dialog , Compare-String and Condition.

#### 1. User Dialog¶

1. The User Dialog in this program is intended to simulate the testing of the workpiece by asking the operator for "OK or NO OK".

2. Edit the block User Dialog and enter a corresponding question in Message (e.g. "Workpiece OK").

3. To define the answers, name one button with "Yes" in the Button Text (and e.g. "yes" in the Button Result Code) and another with "No".

4. Save the settings for the User Dialog block.

#### 2. Compare String¶

1. In the Compare-String block the operand 1 must now be connected to the output value of the User Dialog Block.

2. Click on in operand 1 and select Result - String.

3. The condition "==" remains unchanged.

4. Enter "yes" in operand 2 or the text of the button Result Codes from the User Dialog block.

#### 3. Condition¶

1. Edit the function block Condition and connect the input value via the Connect Value to the output parameter "Compare String - Result".

2. Save the settings.

3. You now have the possibility to define the processes for both conditions ("Then" and "Else") in the Condition.

4. Drag the duplicated Move Cartesian block from point (5) into the Then field.

5. Drag the three remaining blocks Simulator Gripper - Open, Drive to approach position and Home position also into the Then field.

6. Also add the function block Simulator Reset -Grid to the last position of the "Then" field.

7. Now duplicate all function blocks in the "Then" field and drag them into the "Else" field.

8. Change the parameters of the first Move Cartesian block and define a new approach and deposit position for the workpiece (e.g. at the left edge of the table). Copy the data of the approach position.

9. Parameterize the second Move Cartesian block from the "Otherwise" field insert the copied values of the approach position into the first waypoint Save the settings.

10. Remove the function block "Simulator Reset - All".

11. Ready! The placement positions of the workpiece are now determined by the answers of the User Dialog and you have built a distinction in the Pick&Place program.
(You can download the program here. At "My Programs" -> you can load external programs into drag&bot.)

### Further information:¶

NOK distinction

The NOK distinction classifies the treated workpiece as "OK" (O.K.) or "not OK" (N.O.K.). In practice, this check is usually carried out using sensors. In the following tutorial, however, the sensor is simulated by a user dialog box.