public MeasureCmd(RunnableModule runnableModule, MeasureCmdLine measurecmdLine) : base(runnableModule, measurecmdLine) { var structure = runnableModule.CommandsModule.program.ModuleStructure; this.position = structure.ToMachine(runnableModule, measurecmdLine.PosInPattern); this.measurePrm = measurecmdLine.MeasurePrm; this.SavePath = measurecmdLine.SavePath; //this.NeedMeasureHeight = measurecmdLine.NeedMeasureHeight; this.MeasureContent = measurecmdLine.MeasureContent; if (measurecmdLine.MeasureContent.HasFlag(MeasureContents.GlueHeight) && measurecmdLine.MeasureHeightCmdLines != null && measurecmdLine.MeasureHeightCmdLines.Count == 2) { this.ToleranceMax = measurecmdLine.MeasurePrm.ToleranceMax; this.ToleranceMin = measurecmdLine.MeasurePrm.ToleranceMin; this.MeasureHeightCmds = new List <MeasureHeightCmd>(); foreach (MeasureHeightCmdLine item in measurecmdLine.MeasureHeightCmdLines) { this.MeasureHeightCmds.Add(new MeasureHeightCmd(runnableModule, item)); } } }
public EditMeasurementForm(Pattern pattern, MeasureCmdLine measureCmdLine) : base(pattern.GetOriginPos()) { InitializeComponent(); this.pattern = pattern; this.origin = pattern.GetOriginPos(); for (int i = 20; i < 30; i++) { this.comboBox1.Items.Add(i); } if (measureCmdLine == null) { this.isCreating = true; this.measureCmdLine = new MeasureCmdLine(); this.measureCmdLine.MeasurePrm.ExposureTime = Machine.Instance.Camera.Prm.Exposure; this.measureCmdLine.MeasurePrm.Gain = Machine.Instance.Camera.Prm.Gain; this.measureCmdLine.MeasurePrm.ExecutePrm = (ExecutePrm)Machine.Instance.Light.ExecutePrm.Clone(); } else { this.isCreating = false; this.measureCmdLine = measureCmdLine; } this.measureCmdLine.MeasurePrm.Vendor = MeasureVendor.ASV; PointD p = this.pattern.MachineRel(this.measureCmdLine.PosInPattern); tbLocationX.Text = p.X.ToString("0.000"); tbLocationY.Text = p.Y.ToString("0.000"); this.inspection = InspectionMgr.Instance.FindBy(this.measureCmdLine.MeasurePrm.InspectionKey); this.comboBox1.SelectedItem = this.measureCmdLine.MeasurePrm.InspectionKey; this.cameraControl1.SetExposure(this.measureCmdLine.MeasurePrm.ExposureTime); this.cameraControl1.SetGain(this.measureCmdLine.MeasurePrm.Gain); this.cameraControl1.SelectLight(this.measureCmdLine.MeasurePrm.ExecutePrm); this.nudSettingTime.Value = this.measureCmdLine.MeasurePrm.SettlingTime; this.nudUpper.Increment = (decimal)0.001; this.nudUpper.DecimalPlaces = 3; this.nudLower.Increment = (decimal)0.001; this.nudLower.DecimalPlaces = 3; this.nudUpper.Value = (decimal)this.measureCmdLine.MeasurePrm.Upper; this.nudLower.Value = (decimal)this.measureCmdLine.MeasurePrm.Lower; this.nudHeightUpper.Increment = (decimal)0.001; this.nudHeightUpper.DecimalPlaces = 3; this.nudHeightLower.Increment = (decimal)0.001; this.nudHeightLower.DecimalPlaces = 3; this.txtResult.ReadOnly = true; this.cmbMeasureType.Items.Add(MeasureType.圆半径); this.cmbMeasureType.Items.Add(MeasureType.线宽); this.cmbMeasureType.Items.Add(MeasureType.面积); this.cmbMeasureType.SelectedItem = MeasureType.线宽; this.SetupLight(this.measureCmdLine.MeasurePrm.ExecutePrm); this.ckbNeedMeasureHeight.Checked = this.measureCmdLine.MeasureContent.HasFlag(MeasureContents.GlueHeight); this.ckbMeasureLineWidth.Checked = this.measureCmdLine.MeasureContent.HasFlag(MeasureContents.LineWidth); this.heightControl1.LaserControl.MeasureStarting += HeightControl1_MeasureStarting; //if (this.measureCmdLine.MeasureContent.HasFlag(MeasureContents.GlueHeight)) //{ //} this.nudHeightUpper.Value = (decimal)this.measureCmdLine.MeasurePrm.ToleranceMax; this.nudHeightLower.Value = (decimal)this.measureCmdLine.MeasurePrm.ToleranceMin; if (this.measureCmdLine.MeasureHeightCmdLines != null && this.measureCmdLine.MeasureHeightCmdLines.Count != 0) { PointD ph = this.pattern.MachineRel(this.measureCmdLine.MeasureHeightCmdLines[0].Position); this.tbLocationHeightX.Text = ph.X.ToString("0.000"); this.tbLocationHeightY.Text = ph.Y.ToString("0.000"); foreach (var item in this.measureCmdLine.MeasureHeightCmdLines) { this.heightControl1.SetupCmdLine(item); } } this.ReadLanguageResources(); }