Example #1
0
        public newRightMeasureUp(int id, string name, Station station) : base(id, name, station)
        {
            VioTransFinish   = Machine.Ins.Find <IVioEx>("RTransFinishUp");
            VioMeasureFinish = Machine.Ins.Find <IVioEx>("RMeasureFinishUp");

            Platform = Machine.Ins.Find <PlatformEx>("RightUp");
            Platform.SafeChecks.Clear();
            Platform.SafeChecks.Add(new UpSafeCheck(Machine.Ins.Find <PlatformEx>("RightCarrier"), SafeCheckType.AutoHome));
            Platform.SafeChecks.Add(new UpSafeCheck(Machine.Ins.Find <PlatformEx>("RightCarrier"), SafeCheckType.Auto));
            Platform.SafeChecks.Add(new UpSafeCheck(Machine.Ins.Find <PlatformEx>("RightCarrier"), SafeCheckType.ManualHome));
            Platform.SafeChecks.Add(new UpSafeCheck(Machine.Ins.Find <PlatformEx>("RightCarrier"), SafeCheckType.Manual));


            var pToUp = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineTransform(new PosXYZ(d), Machine.Ins.Settings.Calibration.RightUpTransform);
                return(pnew.Data());
            });
            var upToP = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineInverseTransform(Machine.Ins.Settings.Calibration.RightUpTransform, new PosXYZ(d));
                return(pnew.Data());
            });


            var upToDown = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineTransform(new PosXYZ(d), Machine.Ins.Settings.Calibration.RightTransform);
                return(pnew.Data());
            });
            var downToUp = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineInverseTransform(Machine.Ins.Settings.Calibration.RightTransform, new PosXYZ(d));
                return(pnew.Data());
            });


            Platform.PosConvertFuncs.Add("P->UP", pToUp);
            Platform.PosConvertFuncs.Add("UP->P", upToP);
            Platform.PosConvertFuncs.Add("UP->DOWN", upToDown);
            Platform.PosConvertFuncs.Add("DOWN->UP", downToUp);
        }
        public newRightMeasureDown(int id, string name, Station station) : base(id, name, station)
        {
            DoGTCylinder = Machine.Ins.Find <ICylinderEx>("RGTCylinder");

            VioTransInp      = Machine.Ins.Find <IVioEx>("RTransInp");
            VioBarcodeFinish = Machine.Ins.Find <IVioEx>("RBarcodeFinish");

            VioTransFinish   = Machine.Ins.Find <IVioEx>("RTransFinishDown");
            VioMeasureFinish = Machine.Ins.Find <IVioEx>("RMeasureFinishDown");


            Platform = Machine.Ins.Find <PlatformEx>("RightDown");
            Platform.SafeChecks.Clear();
            Platform.SafeChecks.Add(new DownSafeCheck(Machine.Ins.Find <PlatformEx>("RightCarrier"), DoGTCylinder, SafeCheckType.AutoHome));
            Platform.SafeChecks.Add(new DownSafeCheck(Machine.Ins.Find <PlatformEx>("RightCarrier"), DoGTCylinder, SafeCheckType.Auto));
            Platform.SafeChecks.Add(new DownSafeCheck(Machine.Ins.Find <PlatformEx>("RightCarrier"), DoGTCylinder, SafeCheckType.ManualHome));
            Platform.SafeChecks.Add(new DownSafeCheck(Machine.Ins.Find <PlatformEx>("RightCarrier"), DoGTCylinder, SafeCheckType.Manual));


            var pToDown1 = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineTransform(new PosXYZ(d), Machine.Ins.Settings.Calibration.RightUpTransform);
                pnew     = XyzPlarformCalibration.AffineTransform(pnew, Machine.Ins.Settings.Calibration.RightTransform);

                return(pnew.Data());
            });

            var pToDown2 = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineTransform(new PosXYZ(d), Machine.Ins.Settings.Calibration.RightUpTransform);
                pnew     = XyzPlarformCalibration.AffineTransform(pnew, Machine.Ins.Settings.Calibration.RightTransform);
                pnew     = pnew + Machine.Ins.Settings.Calibration.RightGtOffset;
                return(pnew.Data());
            });


            var down1ToP = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineInverseTransform(Machine.Ins.Settings.Calibration.RightTransform, new PosXYZ(d));
                pnew     = XyzPlarformCalibration.AffineInverseTransform(Machine.Ins.Settings.Calibration.RightUpTransform, pnew);

                return(pnew.Data());
            });

            var down2ToP = new Func <double[], double[]>(d =>
            {
                var pnew = new PosXYZ(d) - Machine.Ins.Settings.Calibration.RightGtOffset;
                pnew     = XyzPlarformCalibration.AffineInverseTransform(Machine.Ins.Settings.Calibration.RightTransform, pnew);
                pnew     = XyzPlarformCalibration.AffineInverseTransform(Machine.Ins.Settings.Calibration.RightUpTransform, pnew);
                return(pnew.Data());
            });


            var upToDown1 = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineTransform(new PosXYZ(d), Machine.Ins.Settings.Calibration.RightTransform);
                return(pnew.Data());
            });
            var down1ToUp = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineInverseTransform(Machine.Ins.Settings.Calibration.RightTransform, new PosXYZ(d));
                return(pnew.Data());
            });

            var upToDown2 = new Func <double[], double[]>(d =>
            {
                var pnew = XyzPlarformCalibration.AffineTransform(new PosXYZ(d), Machine.Ins.Settings.Calibration.RightTransform);
                pnew     = pnew + Machine.Ins.Settings.Calibration.RightGtOffset;
                return(pnew.Data());
            });
            var down2ToUp = new Func <double[], double[]>(d =>
            {
                var pnew = new PosXYZ(d) - Machine.Ins.Settings.Calibration.RightGtOffset;
                pnew     = XyzPlarformCalibration.AffineInverseTransform(Machine.Ins.Settings.Calibration.RightTransform, pnew);
                return(pnew.Data());
            });


            Platform.PosConvertFuncs.Add("P->DOWN1", pToDown1);
            Platform.PosConvertFuncs.Add("P->DOWN2", pToDown2);
            Platform.PosConvertFuncs.Add("DOWN1->P", down1ToP);
            Platform.PosConvertFuncs.Add("DOWN2->P", down2ToP);

            Platform.PosConvertFuncs.Add("UP->DOWN1", upToDown1);
            Platform.PosConvertFuncs.Add("DOWN1->UP", down1ToUp);
            Platform.PosConvertFuncs.Add("UP->DOWN2", upToDown2);
            Platform.PosConvertFuncs.Add("DOWN2->UP", down2ToUp);
        }