Beispiel #1
0
        internal void RemoveJoin(ItemJoin join)
        {
            _itemJoins.Remove(join);

            InvalidateVisual();
            fireOnWorkItemListChanged();
            fireOnSettingsChanged();
        }
Beispiel #2
0
        internal void SetJoin(PointProviderItem shape1, int joinPointIndex1, PointProviderItem shape2, int joinPointIndex2)
        {
            if (shape1 is ScaffoldItem || shape2 is ScaffoldItem)
            {
                //scaffold cannot be joined
                return;
            }

            if (shape1 is NativeControlItem || (shape2 is NativeControlItem && !(shape1 is EntryPoint)))
            {
                //native items cant be joined with other items
                return;
            }

            if (shape2 is NativeControlItem)
            {
                //native items can run only separately
                _itemJoins.Clear();
            }

            var joinCopy = _itemJoins.ToArray();

            foreach (var join in joinCopy)
            {
                if (join.Item2 == shape2)
                {
                    //shape can have only one target join
                    _itemJoins.Remove(join);
                }

                if (join.Item1 == shape2 && join.Item2 == shape1)
                {
                    //cyclic joins are not allowes
                    _itemJoins.Remove(join);
                }
            }

            var newJoin = new ItemJoin(shape1, joinPointIndex1, shape2, joinPointIndex2);

            _itemJoins.Add(newJoin);

            InvalidateVisual();
            fireOnSettingsChanged();
            fireOnWorkItemListChanged();
        }
Beispiel #3
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]));
            }
        }
 /// <inheritdoc/>
 internal override void Build(WorkspacePanel workspace, List <Speed4Dstep> speedPoints, ItemJoin incommingJoin)
 {
     //there is nothing to build
 }
 /// <summary>
 /// Builds cutting plan for the item and all joined items recursively.
 /// Build assumes we are at item join point. Closed shapes has to return back to that point.
 /// </summary>
 /// <param name="workspace">Workspace where joins are defined.</param>
 /// <param name="speedPoints">Output of the build.</param>
 /// <param name="incommingJoin">Join which was used to get into the item.</param>
 internal abstract void Build(WorkspacePanel workspace, List <Speed4Dstep> speedPoints, ItemJoin incommingJoin);
Beispiel #6
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);
                }
            }
        }
Beispiel #7
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);
                }
            }
        }
Beispiel #8
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);
            }
        }