How to calculate the area of a specific layer in a window

Version 1

    Hi,

    I would like to write a simple Calibre Tcl script that can do the following things:

    1. Calculating the area of a specific layer in a window (ex. area of all M1 shapes in a  1um X 1um window).

    2. Calculating the area of all overlaps between two layers in a window (ex. area of all overlaps between M1 and V1 in a  1um X 1um window).

    3. Iterating the window on an entire design with a specific step.

    I have no experience in writing Calibre Tcl code and I think that asking these simple questions here would be the most efficient way to get the answers for them.