procedure(putOnGridCB(grid)
prog( (compFactor cv saveLayer theta p obj path loc error_cmd units rep)
if(!(rep = geGetEditRep()) then
hiDisplayModelessDBox('formHandle "Put On Grid"
"A cellView must be opened."
"" "")
return()
)
if( geGetSelSet() == nil then
hiDisplayModelessDBox('formHandle "Put On Grid"
"Nothing has been selected \n
Program works on only selected objects"
"" "")
return()
)
compFactor = 1 / rep~>DBUPerUU
units = rep~>userUnits
if(!compFactor then
hiDisplayModelessDBox('formHandle "Put On Grid"
"The CellView does not have the DBUPerUU property defined"
"" "")
return()
)
grids = parseString(grid)
xgrid = evalstring(nth(0 grids))
if(! numberp(xgrid) then
printf("Grid must be a number.\n")
return()
)
if(! (ygrid = nth(1 grids)) then
ygrid = xgrid
else
ygrid = evalstring(ygrid)
if(! numberp(ygrid) then
printf("Grid must be a number.\n")
ygrid = xgrid
)
)
printf("Snapping x-coordinates to nearest %f %s.\n" float(xgrid) units)
printf("Snapping y-coordinates to nearest %f %s.\n" float(ygrid) units)