# Box Weight Example DR

### HMI Panel File

<figure><img src="https://175138337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvxlh3prlGsBGF30oqbYW%2Fuploads%2FCshfYeP9EI27L51VgX7C%2Fimmagine.png?alt=media&#x26;token=23a347b9-5a03-450d-a0c8-183c8d32f623" alt=""><figcaption></figcaption></figure>

{% file src="<https://175138337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvxlh3prlGsBGF30oqbYW%2Fuploads%2FmQmMlM4BBEe0aiJlek4r%2Fbox_weight_hmi.hmi?alt=media&token=cb8f34c3-593c-454a-ac20-3b6845abdc2e>" %}

### Script File

```python
from DRCF import *

box_weight = 0
box_height = 0

set_external_force_reset()


def pick():
    global box_weight, box_height

    pose, _ = get_current_posx()
    pose[2] = 0
    
    task_compliance_ctrl()
    amovel(pose, v=50)
    while get_tool_force()[2] < 10 and get_current_posx()[0][2] > 10:
        wait(0.1)
    stop(DR_QSTOP)
    release_compliance_ctrl()

    box_height = get_current_posx()[0][2]
    set_digital_outputs([1, -2])
    wait(0.5)

    movel(posx(0, 0, -50, 0, 0, 0), ref=DR_TOOL)
    wait(1)
    box_weight = get_workpiece_weight()


def release():
    pose, _ = get_current_posx()
    pose[2] = box_height
    movel(pose, v=50)

    set_digital_outputs([-1, 2])
    wait(0.5)
    movel(posx(0, 0, -150, 0, 0, 0), v=100, ref=DR_TOOL)

```
