' Read Grids by Grid ' This script is used for extracting grid values based on a grid ' It was written by Timothy S. Thomas. ' Editing began on 9/4/00, and was last edited on 9/4/00. ' ********************************************************** ' Set up basic variables ' ********************************************************** ' This tells Arc/View that numerical output will be integer only. ' If we wanted decimal places, we would use something like ' "d.dd" Script.The.SetNumberFormat("d") theProject = av.GetProject theView = av.GetActiveDoc theThemeList = theView.GetActiveThemes selectorGTheme = theThemeList.Get(0) selectorGrid = selectorGTheme.GetGrid rowscols = selectorGrid.GetNumRowsAndCols nrows = rowscols.Get(0) ncols = rowscols.Get(1) recCnt = 0 numRecs = nrows*ncols ' ********************************************************** ' Select grids from which to extract data ' ********************************************************** ' Choose which view to extract data from themeList = List.Make dropList = List.Make gridList = List.Make dropList.Add(SelectorGTheme) i = 0 while (i <> 100) themeList.Empty for each thm in theView.GetThemes if (thm.Is(GTheme)) then themeList.Add(thm) end end for each thm in dropList themeList.RemoveObj(thm) end if (themeList.Count = 0) then MsgBox.Warning("No more grid themes in view","") Exit end gridTheme = MsgBox.ChoiceAsString(themeList, "Select grid theme from which to extract data", "Select grid theme") theGrid = gridTheme.GetGrid gridList.Add(theGrid) moreString = MsgBox.Input("Do you want to extract data from another grid?", "Another Grid?","Yes") if (moreString = "Yes") then i = 1 dropList.Add(gridTheme) else i = 100 end end theVTab = selectorGrid.Sample(gridList) theFN = FileDialog.Put((FileName.GetCWD.AsString + "temp.dbf").AsFileName, "*.dbf","Data file name") dataVTab = theVTab.Export(theFN,dBase,false) Table.Make(dataVTab) ' Removes garbage objects av.PurgeObjects