/* * public void Dispose() * { * foreach (Mesh m in this._meshCache) * { * m.Dispose(); * } * }*/ public override bool Write(GH_IWriter writer) { base.Write(writer); try { writer.RemoveChunk("PersistentData"); writer.SetInt32("GridCount", PersistentData.DataCount); var total = 0; for (var i = 0; i < PersistentData.Branches.Count; i++) { var path = PersistentData.Paths[i]; foreach (var ghvg in PersistentData.Branches[i]) { var currentGrid = writer.CreateChunk("Grid", total); currentGrid.SetString("Data", ByteHelper.ByteToHex(ByteHelper.Compress(ByteHelper.ToByte(ghvg.Value)))); currentGrid.SetString("Path", path.ToString()); total++; } } return(true); } catch (Exception e) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e + " " + e.StackTrace); return(true); } }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="da">The da object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess da) { var vg = default(VoxelGrid3D); da.GetData(0, ref vg); var output = ByteHelper.ByteToHex(ByteHelper.Compress(ByteHelper.ToByte(vg))); da.SetData(0, output); }