Hi all,I have never used Avenue scripts. In fact when I was going through forum I realized it was about in the year 2000 that the change from .ave to vba had started taking place. That time I was probably in high school 😛Anyways,, is there any documentation that gives information on library changes from avenue to vba. I basically want to convert the following avenue script to vba.. Can anyone please help me with that :tView = av.GetActiveDoc
tdisp = av.GetActiveDoc.getdisplay
atheme = tView.GetThemes.get(0)
tGrid = atheme.GetGrid
CellSize = tGrid.GetCellSize
theGridExtent = tGrid.GetExtent
top = thegridextent.gettop
bottom = thegridextent.getbottom
left = thegridextent.getleft
right = thegridextent.getright
userPoint = tdisp.ReturnUserPoint
x = userPoint.GetX
y = userPoint.GetY
userCellValue = tGrid.CellValue(userPoint,Prj.MakeNull)
coordfile = FileDialog.Put("xyz.dbf".AsFileName,"*.*","File")
theVtab = Vtab.MakeNew(coordfile,dbase)
coortable = Table.Make(theVtab)
coortable.SetName("High Points Blocking View")
PntType = Field.Make("Coord Type",#FIELD_CHAR,12,0)
theAzmth = Field.Make("Azimuth",#FIELD_DECIMAL,10,3)
Pntx = Field.Make("x",#FIELD_DECIMAL,25,4)
Pnty = Field.Make("y",#FIELD_DECIMAL,25,4)
theAngle = Field.Make("View Angle",#FIELD_DECIMAL,25,4)
theVtab.AddFields({PntType,theAzmth,Pntx,Pnty,theAngle})
rec = theVtab.AddRecord
theVtab.SetValue(PntType,rec,"User")
theVtab.SetValue(Pntx,rec,x)
theVtab.SetValue(Pnty,rec,y)
av.ShowStopButton
for each azimuth in 0..359
tmpPoint = Point.MakeNull
oldCellValue = userCellValue
distance = CellSize
azimuthR = azimuth.AsRadians
x2 = x
y2 = y
higherPt = false
While ( (x2 < right) and (x2 > left) and (y2 < top) and (y2 > bottom))
a = distance * azimuthR.sin
b = distance * azimuthR.cos
x2 = x + a
y2 = y + b
if ( (x2 < right) and (x2 > left) and (y2 < top) and (y2 > bottom)) then
tmpPoint.SetX(x2)
tmpPoint.SetY(y2)
NewCellValue = tGrid.CellValue(tmpPoint,Prj.MakeNull)
x3 = x2
y3 = y2
if ( NewCellValue > OldCellValue) then
OldCellValue = NewCellValue
x4 = x3
y4 = y3
higherPt = true
end
end
distance = distance + CellSize
doMore = av.SetWorkingStatus
if (not doMore) then
exit
end
end
rec = theVtab.AddRecord
theVtab.SetValue(PntType,rec,"Calculated")
theVtab.SetValue(theAzmth,rec,azimuth)
if (higherPt = true) then
HowFar = ( ((x - x4)*(x - x4)) + ((y - y4)*(y-y4))).sqrt
height = NewCellValue - userCellValue
hyp = ( (HowFar*HowFar) + (height*height)).sqrt
theVtab.SetValue(Pntx,rec,x4)
theVtab.SetValue(Pnty,rec,y4)
theVtab.SetValue(theAngle,rec,HowFar/hyp)
else
theVtab.SetValue(Pntx,rec,x3)
theVtab.SetValue(Pnty,rec,y3)
theVtab.SetValue(theAngle,rec,1)
end
end
av.ClearWorkingStatus
total = 0
for each rec in theVtab
total = total + theVtab.ReturnValue(theAngle,rec)
end
total = (total/360) * 100
Msgbox.Info("The sky seen index is " + total.asString,"INFO")
Thanks !Priyanka