'---------Creation Information----------------- ' 'Name: joindata 'Author: Cindy How 'Date: 2/24/97 ' '---------------------------------------------- '------------Purpose/Description--------------- '---------------------------------------------- ' 'This script will import data output from the naUTilus model 'as a .txt file and join it with the branch attribute table. '----------------------------------------------- '-------------------Input----------------------- '----------------------------------------------- ' '1. Attribute table for the theme branches.shp '2. Attribute table for the theme nodes.shp '3. Output file from the naUTilus model: dposblbr.txt '4. Output file from the naUTilus model: dposblnd.txt '----------------------------------------------- '------------------Output----------------------- '----------------------------------------------- ' '1. Updated attribute table with the flow rate, ' concentration, and temperature in each branch. ' '----------------------------------------------- '----------Set Working Directory---------------- '----------------------------------------------- CurrentDir=FN.GetCWD.AsString msgbox.info(Currentdir.AsString,"Your Current Working Directory is") ' '----------------------------------------------- '---------Getting initial data------------------ '----------------------------------------------- theProject=av.getProject TheView = av.GetActiveDoc ThemeList = TheView.GetThemes '----------------------------------------------- '-------Add Branch Data to table---------------- '----------------------------------------------- TheTheme=MsgBox.ChoiceAsString(ThemeList,"Choose the theme representing your branches.",ThemeList.Get(0).GetName) If (TheTheme = nil) then msgbox.info("No theme was selected","Exit") exit end TheFtab = TheTheme.GetFtab Field1 = TheFtab.FindField("Branches_i") TabName = "dposblbr.txt".AsFilename NewTab = Vtab.Make(TabName,false,false) Field2 = NewTab.FindField("Branch_id") '------------------------------------------------ '---------Add Node data to table----------------- '------------------------------------------------ NodeTheme = MsgBox.ChoiceAsString(Themelist,"Choose the theme representing your nodes.",ThemeList.Get(0).GetName) If (NodeTheme = nil ) then msgbox.info("No theme was selected","Exit") exit end NodeFtab = NodeTheme.GetFtab NField1 = NodeFtab.FindField("Nodes_id") NTabName = "dposblnd.txt".AsFilename NewNTab = Vtab.Make(NtabName,false,false) Nfield2 = NewNtab.FindField("Node") '------------------------------------------------------------ '------Join the attribute table to the naUTilus output------- '------------------------------------------------------------ ' TheFtab.Join(Field1,NewTab,Field2) NodeFtab.Join(Nfield1,NewNtab,NField2)