protected override void SolveInstance(IGH_DataAccess DA) { if (!hasSetData) { // First run: Save the tree and expire solution to force an update in the output params. // Get the data or abort. if (!DA.GetDataTree(0, out speckleObjects)) { return; } if (!speckleObjects.Any()) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "The provided input has no data."); return; } // Ensure only one object per path. speckleObjects.Graft(GH_GraftMode.GraftAll); // Update the output list outputList = GetOutputList(); // Once data has been set, expire solution to update output params. hasSetData = true; ExpireSolution(true); } else { // Second run: Parameter output should have been updated in `beforeSolveInstance` with latest state. // Build the output dictionary var outputDict = CreateOutputDictionary(); // Assign outputs. foreach (var key in outputDict.Keys) { DA.SetDataTree(Params.IndexOfOutputParam(key), outputDict[key]); } // Reset state hasSetData = false; speckleObjects = null; } }