HOW TO
This document provides a sample Avenue script that will create a table containing the labels and RGB values for each classification in the active theme.
Code:
theview = av.getactivedoc
thetheme = theview.getactivethemes.get(0)
theleg = thetheme.getlegend.clone
aFilename =Filedialog.put("rgb.dbf".asFilename, "*.*", "Create Attribute Table")
thevtab = vtab.makenew(afilename, dbase)
thelblfld = field.make("AVlabel", #FIELD_CHAR, 20, 0)
therfld = field.make("R", #FIELD_DECIMAL, 5, 0)
thegfld = field.make("G", #FIELD_DECIMAL, 5, 0)
thebfld = field.make("B", #FIELD_DECIMAL, 5, 0)
thevtab.seteditable(true)
thevtab.addfields({thelblfld, therfld, thegfld, thebfld})
thenum = (theleg.getnumclasses - 1)
for each i in 0..thenum
thevtab.addrecord
thelist = theleg.returnclassinfo(i)
thelbl = thelist.get(0)
thesym = thelist.get(2)
thevtab.setvalue(thelblfld, i, thelbl)
thergblist = thesym.getcolor.getrgblist
thevtab.setvalue(therfld, i, thergblist.get(0))
thevtab.setvalue(thegfld, i, thergblist.get(1))
thevtab.setvalue(thebfld, i, thergblist.get(2))
end
thevtab.seteditable(false)
thetable = table.make(thevtab)
thetable.getwin.open
av.purgeobjects
Get help from ArcGIS experts
Download the Esri Support App