Ejemplo n.º 1
0
        protected Element FilterElements(Element[] elements, FamilyInstance orig)
        {
            var insts = elements.Where(e => e is FamilyInstance)
                        .Cast <FamilyInstance>()
                        .ToArray();

            if (insts.Length == 1)
            {
                return(insts.First());
            }

            var likely = new List <Element>();

            foreach (var e in insts)
            {
                if (e.Symbol.Name != orig.Symbol.Name)
                {
                    continue;
                }

                var eLoc = ((LocationPoint)e.Location).Point;
                var oLoc = ((LocationPoint)orig.Location).Point;

                if (eLoc == oLoc)
                {
                    return(e);
                }

                likely.Add(e);
            }

            return(ElementLocationServices.GetClosest(likely, orig));
        }
Ejemplo n.º 2
0
        public static Ceiling FindCeilingInSpace(Space space)
        {
            var ceilings = ElementLocationServices.FindIntersectingElementByPosition <Ceiling>(space);

            var clg = ceilings.First();

            return(clg);
        }