Example #1
0
        /// <inheritdoc/>
        internal override void Build(WorkspacePanel workspace, List <Speed4Dstep> speedPoints, ItemJoin incommingJoin)
        {
            if (incommingJoin.Item1 != workspace.EntryPoint)
            {
                throw new NotSupportedException("Native controll item can be run only from entry point.");
            }

            var outJoins = workspace.FindOutgoingJoins(this);

            if (outJoins.Any())
            {
                throw new NotSupportedException("Native controll item cannot have outgoing joins.");
            }

            var cutPoints = CutPoints.ToArray();
            var speeds    = SegmentSpeeds.ToArray();

            if (cutPoints.Length != speeds.Length + 1)
            {
                throw new NotSupportedException("Invalid point/speed matching.");
            }

            for (var i = 1; i < cutPoints.Length; ++i)
            {
                speedPoints.Add(cutPoints[i].With(speeds[i - 1]));
            }
        }
Example #2
0
        /// <inheritdoc/>
        internal override void Build(WorkspacePanel workspace, List <Speed4Dstep> speedPoints, ItemJoin incommingJoin)
        {
            if (incommingJoin.Item2 != this)
            {
                throw new NotSupportedException("Incomming join point is not valid.");
            }

            var cuttingSpeed = workspace.CuttingSpeed;
            var cutPoints    = CutPoints.ToArray();

            if (!cutPoints.First().Equals(cutPoints.Last()))
            {
                throw new NotSupportedException("Shape is not closed.");
            }

            //skip the repetitive point so we can join to whatever shape part.
            cutPoints = cutPoints.Take(cutPoints.Length - 1).ToArray();

            var outJoins   = workspace.FindOutgoingJoins(this);
            var startIndex = incommingJoin.JoinPointIndex2;

            for (var i = startIndex + 1; i <= startIndex + cutPoints.Length; ++i)
            {
                var currentIndex = i % cutPoints.Length;
                var currentPoint = cutPoints[currentIndex];

                speedPoints.Add(currentPoint.With(cuttingSpeed));

                var currentOutgoingJoins = workspace.GetOutgoingJoinsFrom(currentIndex, outJoins);
                foreach (var currentOutgoingJoin in currentOutgoingJoins)
                {
                    currentOutgoingJoin.Build(workspace, speedPoints);
                }
            }
        }
Example #3
0
        /// <inheritdoc/>
        internal override void Build(WorkspacePanel workspace, List <Speed4Dstep> speedPoints, ItemJoin incommingJoin)
        {
            if (incommingJoin != null)
            {
                throw new NotSupportedException("Incomming join point has to be empty for entry point.");
            }

            foreach (var join in workspace.FindOutgoingJoins(this))
            {
                join.Build(workspace, speedPoints);
            }
        }
Example #4
0
        /// <inheritdoc/>
        internal override void Build(WorkspacePanel workspace, List <Speed4Dstep> speedPoints, ItemJoin incommingJoin)
        {
            if (_speedAlgorithm == SpeedAlgorithm.TowerBased || !UseExplicitKerf)
            {
                base.Build(workspace, speedPoints, incommingJoin);
                return;
            }

            if (incommingJoin.Item2 != this)
            {
                throw new NotSupportedException("Incomming join point is not valid.");
            }

            var cuttingSpeed = workspace.CuttingSpeed;
            var cutPoints    = CutPoints.ToArray();

            if (!cutPoints.First().Equals(cutPoints.Last()))
            {
                throw new NotSupportedException("Shape is not closed.");
            }

            var definitionPoints = CutDefinition.ToArray();

            if (cutPoints.Count() != definitionPoints.Count())
            {
                throw new NotSupportedException("Invalid cut points count.");
            }

            //skip the repetitive point so we can join to whatever shape part.
            cutPoints = cutPoints.Take(cutPoints.Length - 1).ToArray();
            definitionPoints.Take(definitionPoints.Length - 1).ToArray();

            var projector = new PlaneProjector(_shapeMetricThickness, _wireLength);

            var outJoins   = workspace.FindOutgoingJoins(this);
            var startIndex = incommingJoin.JoinPointIndex2;

            for (var i = startIndex + 1; i <= startIndex + cutPoints.Length; ++i)
            {
                var currentIndex = i % cutPoints.Length;
                var currentPoint = cutPoints[currentIndex];

                var speeds = getSpeeds(definitionPoints, currentIndex, cuttingSpeed, projector);
                //System.Diagnostics.Debug.Print(speeds.ToString());
                var speed1Limit = speeds.Item1.ToDeltaT() >= Constants.StartDeltaT || speeds.Item1.ToDeltaT() < 0;
                var speed2Limit = speeds.Item2.ToDeltaT() >= Constants.StartDeltaT || speeds.Item2.ToDeltaT() < 0;

                if (!speed1Limit || !speed2Limit)
                {
                    throw new PlanningException("Speed limit exceeded");
                }

                speedPoints.Add(currentPoint.With(speeds.Item1, speeds.Item2));

                var currentOutgoingJoins = workspace.GetOutgoingJoinsFrom(currentIndex, outJoins);
                foreach (var currentOutgoingJoin in currentOutgoingJoins)
                {
                    currentOutgoingJoin.Build(workspace, speedPoints);
                }
            }
        }