'---------Creation Information----------------- ' 'Name: dropdata 'Author: Cindy How 'Date: 6/17/97 ' '---------------------------------------------- '------------Purpose/Description--------------- '---------------------------------------------- ' 'This program was created from an old version of 'CREATETAB. It is to be run in conjunction with 'the new version of CREATETAB. It will add a 'record to the drop.dbf table for each drop and 'fill in values of that table. The user will be 'prompted to select or accept some default values. ' '----------------------------------------------- '-------------------Input----------------------- '----------------------------------------------- ' '1. Empty table drops.dbf '2. Theme inodes.shp '3. Attribute table of inodes.shp '4. Theme ibranch.shp '5. Attribute table of ibranch.shp ' '----------------------------------------------- '------------------Output----------------------- '----------------------------------------------- ' '1. Filled table called drops.dbf ' '----------------------------------------------- '---------Getting initial data------------------ '----------------------------------------------- theProject=av.getProject TheView = av.GetActiveDoc BrTheme = theView.FindTheme("ibranch.shp") BrTab = BrTheme.GetFtab NdTheme = TheView.FindTheme("inodes.shp") NdTab = NdTheme.GetFtab TabName=av.GetProject.FindDoc("drops.dbf") DropTab = TabName.GetVtab ' '----------------------------------------------- '----------------Find Fields-------------------- '----------------------------------------------- 'InDropTab NFld = DropTab.FindField("Node") BFld = DropTab.FindField("Branch") HFld = DropTab.FindField("Height") TFld = DropTab.FindField("Tailwater") 'InNdTab NdFld = NdTab.FindField("Node") 'InBrTab BrFld = BrTab.FindField("Ibranch_") TNdFld = BrTab.FindField("Tnode_") '------------------------------------------------ '-------------Set Default Values----------------- '------------------------------------------------ height = 1 depth = 0.5 '------------------------------------------------ '---------------Get Branch Data------------------ '------------------------------------------------ NewPt = TheView.GetDisplay.ReturnUserPoint PtOnTheme = BrTheme.FindByPoint(NewPt) If (PtOnTheme.IsEmpty) then MsgBox.Error("That point is not found, try again","Not found") exit end rec = PtOnTheme.Get(0) BrNum = BrTab.ReturnValue(BrFld,rec) Tnode = BrTab.ReturnValue(TNdFld,rec) NodeRec = Tnode - 1 '------------------------------------------------ '---------------Get Node Data-------------------- '------------------------------------------------ NNodeNum = NdTab.ReturnValue(NdFld,NodeRec) '----------------------------------------------- '------------Add and fill records--------------- '----------------------------------------------- labels = {"Height (m)","Tailwater depth (m)"} defaults = {height.AsString,depth.AsString} OutList = MsgBox.MultiInput("Enter the drop characteristics","User Input",labels,defaults) test = OutList.Count count = 0 For each record in DropTab count = count + 1 end If (test > 0) then DropTab.AddRecord Ht = OutList.Get(0).AsNumber Twd = Outlist.Get(1).AsNumber if (count > 0) then recnum = count else recnum = 0 end DropTab.SetValue(NFld,recnum,NNodeNum) DropTab.SetValue(BFld,recnum,BrNum) DropTab.SetValue(HFld,recnum,Ht) DropTab.SetValue(TFld,recnum,Twd) Else MsgBox.Info("No drop added at that location.","No Drop") end