Example #1
0
        private void getDoubleGateTolMonitor(GateType gateType, DGateType dGatetType, int tolMonitorIndex)
        {
            int    error_code;
            double min         = 0;
            double max         = 0;
            uint   suppressCnt = 0;

            //Close gate tolerance active
            error_code = SetGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, gateType, TMActive.OFF);
            if (error_code != 0)
            {
                return;
            }

            //Open double gate tolerance active
            error_code = SetDGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, dGatetType, TMActive.ON);
            if (error_code != 0)
            {
                return;
            }

            error_code = GetDGateDAQ.TolMonitorMax(SelectAscan.sessionIndex, SelectAscan.port, dGatetType, ref max);
            if (error_code != 0)
            {
                return;
            }
            ((NumericUpDown)(Controls.Find("numUpDownMax" + tolMonitorIndex, true)[0])).Text = max.ToString();

            error_code = GetDGateDAQ.TolMonitorMin(SelectAscan.sessionIndex, SelectAscan.port, dGatetType, ref min);
            if (error_code != 0)
            {
                return;
            }
            ((NumericUpDown)(Controls.Find("numUpDownMin" + tolMonitorIndex, true)[0])).Text = min.ToString();

            error_code = GetDGateDAQ.TolMonitorSc(SelectAscan.sessionIndex, SelectAscan.port, dGatetType, ref suppressCnt);
            if (error_code != 0)
            {
                return;
            }
            ((NumericUpDown)(Controls.Find("numUpDownSc" + tolMonitorIndex, true)[0])).Text = suppressCnt.ToString();
        }
Example #2
0
        private void initTolerance()
        {
            int      error_code;
            TMActive gateActive  = TMActive.OFF;
            TMActive dGateActive = TMActive.OFF;

            for (int tolMonitorIndex = 0; tolMonitorIndex < 4; tolMonitorIndex++)
            {
                error_code = GetGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, (GateType)tolMonitorIndex, ref gateActive);
                if (error_code != 0)
                {
                    return;
                }

                error_code = GetDGateDAQ.TolMonitorActive(SelectAscan.sessionIndex, SelectAscan.port, (DGateType)tolMonitorIndex, ref dGateActive);
                if (error_code != 0)
                {
                    return;
                }

                if (gateActive == TMActive.ON && dGateActive == TMActive.ON)
                {
                    MessageShow.show("Warn:Gate and double gate tolerance monitor are all active,need to select one to active!",
                                     "警告:门容限误差和双门容限误差都打开,只能选择一种容限误差模式!");
                }
                else if (gateActive == TMActive.ON)
                {
                    ((CheckBox)(Controls.Find("check" + tolMonitorIndex + 1 + "ON", true)[0])).Checked = true;
                    ((RadioButton)(Controls.Find("gate" + tolMonitorIndex + 1, true)[0])).Checked      = true;
                }
                else if (dGateActive == TMActive.ON)
                {
                    ((CheckBox)(Controls.Find("check" + tolMonitorIndex + 1 + "ON", true)[0])).Checked = true;
                    ((RadioButton)(Controls.Find("dGate" + tolMonitorIndex + 1, true)[0])).Enabled     = true;
                }
                else
                {
                    setControlsEnabled(tolMonitorIndex + 1, false);
                }
            }
        }