示例#1
0
        /// <summary>
        /// Returns all components, including children
        /// </summary>
        /// <param name="repo">Components repository</param>
        /// <returns>All components</returns>
        public static IEnumerable <IXComponent> Flatten(this IXComponentRepository repo)
        {
            foreach (var comp in repo)
            {
                IXComponentRepository children = null;

                try
                {
                    children = comp.Children;
                }
                catch
                {
                }

                if (children != null)
                {
                    foreach (var subComp in Flatten(children))
                    {
                        yield return(subComp);
                    }
                }

                yield return(comp);
            }
        }
示例#2
0
        /// <summary>
        /// Returns all components, including children
        /// </summary>
        /// <param name="repo">Components repository</param>
        /// <returns>All components</returns>
        public static IEnumerable <IXComponent> Flatten(this IXComponentRepository repo)
        {
            foreach (var comp in repo)
            {
                foreach (var subComp in Flatten(comp.Children))
                {
                    yield return(subComp);
                }

                yield return(comp);
            }
        }
示例#3
0
 /// <inheritdoc cref="IterateBodies(IXComponent, bool)"/>
 public static IEnumerable <IXBody> IterateBodies(this IXComponentRepository comps, bool includeHidden = false)
 => IterateComponentBodies(comps, includeHidden);
示例#4
0
 internal SwAssembly(IAssemblyDoc assembly, ISwApplication app, IXLogger logger, bool isCreated)
     : base((IModelDoc2)assembly, app, logger, isCreated)
 {
     Components = new SwAssemblyComponentCollection(this);
 }