Example #1
0
        private Result SvValveDoPurge(SvValve valve)
        {
            if (Machine.Instance.Robot.IsSimulation)
            {
                return(Result.OK);
            }
            Result result      = Result.OK;
            PointD purgeCentor = Machine.Instance.Robot.CalibPrm.PurgeLoc.ToNeedle(valve.ValveType);
            double r           = valve.Prm.PrePurgeRadius;
            double rHalf       = r * 0.5;
            double rHalfSqrt3  = r * Math.Sqrt(3) * 0.5;

            PointD[] pts = new PointD[]
            {
                new PointD(purgeCentor.X + r, purgeCentor.Y),
                new PointD(purgeCentor.X + rHalf, purgeCentor.Y + rHalfSqrt3),
                new PointD(purgeCentor.X - rHalf, purgeCentor.Y + rHalfSqrt3),
                new PointD(purgeCentor.X - r, purgeCentor.Y),
                new PointD(purgeCentor.X - rHalf, purgeCentor.Y - rHalfSqrt3),
                new PointD(purgeCentor.X + rHalf, purgeCentor.Y - rHalfSqrt3)
            };

            result = Machine.Instance.Robot.MoveToLocAndReply(Machine.Instance.Robot.SystemLocations.PurgeLoc.ToNeedle(valve.ValveType));
            if (result == Result.FAILED)
            {
                return(result);
            }
            if (valve.Prm.EnablePrePurgeVaccum)
            {
                DoType.真空清洗.Set(true);
            }

            Thread.Sleep(TimeSpan.FromSeconds(valve.Prm.PrePurgeDelay));
            valve.Spraying();

            for (int i = 0; i < valve.Prm.PrePurgeCount; i++)
            {
                foreach (PointD pt in pts)
                {
                    Machine.Instance.Robot.MovePosXYAndReply(pt);
                }
            }
            result = Machine.Instance.Robot.MovePosXYAndReply(Machine.Instance.Robot.CalibPrm.PurgeLoc.ToNeedle(valve.ValveType));
            if (result == Result.FAILED)
            {
                return(result);
            }
            if (valve.Prm.EnablePrePurgeVaccum)
            {
                DoType.真空清洗.Set(false);
            }

            valve.SprayOff();
            return(Machine.Instance.Robot.MoveSafeZAndReply());
        }
Example #2
0
        private Result SvValveDoPrime(SvValve valve)
        {
            if (Machine.Instance.Robot.IsSimulation)
            {
                return(Result.OK);
            }

            //排胶
            Result result = Machine.Instance.Robot.MoveToLocAndReply(Machine.Instance.Robot.SystemLocations.PrimeLoc.ToNeedle(valve.ValveType));

            if (result == Result.FAILED)
            {
                return(result);
            }

            valve.Spraying();
            Thread.Sleep(valve.Prm.PrimeTime);
            valve.SprayOff();

            return(Machine.Instance.Robot.MoveSafeZAndReply());
        }