'---------------------------------------------- '---------Creation Information----------------- '---------------------------------------------- ' 'Name: draindata 'Author: Cindy How 'Date: 6/16/97 ' '---------------------------------------------- '------------Purpose/Description--------------- '---------------------------------------------- ' 'This script will take use the node theme and put 'data into the table created by the script '"draininput". The user is to click on drains 'which are active (have inflow) and will be prompted 'for necessary information. ' 'Note: This script may need to change depending 'on if changes are made due to the node/junction 'relationship. Presently, each node corresponds 'to a drain. Each "Inode" in the inodes.shp attribute 'table corresponds with a "Isbl_ref" value in the 'drains.dbf table. Record numbers correspond 'in both tables. ' '----------------------------------------------- '-------------------Input----------------------- '----------------------------------------------- ' '1. Theme inodes.shp '2. Attribute table of inodes.shp '3. Empty table drains.dbf ' '----------------------------------------------- '------------------Output----------------------- '----------------------------------------------- ' '1. Filled table drains.dbf ' ' '----------------------------------------------- '------------Get Initial Information------------ '----------------------------------------------- TheView = av.GetActiveDoc TheTheme = TheView.findTheme("inodes.shp") TheFtab = TheTheme.GetFtab Tabname = av.GetProject.FindDoc("drains.dbf") DrainTab = TabName.GetVtab DrainTab.SetEditable(True) '----------------------------------------------- '-----------------Find Fields------------------- '----------------------------------------------- NFld = TheFtab.FindField("Node") RefFld = DrainTab.FindField("ISBL_ref") FFld = DrainTab.FindField("Flow_rate") TFld = DrainTab.FindField("Temperatur") CFld = DrainTab.FindField("Concentrat") DFld = DrainTab.FindField("Diameter") SFld = DrainTab.FindField("Sealed") OFld = DrainTab.FindField("Oil_frac") '----------------------------------------------- '------------User Prompted Data Entry----------- '----------------------------------------------- NewPt = TheView.GetDisplay.ReturnUserPoint PtOnTheme = TheTheme.FindByPoint(NewPt) if (PtOnTheme.isEmpty) then Msgbox.error("That point is not found, try again","Not found") exit end rec=PtOnTheme.get(0) Inodenum = rec + 1 refList = List.Make for each record in DrainTab Refnum = DrainTab.ReturnValue(reffld,record) RefList.Add(RefNum) end rec = RefList.FindByValue(INodeNum) 'record number in DrainTab ChoiceList = {"Change sealed/unsealed","Enter flow data"} Option = MsgBox.ChoiceAsString(ChoiceList,"Edit which characteristics?","User Input") Idx = ChoiceList.FindByValue(option) If (Idx = 0) then seal = DrainTab.ReturnValue(Sfld,rec) if (seal = 1) then stype = "Open" else stype = "Closed" end labels = {"Open drain","Closed drain"} NewSeal = MsgBox.ChoiceAsString(labels,"The drain is presently flagged as"++stype+". Indicate the drain type.","User Input") ListIdx = labels.FindByValue(NewSeal) If (ListIdx < 0) then MsgBox.Info("No change made to the drain characteristics") exit elseif (ListIdx = 0) then DrainTab.SetValue(Sfld,rec,1) else DrainTab.SetValue(Sfld,rec,2) end elseif (Idx = 1) then OldFlow = DrainTab.ReturnValue(FFld,rec).AsString OldTemp = DrainTab.ReturnValue(TFld,rec).AsString OldConc = DrainTab.ReturnValue(CFld,rec).AsString OldDiam = DrainTab.ReturnValue(DFld,rec).AsString OldOilF = DrainTab.ReturnValue(OFld,rec).AsString labels = {"Flow rate (L/s)","Temperature (C)","Concentration (mg/L)","Diameter (m)","Oil fraction (by volume)"} defaults = {oldflow,oldtemp,oldconc,olddiam,oldoilf} OutList = MsgBox.MultiInput("Change the values for your selected drain","User Input",labels,defaults) If (OutList.IsEmpty) then MsgBox.Info("No changes made to the drain","Cancel") exit else NewFlow = OutList.Get(0).AsNumber NewTemp = Outlist.Get(1).AsNumber NewConc = Outlist.Get(2).AsNumber NewDiam = Outlist.Get(3).AsNumber NewOilF = OutList.Get(4).AsNumber DrainTab.SetValue(FFld,rec,NewFlow) DrainTab.SetValue(TFld,rec,NewTemp) DrainTab.SetValue(CFld,rec,NewConc) DrainTab.SetValue(DFld,rec,NewDiam) DrainTab.SetValue(OFld,rec,NewOilF) end else MsgBox.Info("No changes made to the drain","Cancel") end DrainTab.SetEditable(False)