Example #1
0
        private Point3d BuildPass(MillingCommandGenerator generator, List <Point3d> points)
        {
            var  z = generator.ZSafety - TechProcess.ZSafety;
            bool isComplete;
            var  point = Algorithms.NullPoint3d;

            do
            {
                isComplete = true;
                z         -= Penetration;
                var point0 = Algorithms.NullPoint3d;

                foreach (var pt in points)
                {
                    var p = pt;
                    if (z > p.Z)
                    {
                        p          = new Point3d(p.X, p.Y, z);
                        isComplete = false;
                    }
                    if (generator.IsUpperTool)
                    {
                        generator.Move(p.X, p.Y, angleC: ((Disk3DTechProcess)TechProcess).Angle);
                        generator.Cycle();
                    }
                    if (point.IsNull())
                    {
                        if (generator.ToolPosition.Point != p)
                        {
                            generator.GCommand(CommandNames.Penetration, 1, point: p, feed: TechProcess.PenetrationFeed);
                        }
                        else
                        {
                            generator.Move(p.X, p.Y);
                            generator.Cycle();
                        }
                    }
                    else if (point0 != point && point != p && !point0.GetVectorTo(point).IsCodirectionalTo(point.GetVectorTo(p)))
                    {
                        generator.GCommand(CommandNames.Cutting, 1, point: point, feed: CuttingFeed);
                        point0 = point;
                    }
                    if (point0.IsNull())
                    {
                        point0 = p;
                    }
                    point = p;
                }
                generator.GCommand(CommandNames.Cutting, 1, point: point, feed: CuttingFeed);
                points.Reverse();
            }while (!isComplete);

            if (IsUplifting)
            {
                generator.Uplifting();
            }

            return(point);
        }
Example #2
0
        private Point3d BuildPassA90(MillingCommandGenerator generator, List <Point3d> points, Matrix3d matrix, double z0)
        {
            var  z = z0;
            bool isComplete;
            var  point = Algorithms.NullPoint3d;

            do
            {
                isComplete = true;
                z         -= Penetration;
                var point0 = Algorithms.NullPoint3d;
                point = Algorithms.NullPoint3d;
                //var isPassStarted = false;

                foreach (var pt in points)
                {
                    var p = pt;
                    if (z > p.Z)
                    {
                        p          = new Point3d(p.X, p.Y, z);
                        isComplete = false;
                    }
                    if (generator.IsUpperTool)
                    {
                        generator.Move(p, angleC: TechProcess.Angle, angleA: 90);
                        generator.Cycle();
                    }
                    if (point.IsNull())
                    {
                        if (generator.ToolPosition.Point != p.TransformBy(matrix))
                        {
                            generator.GCommand(CommandNames.Penetration, 1, point: p, feed: TechProcess.PenetrationFeed);
                        }
                        else
                        {
                            generator.Move(p, angleA: 90);
                            generator.Cycle();
                        }
                    }
                    else if (point0 != point && point != p && !point0.GetVectorTo(point).IsCodirectionalTo(point.GetVectorTo(p)))
                    {
                        generator.GCommand(CommandNames.Cutting, 1, point: point, feed: CuttingFeed);
                        point0 = point;
                    }
                    if (point0.IsNull())
                    {
                        point0 = p;
                    }
                    point = p;
                }
                generator.GCommand(CommandNames.Cutting, 1, point: point, feed: CuttingFeed);
                points.Reverse();
            }while (!isComplete);

            //generator.Move(point.Add(Vector3d.ZAxis * 100));
            return(point);
        }