'---------------------------------------------- '---------Creation Information----------------- '---------------------------------------------- ' 'Name: obrtab 'Author: Cindy How 'Date: 6/97 ' '---------------------------------------------- '------------Purpose/Description--------------- '---------------------------------------------- ' 'This script will use the branch theme of the 'ISBL system and, like DRAININPUT and CONNECTIVITY, 'continue to create the input file by describing 'the reach/branch characteristics as naUTilus requires. ' 'The required data is copied from the branch 'attribute table to a new table called obrtab.dbf ' '----------------------------------------------- '-------------------Input----------------------- '----------------------------------------------- ' '1. Attribute table for the theme obranch '2. Attribute table for the theme onode ' '----------------------------------------------- '------------------Output----------------------- '----------------------------------------------- ' '1. New table called obrtab.dbf holding the information ' on branch diameter, length, and slope needed ' to create part of the naUTilus input file. ' ' '----------------------------------------------- '---------Get Initial Information--------------- '----------------------------------------------- TheView = av.getActiveDoc BrTheme = theView.Findtheme("obranch.shp") BrTab = BrTheme.GetFtab NdTheme = theView.Findtheme("onode.shp") NodeTab = NdTheme.GetFtab 'Find Fields: BFld = BrTab.FindField("Osbl_") LFld = BrTab.FindField("Length") TFld = NodeTab.FindField("Node_type") NFld = NodeTab.FindField("Node") AFld = NodeTab.FindField("Ex_br") ArcFld = NodeTab.FindField("Arc_") NodeTab.SetEditable(true) '----------------------------------------------- '-------------Add New Table/Fields-------------- '----------------------------------------------- NewName = "obrtab.dbf".AsFilename NewTab = VTab.MakeNew(NewName,dBase) BNumFld = Field.Make("Branch",#Field_short,4,0) NewLFld = Field.Make("Length",#Field_Float,8,4) DiamFld = Field.Make("Diameter",#Field_Float,8,4) SlopeFld = Field.Make("Slope",#Field_Float,8,4) NewTab.AddFields({BNumFld,NewLfld,DiamFld,SlopeFld}) NewTab.SetEditable(true) '----------------------------------------------- '---------------Prompt for input---------------- '----------------------------------------------- defd = 1.0 defs = 0.01 DDiam = msgbox.input("Please enter the default diameter.","Default diameter",defd.AsString) Dslope = msgbox.input("Please enter the default slope.","Default slope",defS.AsString) numbr = 0 For each record in BrTab 'fill table with default values NewTab.AddRecord brlength = BrTab.ReturnValue(LFld,record) brnum = BrTab.ReturnValue(BFld,record) NewTab.SetValue(BNumFld,record,brnum) NewTab.SetValue(NewLfld,record,brlength) NewTab.SetValue(DiamFld,record,defd) NewTab.SetValue(SlopeFld,record,defs) numbr = numbr + 1 end For each record in NodeTab type = NodeTab.ReturnValue(TFld,record) if (type = 5) then NewTab.AddRecord brnum = numbr + 1 NodeTab.SetValue(AFld,record,brnum) NewTab.SetValue(BNumFld,numbr,brnum) NewTab.SetValue(NewLFld,numbr,1) NewTab.SetValue(DiamFld,numbr,defd) NewTab.SetValue(SlopeFld,numbr,defs) numbr = numbr + 1 else typ = NodeTab.ReturnValue(TFld,record) if (typ = -1) then Br = NodeTab.ReturnValue(ArcFld,record) NodeTab.SetValue(AFld,record,br) else end end end NodeTab.SetEditable(False) NewTab.SetEditable(False) TheTab = Table.Make(NewTab) TheTab.SetName("obrtab.dbf") '----------------------------------------------- '---------------------END----------------------- '-----------------------------------------------