'This script use the unit and projection setted by View Propertied to calculated 'polygon area, the results are added as new field to the theme. 'Copyright@ zhou, Japan zhou@ies.kyushu-u.ac.jp 'Modified by Sim sim@ecoline.ru (field name & multiple themes added) theView = av.GetActiveDoc thmList = theView.GetActiveThemes for each thmThemeIn in thmList aPrj = theView.GetProjection ftbOutput = thmThemeIn.getftab ftbOutput.SetEditable(true) newAreaField = MsgBox.Input("Enter a name for the new AREA field (up to 8 characters):","Area","Area") if (newAreaField = Nil) then exit end fidAreaOut = ftbOutput.FindField(newAreaField) if(fidAreaOut = nil) then fieldname = newAreaField ftbOutput.AddFields({Field.Make(fieldname, #FIELD_FLOAT, 20, 5)}) else fidAreaOut = ftbOutput.FindField(newAreaField) end IDout = ftbOutput.FindField("WID") if(IDout = nil) then fieldname = "WID" ftbOutput.AddFields({Field.Make(fieldname, #FIELD_LONG, 8, 0)}) else IDout = ftbOutput.FindField("WID") end IDout = ftbOutput.FindField("WID") p = 0 for each r in ftbOutput p = p + 1 nRecNew = p - 1 ftbOutput.SetValue(IDout,nRecNew,nRecNew) end if (thmThemeIn.GetFTab.GetSelection.Count > 0) then polyToProcess = thmThemeIn.GetFTab.GetSelection else polyToProcess = thmThemeIn.GetFTab end fldShapeIn = thmThemeIn.GetFTab.FindField("shape") fidAreaOut = ftbOutput.FindField(newAreaField) 'Begin processing polycount = 0 for each r in polyToProcess polycount = polycount + 1 polyin = thmThemeIn.GetFTab.ReturnValue(fldShapeIn,r) polyID = polycount llength = polyin.returnlength polyin1 = polyin.ReturnProjected (aPrj) aarea = polyin1.ReturnArea nRecNew = ftbOutput.ReturnValue(IDout, r) ftbOutput.SetValue(fidAreaOut,nRecNew,aarea) end ftbOutput.RemoveFields({IDout}) end