Continuing the discussion from Problems appending elements to GH_Structure at a higher path level:
This is mainly to try to understand why GH_Structure should always be used in VS rather than DataTree class as outline by David Rutten here:
I have definitely used DataTree for VS components before and I haven’t noticed any issues resulting from this, so I am curious to know what the drawbacks are.
While I am here and on the topic maybe someone can shed some light on the best practices of scripting with DataTrees. Many times I found it important that the output maintains or appends the input tree structure. My approach has always been something along the lines of the following:
Grasshopper.Kernel.IGH_Param inputParam_0 = this.Params.Input; Grasshopper.Kernel.Data.IGH_Structure structure_0 = inputParam_0.VolatileData; int pathCount_0 = structure_0.PathCount - 1; int runCount = this.RunCount - 1; GH_Path path = structure_0.get_Path(Math.Min(runCount, pathCount_0));
It has usually done what I needed it to do, but I’ve always felt that there must be a more robust way than using the component’s RunCount to retrieve the current path of the data in SolveInstance.