private List <InstanceDefinitionItem> GetInstanceDefinitionContents(InstanceDefinition definition) { return(definition .GetPartDefinitions() .Select(def => new InstanceDefinitionItem(def)) .ToList()); }
/// <summary> /// Standard constructed for a nested block instance. /// This will recursively search the given rhinodoc and build /// a nested list of nested blocks... /// </summary> /// <param name="def"></param> public NestedBlock(InstanceDefinition def, NestedBlock parent = null, ChildBlockInsertionParameters relativeInsertion = null) { // store head (original definition) Definition = def; Parent = parent; RelativeInsertion = relativeInsertion != null ? relativeInsertion : RelativeInsertion = ChildBlockInsertionParameters.Identity; var partDefinitions = def.GetPartDefinitions(); var partXforms = def.GetPartRelativeXforms(); foreach (var element in partDefinitions.Zip(partXforms, (definition, xform) => new { definition, xform })) { // recursion (•_•) ( •_•)>⌐■-■ (⌐■_■) Add(new NestedBlock(element.definition, this, element.xform)); } }
/// <summary> /// Gets all top level nested Instance definitions for the given instance definition /// </summary> /// <param name="definition"></param> /// <returns></returns> public IEnumerable <InstanceDefinition> GetNestedDefinitions(InstanceDefinition definition) { return(definition.GetPartDefinitions()); }