public override void BuildProcessing(ICommandGenerator generator)
        {
            _disk3DTechProcess = (Disk3DTechProcess)TechProcess;

            var offsetSurface = CreateOffsetSurface();

            var matrix = Matrix3d.Rotation(_disk3DTechProcess.Angle.ToRad(), Vector3d.ZAxis, Point3d.Origin);

            if (_disk3DTechProcess.Angle != 0)
            {
                offsetSurface.TransformBy(matrix);
            }

            var minPoint = offsetSurface.GeometricExtents.MinPoint;
            var maxPoint = offsetSurface.GeometricExtents.MaxPoint;

            var collections = GetPointCollections(offsetSurface, minPoint, maxPoint);

            offsetSurface.Dispose();

            var zArray = GetZArray(collections, (maxPoint - minPoint).X);

            var passList = CalcPassList(zArray, minPoint);

            matrix = matrix.Inverse();
            passList.ForEach(p =>
            {
                var points = p;
                if (Departure > 0)
                {
                    points.Insert(0, new Point3d((IsDepartureOnBorderSection ? points.First().X : minPoint.X) - Departure, points.First().Y, points.First().Z));
                    points.Add(new Point3d((IsDepartureOnBorderSection ? points.Last().X : maxPoint.X) + Departure, points.Last().Y, points.Last().Z));
                }
                if (TechProcess.MachineType == MachineType.Donatoni) //Settongs.IsFrontPlaneZero
                {
                    points = points.ConvertAll(x => new Point3d(x.X, x.Y - TechProcess.Tool.Thickness.Value, x.Z));
                }
                if (_disk3DTechProcess.Angle != 0)
                {
                    points = points.ConvertAll(x => x.TransformBy(matrix));
                }
                var loc = generator.ToolLocation;
                if (loc.IsDefined && loc.Point.DistanceTo(points.First()) > loc.Point.DistanceTo(points.Last()))
                {
                    points.Reverse();
                }

                BuildPass(generator, points);

                if (IsUplifting)
                {
                    generator.Uplifting();
                }
            });
        }
Beispiel #2
0
        public override void BuildProcessing(ICommandGenerator generator)
        {
            //var progressMeter = new ProgressMeter();
            //progressMeter.Start($"test");
            //progressMeter.SetLimit(100);
            //for (int i = 0; i < 100; i++)
            //{
            //    progressMeter.MeterProgress();
            //    Thread.Sleep(100);
            //}
            ////progressMeter.Start($"test111");
            //progressMeter.SetLimit(100);
            //for (int i = 0; i < 100; i++)
            //{
            //    progressMeter.MeterProgress();
            //    Thread.Sleep(100);
            //}
            //progressMeter.Stop();
            //return;

            //Draw.Pline(new Point3d(0, 1000, 0), new Point3d(1000, 1000, 0), new Point3d(1000, 1200, 0), new Point3d(2000, 1200, 0));
            //var points1 = new Point3dCollection(new Point3d[] { new Point3d(0, 1000, 0), new Point3d(1000, 1000, 0), new Point3d(1000, 1200, 0), new Point3d(2000, 1200, 0) });
            //var pline = new PolylineCurve3d(points1);

            //    var distance = TechProcess.Tool.Diameter / 2;
            //    var offsetCurves = pline.GetTrimmedOffset(100, Vector3d.ZAxis, OffsetCurveExtensionType.Fillet);

            //var cInt = new CurveCurveIntersector3d(offsetCurves[0], new Line3d(new Point3d(0, 0, 0), new Point3d(0, 3000, 0)), Vector3d.ZAxis);
            //var dbp = new List<DBPoint>();
            //for (int i = 0; i < 2000; i++)
            //{
            //    cInt.Set(offsetCurves[0], new Line3d(new Point3d(i, 0, 0), new Point3d(i, 3000, 0)), Vector3d.ZAxis);

            //    Point3d pnt3d = cInt.GetIntersectionPoint(0);

            //    dbp.Add(new DBPoint(pnt3d - Vector3d.YAxis * 100));

            //}
            //cInt.Dispose();
            //dbp.AddToCurrentSpace();


            _disk3DTechProcess = (Disk3DTechProcess)TechProcess;

            var offsetSurface = CreateOffsetSurface();

            var matrix = Matrix3d.Rotation(_disk3DTechProcess.Angle.ToRad(), Vector3d.ZAxis, Point3d.Origin);

            if (_disk3DTechProcess.Angle != 0)
            {
                offsetSurface.TransformBy(matrix);
            }

            var minPoint = offsetSurface.GeometricExtents.MinPoint;
            var maxPoint = offsetSurface.GeometricExtents.MaxPoint; // - Vector3d.XAxis * 1000;

            var collections = GetPointCollections(offsetSurface, minPoint, maxPoint);

            offsetSurface.Dispose();

            var zArray = GetZArray(collections, (maxPoint - minPoint).X);
            //var pointsArray = CalcOffsetPoints(polylines, minPoint, maxPoint);

            var passList = CalcPassList(zArray, minPoint);

            matrix = matrix.Inverse();
            passList.ForEach(p =>
            {
                var points = p;
                if (Departure > 0)
                {
                    points.Insert(0, new Point3d((IsDepartureOnBorderSection ? points.First().X : minPoint.X) - Departure, points.First().Y, points.First().Z));
                    points.Add(new Point3d((IsDepartureOnBorderSection ? points.Last().X : maxPoint.X) + Departure, points.Last().Y, points.Last().Z));
                }
                if (TechProcess.MachineType == MachineType.Donatoni) //Settongs.IsFrontPlaneZero
                {
                    points = points.ConvertAll(x => new Point3d(x.X, x.Y - TechProcess.Tool.Thickness.Value, x.Z));
                }
                if (_disk3DTechProcess.Angle != 0)
                {
                    points = points.ConvertAll(x => x.TransformBy(matrix));
                }
                var loc = generator.ToolLocation;
                if (loc.IsDefined && loc.Point.DistanceTo(points.First()) > loc.Point.DistanceTo(points.Last()))
                {
                    points.Reverse();
                }

                BuildPass(generator, points);

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