Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66683

Re: Recursive get elements in Group

$
0
0

Upload is just the class name. 

 

You could use it without the class name.

 

 

class GroupUtil
    {
        public static List<Element> GetMembersRecursive(Document d, Group g, List<Element> r = null)
        {
            if (r == null)
            {
                r = new List<Element>();
            }

            List<Element> elems = g.GetMemberIds().Select(q => d.GetElement(q)).ToList();

            foreach (Element el in elems)
            {
                if (el.GetType() == typeof(Group))
                {
                    GetMembersRecursive(d, el as Group, r);
                    continue;
                }
                
                r.Add(el);
            }

            return r;
        }
    }

 


Viewing all articles
Browse latest Browse all 66683

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>