setgrid function

Set grid information