Exemple #1
0
        public static List <IElement2D> AdjacentElements(this IElement1D element, IEnumerable <IElement2D> referenceElements)
        {
            List <IElement2D> adjacentElements = new List <IElement2D>();

            if (element == null || referenceElements == null)
            {
                Reflection.Compute.RecordWarning("Can not get adjacencies of a null element.");
                return(null);
            }

            PolyCurve outline = element.ElementCurves().IJoin()[0];

            foreach (IElement2D refElem in referenceElements)
            {
                PolyCurve refOutline = refElem.OutlineCurve();
                if (refOutline.IIsAdjacent(outline))
                {
                    adjacentElements.Add(refElem);
                }
            }

            return(adjacentElements);
        }