public static Mesh ExternalFaceMesh(this Mesh3D mesh3d) { List <Face> externalFaces = new List <Face>(); for (int i = 0; i < mesh3d.CellRelation.Count; i++) { CellRelation c = mesh3d.CellRelation[i]; if (c.ToCell == -1 ^ c.FromCell == -1) { externalFaces.Add(mesh3d.Faces[i]); } } return(new Mesh() { Vertices = mesh3d.Vertices.ToList(), // Should only take the sub set of points, but that will mess with the indecies of the faces Faces = externalFaces, }); }
private void Initialise_Click(object sender, EventArgs e) { var soldCell = this.dataGridView1[1, 0]; var remainingCell = this.dataGridView1[2, 0]; var totalCell = this.dataGridView1[0, 0]; // datagid values --- In your case this is from a dataset totalCell.Value = 10; soldCell.Value = 0; remainingCell.Value = 10; // initialise the relation / formula CellRelation relation = new CellRelation(); relation.SourceCell = soldCell; relation.DestinationCell = remainingCell; // thats the dependent cell relation.Formula = new CellFormula(); // here is a sample of subtraction formula : Subtracting Sold items for total items relation.Formula.Operator = new Func<DataGridViewCell, DataGridViewCell, decimal>((p, v) => { return ((decimal.Parse(p.Value.ToString()))) - ((decimal.Parse(v.Value.ToString()))); }); relation.Formula.Operand1 = totalCell; relation.Formula.Operand2 = soldCell; cellRelations.Add(relation); }