'---------------------------------------------- '---------Creation Information----------------- '---------------------------------------------- ' 'Name: sortpoint 'Author: Cindy How 'Date: 4/97 ' '---------------------------------------------- '------------Purpose/Description--------------- '---------------------------------------------- ' 'This script will take all points in the inodes.shp theme 'and find which are terminal points (elbows vs online drains 'or manholes). ' '----------------------------------------------- '-------------------Input----------------------- '----------------------------------------------- ' '1. Attribute table for the theme nodes ' '----------------------------------------------- '------------------Output----------------------- '----------------------------------------------- ' '1. Added field to node theme, indicating elbow (-1) ' or online drain or manhole (numbered) ' '----------------------------------------------- '---------Get Initial Information--------------- '----------------------------------------------- TheProject = av.GetProject TheView = av.GetActiveDoc ThemeList = TheView.GetThemes TheTheme=MsgBox.ChoiceAsString(ThemeList,"Choose the theme representing your nodes.",ThemeList.Get(0).GetName) If (TheTheme = nil) then msgbox.info("No theme was selected","Exit") exit end TheFtab = TheTheme.GetFtab TheField = TheFtab.FindField("Inodes") BrTheme = MsgBox.ChoiceAsString(ThemeList,"Choose your branch theme.",ThemeList.Get(0).GetName) If (BrTheme = nil) then msgbox.info("No theme was selected","Exit") exit end BrTab = BrTheme.GetFtab TNodeField=BrTab.FindField("Tnode_") FnodeField = BrTab.FindField("Fnode_") '----------------------------------------------- '-----Add New Fields to Node Attribute Table---- '----------------------------------------------- TheFtab.setEditable(true) TypeFld=Field.make("Node_Type",#Field_short,4,0) NodeFld=Field.make("Node",#Field_short,4,0) TheFtab.AddFields({TypeFld,NodeFld}) TNodeList = List.Make 'Makes List of "to Nodes" Fnodelist = list.make 'makes a list of "from nodes" i=0 For each rec in BrTab TNode = BrTab.ReturnValue(TNodeField,i) TNodeList.Add(Tnode) Fnode = BrTab.ReturnValue(FnodeField,i) Fnodelist.Add(Fnode) i = i +1 end j= 1 'Assigns value of -1 to the field "Node_Type" for terminal nodes For each rec in TheFtab Check = TNodeList.FindbyValue(j) If (check = -1) then TheFtab.SetValue(TypeFld,rec,check) else TheFtab.SetValue(TypeFld,rec,1) end Check2 = FnodeList.FindByValue(j) If (check2 = -1) then TheFtab.SetValue(typeFld,rec,2) 'set type value of last node in system to 2 Else end j = j+1 end k = 1 for each rec in TheFtab type = TheFtab.ReturnValue(TypeFld,rec) if (type = -1) then elseif (type = 2) then TheFtab.SetValue(NodeFld,rec,-1) else TheFtab.SetValue(NodeFld,rec,k) k=k+1 end end