AnsweredAssumed Answered

Avenue Script

Question asked by jblundquist on Dec 15, 2017
Latest reply on Dec 19, 2017 by jblundquist

This is going back, but it's where I'm from. (a forever young 62 year old who just loves GIS and sometimes fall back to ArcView 3). -Pays off sometimes:)

I've been trying to run a script, my Avenue Book is nowhere to be found, and I'm a newbie.

this is what I'm working with:


Copy and Paste this script to the script window in ArcView (Use CTRL+V to paste):

‘ This script copies over node numbers from nodes.dbf and adds record
‘ numbers to the line theme feature table. It adds fields called RECORD#,
‘ FJUNCTION, and TJUNCTION to the line theme feature table. A network
‘ index directory must exist for the network theme before running this
‘ script.

‘ Get the view and the network theme. Substitute aViewName for the name
‘ of your view, and aThemeName for the name of your network theme.

aView = av.GetProject.FindDoc(“VIEW_NAME_HERE”)

aNetworkTheme = aView.FindTheme(“THEME_NAME_HERE”)
aNetworkThemeFTab = aNetworkTheme.GetFTab

‘ Get the nodes.dbf file, make the VTab object, and get its fields

aNetworkIndexDir = aNetworkTheme.AsString.Substitute(“shp”,”nws”)
aNodeFile = FN.Merge(aNetworkIndexDir, “nodes.dbf”)
aNodeVTab = VTab.Make(aNodeFile, false, false)
aFjunction = aNodeVTab.FindField(“Fjunction”)
aTjunction = aNodeVTab.FindField(“Tjunction”)

‘ Add Record#, Fjunction, Tjunction fields to network theme FTab

aRecordField = Field.Make(“Record#”,#FIELD_LONG,12,0)
aFjunctionField = Field.Make(“Fjunction”,#FIELD_LONG,12,0)
aTjunctionField = Field.Make(“Tjunction”,#FIELD_LONG,12,0)
aFieldList = {aRecordField,aFjunctionField,aTjunctionField}

‘ Use nodes.dbf to populate Rec#, Fjunction, Tjunction

Count = 0
for each r in aNetworkThemeFTab
aFromNodeNumber = aNodeVTab.ReturnValueNumber(aFjunction,Count)

aToNodeNumber = aNodeVTab.ReturnValueNumber(aTjunction,Count)
Count = Count + 1


aView = av.GetProject.FindDoc(“aViewName”)
aView = av.GetProject.FindDoc(“View1”) or the name that you have given the view.
aNetworkTheme = aView.FindTheme(“aThemeName”)
aNetworkTheme = aView.FindTheme(“nonetwork”) or the name that you have given the theme.

Click Script > Compile; then Script > Run


I have identified (I think) and corrected (I think) what needs to be fixed. e.g. comment lines, quotation marks, names, etc.


Just thought I'd ask. Hope this is appropriate for today and GeoNet.