def make_scene(loc2):
    """Create a scene with a table and a cup, and return the state."""
    butil.clear_scene()
    objs = {}

    table = butil.spawn_cube(scale=(5, 5, 1), name="table")
    cup = butil.spawn_cube(scale=(1, 1, 1), name="cup", location=loc2)

    for o in [table, cup]:
        butil.apply_transform(o)
        parse_scene.preprocess_obj(o)
        tagging.tag_canonical_surfaces(o)

    assert table.scale == Vector((1, 1, 1))
    assert cup.location != Vector((0, 0, 0))

    bpy.context.view_layer.update()

    objs["table"] = state_def.ObjectState(table)
    objs["cup"] = state_def.ObjectState(cup)
    objs["cup"].relations.append(
        state_def.RelationState(
            cl.StableAgainst({t.Subpart.Bottom}, {t.Subpart.Top}),
            target_name="table",
            child_plane_idx=0,
            parent_plane_idx=0,
        )
    )

    # butil.save_blend('test.blend')

    return state_def.State(objs=objs)
Create a scene with a table and a cup, and return the state.
tests/solver/test_stable_against.py