internal override void BuildPlan(PlanBuilder3D builder, MillingWorkspacePanel workspace)
        {
            builder.GotoZeroLevel();

            var maxDepth    = _millingDepth;
            var upDown      = true;
            var stepLength  = 1.0;
            var resolutionX = _shapeMetricSize.Width / stepLength;
            var resolutionY = _shapeMetricSize.Height / stepLength;

            for (var xi = 0.0; xi < resolutionX; xi += stepLength)
            {
                for (var yi = 0.0; yi < resolutionY; yi += stepLength)
                {
                    var xRatio = 1.0 * xi / resolutionX;
                    var yRatio = 1.0 * yi / resolutionY;

                    var depth = _shapeMap.GetHeight(xRatio, yRatio) * _millingDepth;
                    var x     = _shapeMetricSize.Width * xRatio;
                    var y     = _shapeMetricSize.Height * yRatio;
                    if (!upDown)
                    {
                        y = _shapeMetricSize.Height - y;
                    }

                    var point = new Point3Dmm(PositionX + x, PositionY + y, depth);
                    builder.AddCuttingSpeedTransition(new Point2Dmm(point.X, point.Y), point.Z);
                }
                upDown = !upDown;
            }

            builder.GotoTransitionLevel();
            builder.AddRampedLine(EntryPoint);
        }
        internal MillingItemPropertiesDialog(MillingWorkspaceItem item, MillingWorkspacePanel workspace)
        {
            _item      = item;
            _workspace = workspace;

            InitializeComponent();
            KeyUp += (s, e) =>
            {
                if (e.Key == Key.Escape)
                {
                    this.Close();
                }
            };

            refreshWindow();

            ShapeTop.TextChanged       += ShapeTop_TextChanged;
            ShapeLeft.TextChanged      += ShapeLeft_TextChanged;
            ShapeWidth.TextChanged     += ShapeWidth_TextChanged;
            ShapeHeight.TextChanged    += ShapeHeight_TextChanged;
            MillingDepth.TextChanged   += MillingDepth_TextChanged;
            AngleNum.TextChanged       += AngleNum_TextChanged;
            ShapeRotation.ValueChanged += ShapeRotation_ValueChanged;
            ShowDialog();
        }
Esempio n. 3
0
        internal override void BuildPlan(PlanBuilder3D builder, MillingWorkspacePanel workspace)
        {
            var offsetLines  = afterScaleTransformation(_currentOffsetLines);
            var currentDepth = 0.0;

            while (currentDepth < MillingDepth)
            {
                var depthIncrement = Math.Min(workspace.MaxLayerCut, MillingDepth - currentDepth);
                currentDepth += depthIncrement;

                foreach (var cluster in offsetLines)
                {
                    builder.GotoTransitionLevel();
                    builder.AddRampedLine(cluster[0]);


                    builder.GotoZ(currentDepth);
                    foreach (var point in cluster)
                    {
                        builder.AddCuttingSpeedTransition(point);
                    }
                }
            }
            builder.GotoTransitionLevel();
            builder.AddRampedLine(EntryPoint);
        }
Esempio n. 4
0
        internal override void BuildPlan(PlanBuilder3D builder, MillingWorkspacePanel workspace)
        {
            var reliefPoints = TransformedShapeDefinition;

            builder.GotoZeroLevel();

            var maxDepth = _millingDepth;
            var upDown   = true;

            for (var x = 0; x < _width; ++x)
            {
                for (var i = 0; i < _height; ++i)
                {
                    var y     = upDown ? i : _height - i - 1;
                    var point = reliefPoints[x, y];
                    if (point.Z > maxDepth)
                    {
                        point = new Point3Dmm(point.X, point.Y, maxDepth);
                    }

                    builder.AddCuttingSpeedTransition(new Point2Dmm(point.X, point.Y), point.Z);
                }
                upDown = !upDown;
            }

            builder.GotoTransitionLevel();
            builder.AddRampedLine(EntryPoint);
        }
Esempio n. 5
0
 internal override void BuildPlan(PlanBuilder3D builder, MillingWorkspacePanel workspace)
 {
     foreach (var join in workspace.FindOutgoingJoins(this))
     {
         join.BuildPlan(builder, workspace);
     }
 }
Esempio n. 6
0
        internal override void BuildPlan(PlanBuilder3D builder, MillingWorkspacePanel workspace)
        {
            var offsetLines = afterScaleTransformation(_currentOffsetLines);

            if (!offsetLines.Any() || !offsetLines.First().Any())
            {
                return;
            }

            builder.AddRampedLine(offsetLines.First().First());
            var currentDepth = 0.0;

            while (currentDepth <= MillingDepth)
            {
                builder.GotoZ(currentDepth);

                foreach (var cluster in offsetLines)
                {
                    foreach (var point in cluster)
                    {
                        builder.AddCuttingSpeedTransition(point);
                    }
                }

                var depthIncrement = Math.Min(workspace.MaxLayerCut, MillingDepth - currentDepth);
                if (depthIncrement <= 0)
                {
                    break;
                }
                currentDepth += depthIncrement;
            }
            builder.GotoTransitionLevel();
            builder.AddRampedLine(EntryPoint);
        }
Esempio n. 7
0
        internal override void BuildPlan(PlanBuilder3D builder, MillingWorkspacePanel workspace)
        {
            /*
             * for (var i = 0; i < 100; ++i)
             * {
             *  builder.AddRampedLine(new Point3Dmm(PositionX , PositionY, builder.ZeroLevel + 5));
             *  builder.AddRampedLine(new Point3Dmm(PositionX, PositionY, builder.ZeroLevel));
             * }
             * return;
             */

            var maxZ = _toolPath.Targets.Select(t => t.End.Z).Max();
            var minZ = _toolPath.Targets.Select(t => t.End.Z).Min();

            foreach (var target in _toolPath.Targets)
            {
                var p     = target.End;
                var p3Dmm = new Point3Dmm(p.X + PositionX, -p.Y + PositionY, -p.Z + builder.ZeroLevel);
                if (target.MotionMode == MotionMode.IsLinearRapid)
                {
                    //builder.AddRampedLine(new Point3Dmm(p3Dmm.X, p3Dmm.Y, builder.ZeroLevel));
                    builder.AddRampedLine(p3Dmm);
                    //builder.AddCuttingLine(p3Dmm);
                }
                else
                {
                    builder.AddCuttingLine(p3Dmm);
                }
            }
            builder.AddRampedLine(getEntryPoint());
        }
Esempio n. 8
0
        internal HeadCNC(Color headColor, MillingWorkspacePanel parent)
        {
            var brush = new SolidColorBrush(headColor);

            brush.Opacity = 0.8;
            _headPen      = new Pen(brush, 4.0);
            _parent       = parent;

            Position = new Point3Dmm(0, 0, 0);
        }
Esempio n. 9
0
 internal abstract void BuildPlan(PlanBuilder3D builder, MillingWorkspacePanel workspace);
Esempio n. 10
0
 /// <inheritdoc/>
 internal virtual void RecalculateToWorkspace(MillingWorkspacePanel workspace, Size size)
 {
     _mmToVisualFactorC1 = size.Width / workspace.RangeX;
     _mmToVisualFactorC2 = size.Height / workspace.RangeY;
 }