Exemplo n.º 1
0
 private void ActionCleanup()
 {
     ActionsGraph[InputNames.FacePickerPlane].Send(NotificationNames.Suspend);
     ActionsGraph[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode,
                                                          TopAbsShapeEnum.TopAbs_SOLID);
     _sizeWindow = null;
 }
 public override void OnDeactivate()
 {
     if (_sizeWindow != null)
     {
         _sizeWindow.Close();
         _sizeWindow = null;
     }
     base.OnDeactivate();
 }
 private void BuildDialog(string dialogTitle)
 {
     if (_sizeWindow != null)
     {
         return;
     }
     _builder    = new NodeBuilder(_selectedNodes[0]);
     _axis       = GeomUtils.ExtractAxis(new NodeBuilder(_selectedNodes[1]).Shape);
     _sizeWindow = new ToolRangeValuesWindow(-360, 360, dialogTitle);
     _sizeWindow.OnValueChange  += PreviewRotate;
     _sizeWindow.OnDialogClosed += OnClosed;
     _sizeWindow.Show();
 }
Exemplo n.º 4
0
        protected override void OnMouseClick3DAction(Mouse3DPosition mouseData)
        {
            if (!mouseData.MouseDown)
            {
                return;
            }
            if (_stage >= Stages.SecondShape)
            {
                return;
            }
            if (_selectedNode == null)
            {
                return;
            }
            if (_entities.Count != 0 && _selectedNode.ShapeCount == _entities[0].ShapeCount)
            {
                return;
            }
            _entities.Add(_selectedNode);
            NextStage();

            if (_stage != Stages.SecondShape)
            {
                return;
            }
            if (_sizeWindow != null)
            {
                return;
            }

            var referenceShapeDirection = GeomUtils.ExtractDirection(_entities[1].TargetShape());

            if (referenceShapeDirection == null)
            {
                NaroMessage.Show("Invalid face selected!");
                return;
            }
            _axis.Direction = referenceShapeDirection;

            ActionsGraph[InputNames.FacePickerPlane].Send(NotificationNames.Suspend);
            ActionsGraph[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode,
                                                                 TopAbsShapeEnum.TopAbs_SOLID);

            //_sizeWindow = new ToolRangeValuesWindow(-Math.PI/2, Math.PI/2, "Angle Draft");
            _sizeWindow = new ToolRangeValuesWindow(-90, 90, "Angle Draft");
            _sizeWindow.OnValueChange  += PreviwFillet;
            _sizeWindow.OnDialogClosed += OnClosed;
            _sizeWindow.Show();
        }
Exemplo n.º 5
0
        public override void OnActivate()
        {
            base.OnActivate();
            var sketchBuilder = new SketchCreator(Document, false);
            var sketchNode    = sketchBuilder.CurrentSketch;

            if (sketchNode != null)
            {
                ActionsGraph.SwitchAction(ModifierNames.EndSketch, ModifierNames.AngleDraftEnhanced);
                return;
            }
            _sizeWindow = null;
            _stage      = Stages.None;
            _entities.Clear();
            ActionsGraph[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode,
                                                                 TopAbsShapeEnum.TopAbs_FACE);
            ActionsGraph[InputNames.FacePickerPlane].Send(NotificationNames.Resume);
        }
        private void OnClosed()
        {
            var rotationValue = _sizeWindow.Value;
            var dialogResult  = _sizeWindow.Result;

            _sizeWindow = null;
            InitSession();
            if (!dialogResult)
            {
                BackToNeutralModifier();
                return;
            }
            PerformRotate(_builder, rotationValue);

            // Finish the transaction
            CommitFinal("Apply Rotate Axis");

            // Change back to selection mode
            BackToNeutralModifier();
        }