bool Bake.IGH_ElementIdBakeAwareObject.CanBake(Bake.BakeOptions options) => Params?.Output.OfType <Kernel.IGH_ElementIdParam>(). Where ( x => x.VolatileData.AllData(true). OfType <Types.IGH_ElementId>(). Where(goo => options.Document.Equals(goo.Document)). Any() ). Any() ?? false;
bool Bake.IGH_ElementIdBakeAwareObject.Bake(Bake.BakeOptions options, out ICollection <DB.ElementId> ids) { using (var trans = new DB.Transaction(options.Document, "Bake")) { if (trans.Start() == DB.TransactionStatus.Started) { var list = new List <DB.ElementId>(); var newStructure = (IGH_Goo[])PreviousStructure.Clone(); for (int g = 0; g < newStructure.Length; g++) { if (newStructure[g] is Types.IGH_ElementId id) { if ( id.Document.Equals(options.Document) && id.Document.GetElement(id.Id) is DB.Element element ) { element.Pinned = false; list.Add(element.Id); newStructure[g] = default; } } } if (trans.Commit() == DB.TransactionStatus.Committed) { ids = list; PreviousStructure = newStructure; ExpireSolution(false); return(true); } } } ids = default; return(false); }