private void btnBatchCreate_Click(object sender, EventArgs e) { var x = HoleOperate.XStart; var y = HoleOperate.YStart; var w = HoleOperate.WStart; var b = HoleOperate.BStart; var c = HoleOperate.CStart; for (int i = 0; i < HoleOperate.Repeat; i++) { var holeInfo = new HoleInfo() { IsJiaGong = HoleOperate.IsJiagong, X = x + HoleOperate.XInterval, Y = y + HoleOperate.YInterval, W = w + HoleOperate.WInterval, B = b + HoleOperate.BInterval, C = c + HoleOperate.CInterval, AxisType = HoleOperate.AxisType, Param = HoleOperate.Param }; x += HoleOperate.XInterval; y += HoleOperate.YInterval; w += HoleOperate.WInterval; b += HoleOperate.BInterval; c += HoleOperate.CInterval; HoleCollection.Insert(this.bindingSourceHole.Position + 1 + i, holeInfo); } bindingSourceHole.ResetBindings(false); }
public void btnAddHole_Click(object sender, EventArgs e) { var holeInfo = new HoleInfo() { IsJiaGong = true, X = contra.GetActPosX(axisType), Y = contra.GetActPosY(axisType), W = contra.GetActPosW(axisType), B = contra.GetActPosB(axisType), C = contra.GetActPosC(axisType), AxisType = axisType, Param = "E1" }; HoleCollection.Insert(this.bindingSourceHole.Position + 1, holeInfo); bindingSourceHole.ResetBindings(false); }
private void btnBatchCreate2_Click(object sender, EventArgs e) { var operate = HoleOperate2; var x = operate.XStart; var y = operate.YStart; var w = operate.WStart; var b = operate.BStart; var c = operate.CStart; var xe = operate.XInterval; var ye = operate.YInterval; var we = operate.WInterval; var be = operate.BInterval; var ce = operate.CInterval; decimal?xs = (xe - x) / (operate.Repeat + 1); decimal?ys = (ye - y) / (operate.Repeat + 1); decimal?ws = (we - w) / (operate.Repeat + 1); decimal?bs = (be - b) / (operate.Repeat + 1); decimal?cs = (ce - c) / (operate.Repeat + 1); for (int i = 0; i < operate.Repeat; i++) { var holeInfo = new HoleInfo() { IsJiaGong = operate.IsJiagong, X = x + xs, Y = y + ys, W = w + ws, B = b + bs, C = c + cs, AxisType = operate.AxisType, Param = operate.Param }; x += xs; y += ys; w += ws; b += bs; c += cs; HoleCollection.Insert(this.bindingSourceHole.Position + 1 + i, holeInfo); } bindingSourceHole.ResetBindings(false); }