'---------Creation Information----------------- ' 'Name: hpselect 'Author: Cindy How 'Date: 6/16/97 ' '---------------------------------------------- '------------Purpose/Description--------------- '---------------------------------------------- ' 'This program will allow the user to input 'information on hard pipe connections. The node 'number (by the naUTilus numbering convention) 'will be saved to a new table, as well as informa- 'tion on flowrate, temperature, concentration, 'and oil fraction. ' 'This script is to be run with the script '"hardpipe". While "hardpipe" creates the table, 'this script allows the user to click on the node 'at which the hardpipe connection occurs and to 'specify the information needed. ' '----------------------------------------------- '-------------------Input----------------------- '----------------------------------------------- ' '1. Node theme (inodes.shp) '2. Attribute table of node theme '3. Empty table called hardpipe (created by script ' "hardpipe"). ' '----------------------------------------------- '------------------Output----------------------- '----------------------------------------------- ' '1. Data filled table called hardpipe ' '----------------------------------------------- '---------Getting initial data------------------ '----------------------------------------------- theProject=av.getProject TheView = av.GetActiveDoc TheTheme = TheView.FindTheme("inodes.shp") TheFtab = TheTheme.GetFtab BrTheme = Theview.Findtheme("Ibranch.shp") BrTab = BrTheme.GetFtab TabName = av.GetProject.FindDoc("hardpipe.dbf") HPTab = TabName.GetVtab HPTab.SetEditable(True) '----------------------------------------------- '-----------------Find Fields------------------- '----------------------------------------------- InodeFld = TheFtab.Findfield("Inode") NodeFld = TheFtab.FindField("Node") TypeFld = TheFtab.FindField("Node_Type") TNodeFld = BrTab.FindField("Tnode_") CFld=HPTab.FindField("Connect") FFld=HPTab.FindField("Flow_rate") TFld=HPTab.FindField("Temp") ConFld = HPTab.FindField("Conc") OilFld = HPTab.FindField("Oil_fraction") '----------------------------------------------- '----------------Get Point---------------------- '----------------------------------------------- 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) 'make dictionary of number of inflows to each node dinflows = Dictionary.Make(190) For each record in TheFtab dinflows.add(record.AsString,{}) end For each record in BrTab num = BrTab.ReturnValue(TnodeFld,record) TempList = dinflows.Get(num.AsString) TempList.Add(num) end TheNode = TheFtab.ReturnValue(InodeFld,rec) NNode = TheFtab.ReturnVAlue(NodeFld,rec) TheList = dinflows.Get(theNode.AsString) TheCount = TheList.Count NewCount = 1 For each record in HPTab TheCNode = HPTab.ReturnValue(CFld,record) if (TheCNode = NNode) then TheCount = TheCount + 1 NewCount = NewCount + 1 else end end If (TheCount < 3) then If (NewCount > 1) then AddHP = Msgbox.LongYesNo("A hard pipe connection already exists there. Add Another?","User Input",true) If (AddHp = False) then exit else end else end labels = {"Flow rate (L/s)","Temperature (C)","Concentration (mg/L)","Oil Fraction by volume"} defaults = {".1","20","1","0.0"} OutList = MsgBox.MultiInput("Enter hardpipe connection characteristics","User Input",labels,defaults) test = OutList.Count count = 0 For each record in HpTab count = count + 1 end If (test > 0) then InodeNum = theFtab.ReturnValue(InodeFld,rec) HpTab.AddRecord NodeNum = TheFtab.ReturnValue(NodeFld,rec) Flow = OutList.Get(0).AsNumber Temp = Outlist.Get(1).AsNumber Conc = Outlist.Get(2).AsNumber Frac = Outlist.Get(3).AsNumber if (count > 0) then recnum = count else recnum = 0 end HpTab.SetValue(Cfld,recnum,NodeNum) HpTab.SetValue(FFld,recnum,Flow) HPTab.SetValue(TFld,recnum,Temp) HPTab.SetValue(ConFld,recnum,conc) HPTab.SetValue(OilFld,recnum,frac) end else MsgBox.Info("Too many inflows at the node","Error") end HPTab.SetEditable(False)