/// <summary> /// Creates maps based on surface results. The maps can be displayed in the documentation. /// </summary> /// <param name="element">Revit element for which result document is built</param> /// <param name="resultsInPoints">Result in point collection</param> /// <param name="resultTypes">The type of results, values and description that can be displayed on the maps.</param> /// <returns>Returns list of documets maps based on results that can be displayed in the documentation</returns> private List <DocumentMap> CreateResultMapSeriesForSurfaceElements(Element element, ICollection <ResultInPointSurface> resultsInPoints, IEnumerable <Tuple <ResultTypeSurface, string> > resultTypes) { List <DocumentMap> vDocMap = new List <DocumentMap>(); MapDataGenerator mapPoints = new MapDataGenerator(); foreach (Tuple <ResultTypeSurface, string> forceDesc in resultTypes) { List <double> resData = resultsInPoints.Select(s => s[forceDesc.Item1]).ToList(); if (resData.Max(s => (Math.Abs(s))) < 1.0e-8) { continue; } AnalyticalModel slab = element as AnalyticalModel; DisplayUnit displayUnit = DisplayUnit.IMPERIAL; if (Server.UnitSystem == Autodesk.Revit.DB.ResultsBuilder.UnitsSystem.Metric) { displayUnit = DisplayUnit.METRIC; } ElementAnalyser elementAnalyser = new ElementAnalyser(displayUnit); ElementInfo info = elementAnalyser.Analyse(element); XYZ xyz = new XYZ(); if (info != null) { foreach (ResultInPointSurface resInPt in resultsInPoints) { mapPoints.AddPoint(new XYZ(resInPt[ResultTypeSurface.X], resInPt[ResultTypeSurface.Y], resInPt[ResultTypeSurface.Z]), resInPt[forceDesc.Item1]); } var contourAndHoles = getContourAndHolePoints(info); contourAndHoles.Item1.ForEach(s => mapPoints.AddPointToContour(s)); contourAndHoles.Item2.ForEach(s => mapPoints.AddHole(s)); UnitType ut = forceDesc.Item1.GetUnitType(); DocumentMap docMap = new DocumentMap(ut, UnitsConverter.GetInternalUnit(ut)); docMap.Title = forceDesc.Item2; int nofPoints = mapPoints.Count; for (int ptId = 0; ptId < nofPoints; ptId++) { UV pt = mapPoints.GetPoint(ptId); docMap.AddPoint(pt.U, pt.V, mapPoints.GetValue(ptId)); } List <List <int> > holes = mapPoints.Holes; foreach (List <int> hole in holes) { docMap.AddHole(hole); } docMap.DefineContour(mapPoints.Contour); vDocMap.Add(docMap); } mapPoints.Clear(); } return(vDocMap); }