private void MainForm_Load(object sender, EventArgs e) { var result = CMMConfig.GetInstance(); var data = result.ProbeDatas ?? new List <ProbeData>(); cbIsAutoPrtFtpDir.Checked = result.IsAutoPrtFtpDir; cbIsUploadDatabase.Checked = result.IsUploadDataBase; txtAutoCmmDir.Text = result.AutoCmmDir; txtAutoPrtToolDir.Text = result.AutoPrtToolDir; txtEntryPoint.Text = result.EntryPoint.ToString(); txtRetreatPoint.Text = result.RetreatPoint.ToString(); txtSafeDistance.Text = result.SafeDistance.ToString(); txtVerticalValue.Text = result.VerticalValue.ToString(); cbIsInspectionPath.Checked = result.IsInspectionPath; cbIsAutoCmmFtpDir.Checked = result.IsAutoCmmFtpDir; cbIsEDMFaceGetPoint.Checked = result.IsEDMFaceGetPoint; cbIsInitConfig.Checked = result.IsInitConfig; cbIsBaseRoundInt.Checked = result.IsBaseRoundInt; cbIsGetTowPointArea.Checked = result.IsGetTowPointArea; cbIsMinGetPointArea.Checked = result.IsMinGetPointArea; txtGetTowPointArea.Text = result.GetTowPointArea.ToString(); txtMinGetPointArea.Text = result.MinGetPointArea.ToString(); txtGetPointFilePath.Text = result.GetPointFilePath; cbIsSelGetPointFilePath.Checked = result.IsSelGetPointFilePath; dataGridView1.DataSource = data; txtMinEdgeDistance.Text = result.MinEdgeDistance.ToString(); }
/// <summary> /// 设置探针显示 /// </summary> public static void SetProbeShow(PointData data, CMMTool.CMMConfig config) { SetProbeHide(); var probe = config.ProbeDatas.FirstOrDefault(u => u.ProbeName == data.Arrow); if (probe != null) { var ab = probe.GetABList().FirstOrDefault(u => u.A == data.A && u.B == data.B); if (ab != null) { var body = probe.GetBody(ab); //移动 var centreOfSphere = probe.GetCentreOfSphere(ab); //退点 var sRetreatPosition = data.Position.Copy(Snap.Geom.Transform.CreateTranslation((probe.D / 2) * data.Vector)); var trans = Snap.Geom.Transform.CreateTranslation(sRetreatPosition - centreOfSphere); body.Move(trans); body.IsHidden = false; } } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { var datasource = dataGridView1.DataSource as List <ProbeData>; var result = new CMMConfig { ProbeDatas = datasource }; result.IsAutoPrtFtpDir = cbIsAutoPrtFtpDir.Checked; result.AutoCmmDir = txtAutoCmmDir.Text; result.AutoPrtToolDir = txtAutoPrtToolDir.Text; result.EntryPoint = double.Parse(txtEntryPoint.Text); result.RetreatPoint = double.Parse(txtRetreatPoint.Text); result.SafeDistance = double.Parse(txtSafeDistance.Text); result.VerticalValue = double.Parse(txtVerticalValue.Text); result.IsInspectionPath = cbIsInspectionPath.Checked; result.IsAutoCmmFtpDir = cbIsAutoCmmFtpDir.Checked; result.IsSelGetPointFilePath = cbIsSelGetPointFilePath.Checked; result.GetPointFilePath = txtGetPointFilePath.Text; result.IsEDMFaceGetPoint = cbIsEDMFaceGetPoint.Checked; result.IsInitConfig = cbIsInitConfig.Checked; result.IsUploadDataBase = cbIsUploadDatabase.Checked; result.IsBaseRoundInt = cbIsBaseRoundInt.Checked; result.IsGetTowPointArea = cbIsGetTowPointArea.Checked; result.IsMinGetPointArea = cbIsMinGetPointArea.Checked; result.GetTowPointArea = double.Parse(txtGetTowPointArea.Text); result.MinGetPointArea = double.Parse(txtMinGetPointArea.Text); result.MinEdgeDistance = double.Parse(txtMinEdgeDistance.Text); CMMConfig.WriteConfig(result); if (result.IsInitConfig) { CMMTool.Business.InitConfig(); } ucEdmConfig1.Save(); _eactConfigContrl.Save(); }
public static void WriteConfig(CMMConfig data) { var json = Newtonsoft.Json.JsonConvert.SerializeObject(data); File.WriteAllText(_path, json); }