Пример #1
0
        private void ExtrudeClicked(object sender, RoutedEventArgs e)
        {
            var pusherInput = _actionsGraph[InputNames.CommandLinePrePusher];

            pusherInput.Send(NotificationNames.PushValue, _selectedEntity);
            _actionsGraph.SwitchAction(ModifierNames.Extrude);
        }
Пример #2
0
 private void SwitchToNoneIfNeeded()
 {
     if (_actionsGraph.CurrentAction.Name != ModifierNames.None)
     {
         _actionsGraph.SwitchAction(ModifierNames.None);
     }
 }
        public override void OnActivate()
        {
            ActionsGraph[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.Unknown);
            //if (Document.Root.Children.Count == 0)
            //{
            //    sketchNode = CreateDefaultSketchNode(Document);
            //}
            //else
            //{
            //    var currentSketchNode = Document.Root[Document.Root.Get<DocumentContextInterpreter>().ActiveSketch];
            //    sketchNode = currentSketchNode;
            //}
            var sketchBuilder = new SketchCreator(Document, false);

            sketchNode = sketchBuilder.CurrentSketch;
            if (sketchNode == null)
            {
                ActionsGraph.SwitchAction(ModifierNames.StartSketch, ModifierNames.Line3D);
                return;
            }
            Document.Transact();
            SetupHinter(sketchNode);
            normalOnPlane = sketchNode.Children[1].Get <Axis3DInterpreter>().GpAxis;
            var pointBuilder = GetSketchNode(Document, new Point3D(), sketchNode);

            pointBuilder.Visibility = ObjectVisibility.Hidden;
            var builder = new NodeBuilder(Document, FunctionNames.LineTwoPoints);

            builder[0].Reference = pointBuilder.Node;
            builder[1].Reference = pointBuilder.Node;
            builder.ExecuteFunction();
            AddNodeToTree(builder.Node);
            Reset();
            Hinter2D.Populate();
        }
Пример #4
0
        public override void OnActivate()
        {
            base.OnActivate();

            var sketchBuilder = new SketchCreator(Document, false);

            sketchNode = sketchBuilder.CurrentSketch;
            if (sketchNode == null)
            {
                ActionsGraph.SwitchAction(ModifierNames.StartSketch, ModifierNames.DrawCircle);
                return;
            }
            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.Disable);
            normalOnPlane = sketchBuilder.NormalOnSketch.Value.GpAxis;
            var trsf = sketchBuilder.CurrentSketch.Get <TransformationInterpreter>().CurrTransform;

            normalOnPlane = normalOnPlane.Transformed(trsf);
            sketchNode    = sketchBuilder.CurrentSketch;
            Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.Suspend);
            var pointBuilder = GetSketchNode(Document, new Point3D(), sketchNode);

            pointBuilder.Visibility = ObjectVisibility.Hidden;
            builder = new NodeBuilder(Document, FunctionNames.Circle);
            builder[0].Reference = pointBuilder.Node;
            builder[1].Real      = 0.0;
            builder.Visibility   = ObjectVisibility.Hidden;
            builder.ExecuteFunction();
            AddNodeToTree(builder.Node);
            ActionsGraph[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.Unknown);
            Reset();
        }
Пример #5
0
        protected override void OnMouseDownAction(Mouse3DPosition mouseData)
        {
            var shapeIndex    = GetSplineIndex(mouseData);
            var sketch        = Document.Root.Get <DocumentContextInterpreter>().ActiveSketch;
            var sketchBuilder = new SketchCreator(Document);

            var nodeBuilder = new NodeBuilder(sketchBuilder.CurrentSketch);

            nodeBuilder[0].TransformedAxis3D = sketchBuilder.NormalOnSketch.Value.GpAxis;

            if (shapeIndex == -1)
            {
                return;
            }
            var root       = Document.Root;
            var builder    = new NodeBuilder(root[shapeIndex]);
            var pointCount = builder[0].Integer;
            var subIndex   = -1;

            for (var i = 1; i < pointCount - 1; ++i)
            {
                var pointInSpline = builder[i].TransformedPoint3D;
                if (ArePointsOutOfZoomRange(pointInSpline, mouseData.Point))
                {
                    subIndex = i - 1;
                }
            }
            Ensure.IsNotTrue(subIndex == -1);
            InitSession();
            SplitSplineLogic(builder, subIndex);
            CommitFinal("Split Spline");
            UpdateView();
            ActionsGraph.SwitchAction(ModifierNames.SplitSpline);
        }
Пример #6
0
        public override void OnActivate()
        {
            base.OnActivate();

            //var sketchCreator = new SketchCreator(Document, false);
            //if (sketchCreator.CurrentSketch == null)
            //{
            //    BackToNeutralModifier();
            //    return;
            //}

            var sketchBuilder = new SketchCreator(Document, false);
            var sketchNode    = sketchBuilder.CurrentSketch;

            if (sketchNode == null)
            {
                ActionsGraph.SwitchAction(ModifierNames.StartSketch, ModifierNames.Point3D);
                return;
            }
            var axis = sketchBuilder.NormalOnSketch.Value;
            var trsf = sketchBuilder.CurrentSketch.Get <TransformationInterpreter>().CurrTransform;

            axis.Location = new Point3D(axis.Location.GpPnt.Transformed(trsf));
            // Block drawing plane
            Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.Resume);
            //Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.SetPlane,
            //                                          new gpPln(axis.GpAxis.Location,
            //                                                       axis.GpAxis.Direction));
            Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.Suspend);

            ActionsGraph[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.Unknown);
            Reset();
        }
        public void HandleChangeCommand(string partialCommandName)
        {
            if (string.IsNullOrEmpty(partialCommandName))
            {
                AddData(CoordinatateParserNames.Stop);
                return;
            }
            var listCommands = GetCommandList(partialCommandName);

            if (listCommands.Count == 0)
            {
                return;
            }
            var commandName   = listCommands[0];
            var currentAction = ListCommands.GetAction(ListCommands.NameMapping[commandName]);

            if (currentAction != null)
            {
                ActionsGraph.SwitchAction(currentAction.Name);
            }
            else
            {
                AddData(CoordinatateParserNames.Stop);
            }
        }
Пример #8
0
        public override void OnActivate()
        {
            base.OnActivate();

            var sketchBuilder = new SketchCreator(Document, false);

            sketchNode = sketchBuilder.CurrentSketch;
            if (sketchNode == null)
            {
                ActionsGraph.SwitchAction(ModifierNames.StartSketch, ModifierNames.ArcCenterStartEnd);
                return;
            }
            normalOnPlane = sketchBuilder.NormalOnSketch.Value.GpAxis;
            sketchNode    = sketchBuilder.CurrentSketch;
            // Block drawing plane
            Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.Suspend);

            ActionsGraph[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.Unknown);
            var pointBuilder  = GetSketchNode(Document, new Point3D(), sketchNode);
            var pointBuilder2 = GetSketchNode(Document, new Point3D(0.0, 0, 0), sketchNode);
            var pointBuilder3 = GetSketchNode(Document, new Point3D(0, 0.0, 0), sketchNode);
            var builder       = new NodeBuilder(Document, FunctionNames.Arc);

            builder[0].Reference = pointBuilder.Node;
            builder[1].Reference = pointBuilder2.Node;
            builder[2].Reference = pointBuilder3.Node;
            builder.ExecuteFunction();
            Inputs[InputNames.UiElementsItem].Send(NotificationNames.RefreshPropertyTab, builder.Node);
            Reset();
        }
        private void MouseUpHandler(Mouse3DPosition mouseData)
        {
            if (_shapeHandler == null)
            {
                return;
            }
            if (!_shapeHandler.IsDragging)
            {
                return;
            }
            //      var interpreter = _shapeHandler.Node.Get<TransformationInterpreter>();
            //      var transform = interpreter.CurrTransform.Multiplied(new OCgp_Trsf());

            _shapeHandler.MouseDrag(mouseData);
            //_builder.Transformation = transform;
            //_builder.ExecuteFunction();
            _shapeHandler.EndDragging(mouseData);

            _editingDocument.Revert();
            //var autoGroupNode = AutoGroupLogic.TryAutoGroup(Document, _shapeHandler.Node);
            //if (autoGroupNode != null)
            //{
            //    RebuildTreeView();
            //}
            Inputs[InputNames.UiElementsItem].Send(NotificationNames.SelectNode, _shapeHandler.Node);
            Document.Commit("Finished dragging");
            UpdateView();

            ActionsGraph.SwitchAction(ModifierNames.None);
        }
Пример #10
0
        public override void OnActivate()
        {
            base.OnActivate();
            var mouseCursorInput = ActionsGraph[InputNames.MouseCursorInput];

            mouseCursorInput.Send(NotificationNames.SetResourceManager, MetaActionResource.ResourceManager);
            mouseCursorInput.Send(NotificationNames.SetCursorName, "arcRSE.cur");

            var sketchBuilder = new SketchCreator(Document, false);

            sketchNode = sketchBuilder.CurrentSketch;
            if (sketchNode == null)
            {
                ActionsGraph.SwitchAction(ModifierNames.StartSketch, ModifierNames.ArcStartEndRadius);
                return;
            }
            normalOnPlane = sketchBuilder.NormalOnSketch.Value.GpAxis;
            sketchNode    = sketchBuilder.CurrentSketch;
            // Block drawing plane
            Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.Suspend);

            ActionsGraph[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.Unknown);

            Reset();
        }
Пример #11
0
        public override void OnActivate()
        {
            base.OnActivate();
            var shouldExit = SaveFileIfNeeded();

            if (shouldExit)
            {
                BackToNeutralModifier();
                return;
            }

            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode, TopAbsShapeEnum.TopAbs_SOLID);
            Inputs[InputNames.FileOpenDialog].Send(NotificationNames.SetFilter, FilterNaroXml);
            var dialogResult = Inputs[InputNames.FileOpenDialog].GetData(NotificationNames.Show).Get <DialogResult>();

            if (dialogResult == DialogResult.OK)
            {
                var fileName = Inputs[InputNames.FileOpenDialog].GetData(NotificationNames.GetFile).Text;

                LoadFileContent(fileName);
            }
            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode,
                                                           TopAbsShapeEnum.TopAbs_FACE);
            ActionsGraph.SwitchAction(ModifierNames.EndSketch);
            BackToNeutralModifier();
        }
Пример #12
0
        private void MouseClickHandler(Mouse3DPosition mouseData)
        {
            if (mouseData.MouseDown)
            {
                return;
            }

            if (mouseData.ShiftDown || mouseData.ControlDown)
            {
                Inputs[InputNames.EditingToolsInput].Send(NotificationNames.HideEditor);
                return;
            }

            var entities =
                Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetEntities).Get
                <List <SceneSelectedEntity> >();

            if (entities.Count == 0)
            {
                ActionsGraph.SwitchAction(ModifierNames.None);
            }
            if (entities.Count == 1)
            {
                ActionsGraph.SwitchAction(ModifierNames.EditingAction);
            }
        }
Пример #13
0
        private void OnTreeNodeSelect(Node node)
        {
            var entities =
                Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetEntities).Get
                <List <SceneSelectedEntity> >();

            entities.Clear();
            entities.Add(new SceneSelectedEntity(node));
            ActionsGraph.SwitchAction(ModifierNames.EditingAction);
        }
Пример #14
0
        public override void OnActivate()
        {
            Inputs[InputNames.GeometricSolverPipe].Send(NotificationNames.DisableAll);
            var uiBuilder     = ActionsGraph[InputNames.UiBuilderInput].Get <UiBuilder>();
            var sketchControl = uiBuilder.GetItemAtPath("Ribbon/Modelling/Sketch/Sketch");

            _sketchButton = (ISketchButton)sketchControl;
            if (Document.Root.Get <DocumentContextInterpreter>().ActiveSketch != -1)
            {
                var sketchNode = Document.Root[Document.Root.Get <DocumentContextInterpreter>().ActiveSketch];

                // rebuild sketch faces
                sketchNode.Children[2].Set <MeshTopoShapeInterpreter>().Shape = null;
                var results = AutoGroupLogic.BuildAutoFaces(sketchNode, Document);
                Document.Transact();
                if (results.Count > 0)
                {
                    TopoDSShape finalShape = results[0];
                    // if there is more than one shape on the sketch, we need to sew the faces resulted from BuildAutoFaces
                    for (int i = 1; i < results.Count; i++)
                    {
                        if (results[i] == null)
                        {
                            continue;
                        }
                        var sew = new BRepBuilderAPISewing(1.0e-06, true, true, true, false);
                        sew.Add(finalShape);
                        sew.Add(results[i]);
                        var messg = new MessageProgressIndicator();
                        sew.Perform(messg);

                        finalShape = sew.SewedShape;
                    }

                    sketchNode.Children[2].Set <MeshTopoShapeInterpreter>().Shape = finalShape;

                    // we need to set transparency to 1 (don't show) before we set it to hidden
                    sketchNode.Set <DrawingAttributesInterpreter>().Transparency = 1;
                    sketchNode.Set <DrawingAttributesInterpreter>().Visibility   = ObjectVisibility.Hidden;
                }
                int index;
                NodeUtils.SetSketchTransparency(Document, sketchNode,
                                                NodeUtils.SketchHas3DApplied(Document, sketchNode, out index) ? ObjectVisibility.Hidden : ObjectVisibility.ToBeDisplayed);
            }
            Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.SetPlane, new DataPackage(null));
            Document.Root.Get <DocumentContextInterpreter>().ActiveSketch = -1;
            RemoveHighlightCurrentSketchNodes();
            Document.Commit("reset active sketch");
            _sketchButton.Unblock();
            if (ActionsGraph.PendingAction != null && ActionsGraph.PendingAction.Name == ModifierNames.None)
            {
                Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode, TopAbsShapeEnum.TopAbs_FACE);
            }
            ActionsGraph.SwitchAction(ModifierNames.None);
        }
Пример #15
0
        private bool IfParallelWithPlaneSwitchAction(gpPln plane, gpPln planeToCompare, string actionName)
        {
            var distance = Math.Abs(plane.Distance(planeToCompare));

            if (plane.Position.IsCoplanar(planeToCompare.Position, 1e-6, 1e-5) || distance > 1e-5)
            {
                ActionsGraph.SwitchAction(actionName);
                return(true);
            }
            return(false);
        }
Пример #16
0
        protected override void OnMouseDownAction(Mouse3DPosition mouseData)
        {
            var index = GetSplineIndex(mouseData);

            if (index == -1)
            {
                return;
            }
            InitSession();
            _listCommonPoints[index].Combine(Document);
            CommitFinal("Combined splines");
            UpdateView();
            RebuildTreeView();
            ActionsGraph.SwitchAction(ModifierNames.CombineSplines);
        }
        public override void OnActivate()
        {
            base.OnActivate();
            var sketchBuilder = new SketchCreator(Document, false);
            var sketchNode    = sketchBuilder.CurrentSketch;

            if (sketchNode != null)
            {
                ActionsGraph.SwitchAction(ModifierNames.EndSketch, ModifierNames.Cut);
                return;
            }
            Inputs[InputNames.GeometricSolverPipe].Send(NotificationNames.DisableAll);
            ShowHint(_messagesList[0]);
            Reset();
        }
Пример #18
0
        private void Mouse3DEventHandler(DataPackage data)
        {
            _shapeEditingContainer.Mouse3DEventHandler(data.Get <Mouse3DPosition>());
            _gizmoContainer.Mouse3DEventHandler(data.Get <Mouse3DPosition>());
            var selectionContainer =
                Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetContainer).Get
                <SelectionContainer>();

            if (selectionContainer.Entities.Count == 1 && data.Get <Mouse3DPosition>().Clicks == 2)
            {
                if (FunctionNames.GetSketchShapes().ToList().Contains(selectionContainer.Entities[0].Node.Get <ShapeFunctionsInterface.Functions.FunctionInterpreter>().Name))
                {
                    ActionsGraph.SwitchAction(ModifierNames.StartSketch);
                }
            }
        }
Пример #19
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.Fillet);
                return;
            }
            Reset();
            Inputs[InputNames.GeometricSolverPipe].Send(NotificationNames.DisableAll);
            ActionsGraph[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode,
                                                                 TopAbsShapeEnum.TopAbs_EDGE);
        }
Пример #20
0
        private void OnCommandParser(DataPackage data)
        {
            switch (data.Text)
            {
            case CoordinatateParserNames.ParsedValue:
                PushValue(data.Data);
                break;

            case CoordinatateParserNames.ChangeMetaAction:
                ActionsGraph.SwitchAction(data.Get <string>());
                break;

            case CoordinatateParserNames.Stop:
                BackToNeutralModifier();
                break;
            }
        }
Пример #21
0
        private void MouseClickHandler(Mouse3DPosition mousePosition)
        {
            if (mousePosition.MouseDown)
            {
                return;
            }

            var entities =
                Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetEntities).Get
                <List <SceneSelectedEntity> >();

            if (entities.Count <= 0)
            {
                var selectedFace =
                    Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetSelectedFace).Get
                    <SceneSelectedEntity>();
                if (selectedFace == null)
                {
                    return;
                }
                if (selectedFace.Node.Index < 3)
                {
                    return;
                }
                entities.Add(selectedFace);
            }
            var selectedLabel = entities[entities.Count - 1].Node;

            OnChangedShapeClick(selectedLabel);

            if (mousePosition.ShiftDown || mousePosition.ControlDown)
            {
                return;
            }

            var selectionMode =
                Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetSelectionMode).Get
                <TopAbsShapeEnum>();

            //if (selectionMode != TopAbsShapeEnum.TopAbs_SOLID)
            //    return;
            if (selectedLabel.Interpreters.Count > 0)
            {
                ActionsGraph.SwitchAction(ModifierNames.EditingAction);
            }
        }
Пример #22
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);
        }
Пример #23
0
        private void OnTreeNodeSelect(Node node)
        {
            var selectedLabel = node;

            if (selectedLabel.Get <FunctionInterpreter>() == null)
            {
                return;
            }

            OnChangedShapeClick(selectedLabel);

            var entities =
                Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetEntities).Get
                <List <SceneSelectedEntity> >();

            entities.Add(new SceneSelectedEntity(node));
            ActionsGraph.SwitchAction(ModifierNames.EditingAction);
        }
Пример #24
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.Cut);
                return;
            }
            _selectedNode = null;
            PrePushItems();
            cutBuilder = new NodeBuilder(Document, FunctionNames.Cut);
            cutBuilder.ExecuteFunction();
            cutBuilder.Visibility = ObjectVisibility.Hidden;
            Inputs[InputNames.UiElementsItem].Send(NotificationNames.RefreshPropertyTab, cutBuilder.Node);
            if (_selectedNode == null)
            {
                var selectedShape = GeomUtils.GetCurrentSelectedShape(Context);
                if (selectedShape != null)
                {
                    _selectedNode = GeomUtils.IdentifyNode(Document.Root, selectedShape);
                    if (_selectedNode != null)
                    {
                        _currentSelectedNode  = _selectedNode.Node;
                        cutBuilder[2].Integer = (int)CutTypes.ThroughAll;
                        ApplyCut();
                    }
                }
                else
                {
                    // Experimental code, needs review
                    _currentSelectedNode = TreeView.GetSelectedNode();
                    if (_currentSelectedNode == null)
                    {
                        return;
                    }
                    _selectedNode = new SceneSelectedEntity(_currentSelectedNode);
                }
            }
            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode,
                                                           TopAbsShapeEnum.TopAbs_SOLID);
        }
Пример #25
0
        public override void OnActivate()
        {
            base.OnActivate();

            var sketchBuilder = new SketchCreator(Document, false);
            var sketchNode    = sketchBuilder.CurrentSketch;

            if (sketchNode == null)
            {
                ActionsGraph.SwitchAction(ModifierNames.StartSketch, ModifierNames.Ellipse);
                return;
            }
            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.Disable);
            normalOnPlane = sketchBuilder.NormalOnSketch.Value.GpAxis;
            // Block drawing plane
            //Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.Resume);
            //Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.SetPlane,
            //                                          new gpPln(sketchPlane.GpAxis.Location(),
            //                                                       sketchPlane.GpAxis.Direction()));
            Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.Suspend);
            var nodeBuilder = new NodeBuilder(sketchBuilder.CurrentSketch);

            nodeBuilder[0].TransformedAxis3D = normalOnPlane;
            var currentSketchNode = Document.Root[Document.Root.Get <DocumentContextInterpreter>().ActiveSketch];

            sketchNode = currentSketchNode;
            var firstPointBuilder  = GetSketchNode(Document, new Point3D(), sketchNode);
            var secondPointBuilder = GetSketchNode(Document, new Point3D(), sketchNode);
            var thirdPointBuilder  = GetSketchNode(Document, new Point3D(), sketchNode);

            firstPointBuilder.Visibility  = ObjectVisibility.Hidden;
            secondPointBuilder.Visibility = ObjectVisibility.Hidden;
            thirdPointBuilder.Visibility  = ObjectVisibility.Hidden;
            var builder = new NodeBuilder(Document, FunctionNames.Ellipse);

            builder[0].Reference = firstPointBuilder.Node;
            builder[1].Reference = secondPointBuilder.Node;
            builder[2].Reference = thirdPointBuilder.Node;
            builder.ExecuteFunction();
            builder.Visibility = ObjectVisibility.Hidden;
            ActionsGraph[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.Unknown);
            Reset();
        }
Пример #26
0
        public override void OnActivate()
        {
            base.OnActivate();
            var sketchBuilder = new SketchCreator(Document, false);
            var sketchNode    = sketchBuilder.CurrentSketch;

            if (sketchNode == null)
            {
                ActionsGraph.SwitchAction(ModifierNames.StartSketch, ModifierNames.FourLinesRectangle);
                return;
            }
            ActionsGraph[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.Unknown);
            sketchNode  = new SketchCreator(Document).CurrentSketch;
            _sketchNode = sketchNode;
            var nodeBuilder = new NodeBuilder(_sketchNode);

            _sketchCoordinateTranslator = new Sketch3DTo2DTranslator(nodeBuilder[0].Axis3D);
            Reset();
        }
Пример #27
0
        public override void OnActivate()
        {
            base.OnActivate();
            Points.Clear();
            Points.Add(new Point3D());
            var sketchBuilder = new SketchCreator(Document, false);

            sketchNode = sketchBuilder.CurrentSketch;
            if (sketchNode == null)
            {
                finishDrawing = false;
                ActionsGraph.SwitchAction(ModifierNames.StartSketch, ModifierNames.LineInPolylineMode);
                return;
            }
            finishDrawing = true;
            var mouseCursorInput = Inputs[InputNames.MouseCursorInput];

            mouseCursorInput.Send(NotificationNames.SetResourceManager, MetaActionResource.ResourceManager);
            mouseCursorInput.Send(NotificationNames.SetCursorName, "polyline.cur");
            Inputs[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.PointAsked);
        }
Пример #28
0
        public override void OnActivate()
        {
            base.OnActivate();
            Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.Resume);
            Inputs[InputNames.GeometricSolverPipe].Send(NotificationNames.DisableAll);
            var sketchBuilder = new SketchCreator(Document, false);
            var sketchNode    = sketchBuilder.CurrentSketch;

            if (sketchNode != null)
            {
                ActionsGraph.SwitchAction(ModifierNames.EndSketch, ModifierNames.Extrude);
                return;
            }
            Reset();
            extrudeBuilder         = new NodeBuilder(Document, FunctionNames.Extrude);
            extrudeBuilder[2].Real = 0.0;
            extrudeBuilder.ExecuteFunction();
            extrudeBuilder.Visibility = ObjectVisibility.Hidden;
            Inputs[InputNames.UiElementsItem].Send(NotificationNames.RefreshPropertyTab, extrudeBuilder.Node);
            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.Enable);
            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode,
                                                           TopAbsShapeEnum.TopAbs_SOLID);
        }
        public override void OnActivate()
        {
            base.OnActivate();

            // Hide the currently selected object and the objects that have references to it
            var entities =
                Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetEntities).Get
                <List <SceneSelectedEntity> >();


            if (entities.Count == 0 || entities[0] == null)
            {
                WarnNoSelectedAndBackToNone();
                return;
            }
            var    shapeName = new NodeBuilder(entities[0].Node).FunctionName;
            string actioNName;

            if (_shapeToActionMapping.TryGetValue(shapeName, out actioNName))
            {
                ActionsGraph.SwitchAction(actioNName);
            }
        }
Пример #30
0
 private void InterpolatedClick(object sender, RoutedEventArgs e)
 {
     _actionsGraph.SwitchAction(ModifierNames.InterpolatedSpline);
 }