protected override void SolveInstance(IGH_DataAccess DA) { List <GH_Glulam> inputs = new List <GH_Glulam>(); Glulam glulam = null; //DataTree<GH_Glulam> glulams = new DataTree<GH_Glulam>(); GH_Structure <IGH_Goo> glulams; if (!DA.GetDataTree <IGH_Goo>(GlulamInput, out glulams)) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "No glulam blank connected."); return; } int type = 0; DA.GetData("Type", ref type); DataTree <object> output = new DataTree <object>(); DataTree <string> species = new DataTree <string>(); DataTree <Guid> ids = new DataTree <Guid>(); GH_Path element_path; foreach (var path in glulams.Paths) { var branch = glulams[path]; for (int i = 0; i < branch.Count; ++i) { IGH_Goo goo = branch[i]; var gh_glulam = goo as GH_Glulam; if (gh_glulam == null) { continue; } glulam = gh_glulam.Value; if (glulam == null) { continue; } GH_Path new_path = new GH_Path(path); path.AppendElement(i); int j = 0; var objects = new List <object>(); switch (type) { case (1): objects.AddRange(glulam.GetLamellaeMeshes()); break; case (2): objects.AddRange(glulam.GetLamellaeBreps()); break; default: objects.AddRange(glulam.GetLamellaeCurves()); break; } if (objects.Count < 1) { throw new NotImplementedException(); } for (int x = 0; x < glulam.Data.NumWidth; ++x) { for (int y = 0; y < glulam.Data.NumHeight; ++y) { //new_path = new GH_Path(x, y); element_path = new GH_Path(new_path); element_path.AppendElement(x); element_path.AppendElement(y); output.Add(objects[j], element_path); if (glulam.Data.Lamellae[x, y] != null) { species.Add(glulam.Data.Lamellae[x, y].Species, element_path); ids.Add(glulam.Data.Lamellae[x, y].Reference, element_path); } j++; } } } } //for (int i = 0; i < inputs.Count; ++i) //{ // Glulam g = inputs[i].Value; DA.SetDataTree(0, output); DA.SetDataTree(1, species); DA.SetDataTree(2, ids); }