' Title: Uses a dialog input box tp populate the elevation field of the Junction table
' Topic: View, Tables
' Description: This script will populate the elevation field for the WatCad
' hydraulic modeljunction nodes. A DRG quad is needed identify the required contours
' value for input into a dialog box. The input is the calculated tothe record Elevation field.
' Requires: Must be associated with an Apply Event.
' Self:
' Results
'*************************************************************
theView = av.GetProject.FindDoc("MABELVALE ARCH") ' The View name goes here.
theConTheme = theView.FindTheme("Mab_node.shp") ' The Junction point file goes here
d = av.GetActiveDoc.GetDisplay
theConFTab = theConTheme.GetFTab
theConTheme = theView.GetThemes.Get(0)
theConTheme.SelectByPoint(d.GetMouseLoc, #VTab_seltype_new)
theConSel = theConFTab.GetSelection
if (theConSel.IsEmpty) then
MsgBox.Info ("No Node selected, Please make sure the pointer is on the node ", "Message")
exit
end
for each record in theConSel
theCurConSel = record
end
theElevField = theConFTab.FindField("Elevation2")
theNodeField = theConFTab.FindField("Label")
theElevation = theConFTab.ReturnValue(theElevField,theCurConSel)
theNode = theConFTab.ReturnValue(theNodeField,theCurConSel)
if ( theElevation > 0) then
MsgBox.Error("Junction Node Already has an Elevation"++NL++"The Elevation is:>>> "+theElevation.AsString ,"Elevation Notice")
exit
end
MsgBox.Info ("The Junction Node is: "+theNode++NL++"The Elevation is: "+theElevation.AsString,
"Attributes of Junctions & Elevations")
theTable = av.GetProject.FindDoc("Attributes of Mab_node.shp")
theVTab = theTable.GetVTab
theTable.PromoteSelection
theView.invalidate
theIdxNo = MsgBox.Input ("Enter JUNCTION NODE ELEVATION:", "ELEVATION INPUT", "")
if ( theIdxNo = nil) then
exit
end
theVTabNode = theConTheme.GetFTab
theBitMapNode = theVTabNode.GetSelection
theNodeFtab = theConTheme.GetFtab
theVTabNodeSel = theNodeFTab.GetSelection
if ( theVTabNodeSel.IsEmpty) then
MsgBox.Error("No Nodes Selected","")
'exit
end
if ( theVTabNodeSel.IsEmpty.Not) then
if ( theIdxNo = nil) then
exit
end
theNodeFTab.SetEditable(true)
'theVTabNode.Calculate(theIdxNO.Quote, theVTabNode.FindField("Elev")) 'Use this line if input is character field.
theVTabNode.Calculate(theIdxNO, theVTabNode.FindField("Elevation2"))
theNodeFTab.SetEditable(false)
end
theNodeFtab.refresh
theView.invalidate
if (theConTheme.IsActive.Not) then
theConTheme.SetActive(true)
end