Esempio n. 1
0
        private void ShowModifiers()
        {
            HideModifiers();		// Just in case something is already showing

            // Arrows
            switch (this.AllowedScale)
            {
                case PartDesignAllowedScale.X_Y_Z:
                    GetNewArrows(out _arrowX1, out _arrowX2, DraggingModifier.ArrowX1);
                    GetNewArrows(out _arrowY1, out _arrowY2, DraggingModifier.ArrowY1);
                    GetNewArrows(out _arrowZ1, out _arrowZ2, DraggingModifier.ArrowZ1);
                    break;

                case PartDesignAllowedScale.XY_Z:
                    GetNewArrows(out _arrowX1, out _arrowX2, DraggingModifier.ArrowX1);
                    GetNewArrows(out _arrowZ1, out _arrowZ2, DraggingModifier.ArrowZ1);
                    break;

                case PartDesignAllowedScale.XYZ:
                    GetNewArrows(out _arrowZ1, out _arrowZ2, DraggingModifier.ArrowZ1);
                    break;

                case PartDesignAllowedScale.None:
                    break;

                default:
                    throw new ApplicationException("Unknown PartDesignAllowedScale: " + this.AllowedScale.ToString());
            }

            // Rings
            switch (this.AllowedRotation)
            {
                case PartDesignAllowedRotation.None:
                    break;

                case PartDesignAllowedRotation.X_Y:
                    _ringX = GetNewRing(DraggingModifier.RingX);
                    _ringY = GetNewRing(DraggingModifier.RingY);
                    break;

                case PartDesignAllowedRotation.X_Y_Z:
                    _ringX = GetNewRing(DraggingModifier.RingX);
                    _ringY = GetNewRing(DraggingModifier.RingY);
                    _ringZ = GetNewRing(DraggingModifier.RingZ);
                    break;

                default:
                    throw new ApplicationException("Unknown PartDesignAllowedRotation: " + this.AllowedRotation.ToString());
            }

            // Balls
            switch (this.AllowedRotation)
            {
                case PartDesignAllowedRotation.None:
                    break;

                case PartDesignAllowedRotation.X_Y:
                    GetNewBalls(out _ballX1, out _ballX2, DraggingModifier.BallX1);
                    GetNewBalls(out _ballY1, out _ballY2, DraggingModifier.BallY1);
                    break;

                case PartDesignAllowedRotation.X_Y_Z:
                    GetNewBalls(out _ballX1, out _ballX2, DraggingModifier.BallX1);
                    GetNewBalls(out _ballY1, out _ballY2, DraggingModifier.BallY1);
                    GetNewBalls(out _ballZ1, out _ballZ2, DraggingModifier.BallZ1);
                    break;

                default:
                    throw new ApplicationException("Unknown PartDesignAllowedRotation: " + this.AllowedRotation.ToString());
            }

            // Move the visuals to be relative to the part
            TransformChanged();
        }
Esempio n. 2
0
        private void HideModifiers()
        {
            if (_arrowX1 != null)
            {
                _viewport.Children.Remove(_arrowX1.Model);
                _arrowX1 = null;
            }

            if (_arrowX2 != null)
            {
                _viewport.Children.Remove(_arrowX2.Model);
                _arrowX2 = null;
            }

            if (_arrowY1 != null)
            {
                _viewport.Children.Remove(_arrowY1.Model);
                _arrowY1 = null;
            }

            if (_arrowY2 != null)
            {
                _viewport.Children.Remove(_arrowY2.Model);
                _arrowY2 = null;
            }

            if (_arrowZ1 != null)
            {
                _viewport.Children.Remove(_arrowZ1.Model);
                _arrowZ1 = null;
            }

            if (_arrowZ2 != null)
            {
                _viewport.Children.Remove(_arrowZ2.Model);
                _arrowZ2 = null;
            }

            if (_ringX != null)
            {
                _viewport.Children.Remove(_ringX.Model);
                _ringX = null;
            }

            if (_ringY != null)
            {
                _viewport.Children.Remove(_ringY.Model);
                _ringY = null;
            }

            if (_ringZ != null)
            {
                _viewport.Children.Remove(_ringZ.Model);
                _ringZ = null;
            }

            if (_ballX1 != null)
            {
                _viewport.Children.Remove(_ballX1.Model);
                _ballX1 = null;
            }

            if (_ballX2 != null)
            {
                _viewport.Children.Remove(_ballX2.Model);
                _ballX2 = null;
            }

            if (_ballY1 != null)
            {
                _viewport.Children.Remove(_ballY1.Model);
                _ballY1 = null;
            }

            if (_ballY2 != null)
            {
                _viewport.Children.Remove(_ballY2.Model);
                _ballY2 = null;
            }

            if (_ballZ1 != null)
            {
                _viewport.Children.Remove(_ballZ1.Model);
                _ballZ1 = null;
            }

            if (_ballZ2 != null)
            {
                _viewport.Children.Remove(_ballZ2.Model);
                _ballZ2 = null;
            }
        }
Esempio n. 3
0
        private DraggableModifierRing GetNewRing(DraggingModifier whichRing)
        {
            DraggableModifierRing retVal;

            double radius = GetRadius_Ring(this.Scale, whichRing);

            switch (whichRing)
            {
                case DraggingModifier.RingX:
                    retVal = new DraggableModifierRing(new Quaternion(new Vector3D(0, 1, 0), 90), radius, _options.EditorColors);
                    break;

                case DraggingModifier.RingY:
                    retVal = new DraggableModifierRing(new Quaternion(new Vector3D(1, 0, 0), 90), radius, _options.EditorColors);
                    break;

                case DraggingModifier.RingZ:
                    retVal = new DraggableModifierRing(new Quaternion(new Vector3D(0, 0, 1), 0), radius, _options.EditorColors);
                    break;

                default:
                    throw new ApplicationException("Unexpected DraggingModifier: " + whichRing.ToString());
            }

            _viewport.Children.Add(retVal.Model);

            return retVal;
        }