' Example.Centroid ' Generates report of centroids for selected polygons in active theme '**** get theme theTitle = "Centroids" theView = av.GetActiveDoc ThemeList = theView.GetActiveThemes if (ThemeList.Count <> 1) then MsgBox.Info("One Theme must be active",theTitle) exit end theTheme = ThemeList.Get(0) if (theTheme.Is(FTheme).Not) then MsgBox.Info("Active Theme is not an FTheme",theTitle) exit end theFTab = theTheme.GetFTab if (theFTab.GetShapeClass.GetClassName <> "Polygon") then MsgBox.Info("Active Theme is not a Polygon Theme",theTitle) exit end theSelection = theFTab.GetSelection if (theSelection.Count = 0) then MsgBox.Info("At least one record must be selected",theTitle) exit end '**** do it! theMsg = "" sf = theFTab.FindField("shape") for each r in theSelection thePolygon = theFTab.ReturnValue(sf,r) theMsg = theMsg + "Polygon" ++ r.AsString if (thePolygon.IsNull) then theMsg = theMsg ++ "is null. Clean up your data!" + NL elseif (thePolygon.AsList.Count > 1) then theMsg = theMsg ++ "is multipart." + NL else theCentroid = av.Run("Polygon.ReturnCentroid",{thePolygon}) theMsg = theMsg ++ "centroid is" ++ theCentroid.AsString + NL end end MsgBox.Report(theMsg,theTitle)