private void btn_save_Click(object sender, EventArgs e) { CreateRobotPathPlan createRobotPathPlan = new CreateRobotPathPlan(); createRobotPathPlan.linePathPlan(lineParam); createRobotPathPlan.saveStraigthLine(); }
private void button3_Click(object sender, EventArgs e) { foreach (var listBoxItem in listBox_groupPath.Items) { String namepath = listBoxItem.ToString(); MessageBox.Show("" + namepath); LineParams templineparams = findLineParam(namepath); if (templineparams != null) { MessageBox.Show("line"); pathObjectList.Add(new PathObject() { flag_lineparam = true, lineParams = templineparams, curveParams = null }); } CurveParams tempcurveparams = findCurveParam(namepath); if (tempcurveparams != null) { MessageBox.Show("curve"); pathObjectList.Add(new PathObject() { flag_lineparam = false, curveParams = tempcurveparams, lineParams = null }); } } if (pathObjectList.Count > 0) { System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog(); if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { using (StreamWriter sw = File.CreateText(System.IO.Path.GetFullPath(saveFileDialog.FileName))) { sw.WriteLine("// X, Y, Z, W"); for (int i = 0; i < pathObjectList.Count; i++) { String path = ""; CreateRobotPathPlan createpath = new CreateRobotPathPlan(); if (pathObjectList[i].flag_lineparam) { createpath.linePathPlan(pathObjectList[i].lineParams); path += createpath.TextLine(); } else { createpath.CurvePathPlan(pathObjectList[i].curveParams); path += createpath.TextCurveLine(); } sw.Write(path); } } } } }