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);
        }
Esempio n. 2
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();
        }
        public override void SetEditor(SelectionContainer selectedEntity, ActionsGraph actionsGraph)
        {
            SelectionContainer = selectedEntity;
            var entities = selectedEntity.Entities;

            if (entities.Count == 0)
            {
                return;
            }
            SelectedNode = entities[entities.Count - 1].Node;
            var name = FunctionUtils.GetFunctionName(entities[entities.Count - 1].Node);

            if (!_handlers.ContainsKey(name))
            {
                if (selectedEntity.CurrentSelectionMode != TopAbsShapeEnum.TopAbs_FACE)
                {
                    DeactivateEditingHandler();
                    return;
                }
                else
                {
                    _currentHandler = _handlers[FunctionNames.Face];
                    _currentHandler.SetSelectedEntity(entities[entities.Count - 1]);
                }
            }
            else
            {
                _currentHandler = _handlers[name];
            }

            _currentHandler.SetNode(entities[entities.Count - 1].Node);
            _currentHandler.DisplayHandles();

            ViewUpdate();
        }
        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);
        }
Esempio n. 5
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();
        }
Esempio n. 6
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();
        }
        public void Setup(ActionsGraph actionsGraph)
        {
            _functionFactory =
                actionsGraph[InputNames.FunctionFactoryInput].GetData(NotificationNames.GetValue).Get <IFunctionFactory>();

            MapFunctions();
        }
        public SketchToolsView(InteractionContainer sceneSelectedEntity, ActionsGraph actionsGraph)
        {
            _actionsGraph        = actionsGraph;
            _sceneSelectedEntity = sceneSelectedEntity.Entities[0];

            InitializeComponent();
        }
    public void Register(ActionsGraph actionsGraph, WorkItem workItem, CommandList commandList)
    {
        var uiBuilder =
            actionsGraph.InputContainer[InputNames.UiBuilderInput].GetData(NotificationNames.GetValue).Get <UiBuilder>();

        RegisterPluginUi.Register(uiBuilder);
    }
Esempio n. 10
0
        public void Setup(ActionsGraph actionsGraph)
        {
            _actionsGraph = actionsGraph;
            SetupBooEditor();

            SetupOpenSaveDialogs();
        }
Esempio n. 11
0
 public void SetInternalData(ActionsGraph actionsGraph)
 {
     _actionsGraph = actionsGraph;
     Document      =
         _actionsGraph.InputContainer[InputNames.Document].GetData(NotificationNames.GetValue).Get <Document>();
     Document.Root.Set <ActionGraphInterpreter>().ActionsGraph = _actionsGraph;
 }
        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();
        }
Esempio n. 13
0
        public static void ExecuteBooScript(ActionsGraph actionsGraph, string fileName)
        {
            var scriptLines = new List <string>(File.ReadAllLines(fileName));
            var context     = CompileScript(scriptLines);

            ExecuteBooScript(fileName, context, actionsGraph);
        }
Esempio n. 14
0
 public CommandList(ActionsGraph actionsGraph)
 {
     _actionsGraph          = actionsGraph;
     ContainerActionMapping = new SortedDictionary <string, ActionBase>();
     ActionMapping          = new SortedDictionary <string, MetaActionBase>();
     NameMapping            = new SortedDictionary <string, string>();
 }
        public override void SetEditor(SelectionContainer selectedEntity, ActionsGraph actionsGraph)
        {
            SelectionContainer = selectedEntity;
            var entities = selectedEntity.Entities;

            if (entities.Count == 0)
            {
                return;
            }
            SelectedNode = entities[0].Node;
            if (!_handlers.ContainsKey(CurrentGizmoType))
            {
                DeactivateGizmoHandler();
                return;
            }

            if (SelectedNode.Index < 3)
            {
                return;
            }

            var nodeBuilder = new NodeBuilder(SelectedNode);

            _previousTransparency    = nodeBuilder.Transparency;
            nodeBuilder.Transparency = 0.5;
            _currentHandler          = _handlers[CurrentGizmoType];
            _currentHandler.SetNode(entities[0].Node);
            _currentHandler.Document = _gizmoDocument;
            _currentHandler.DisplayHandles();

            ViewUpdate();
        }
Esempio n. 16
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);
            }
        }
        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);
            }
        }
        public static void ExecuteDirectory(string directoryName, ActionsGraph actionsGraph)
        {
            var sortedFileNames = GetBooFileList(directoryName);
            var document        =
                actionsGraph.InputContainer[InputNames.Document].GetData(NotificationNames.GetValue).Get <Document>();

            foreach (var fileName in sortedFileNames)
            {
                try
                {
                    // Set the script location/execution path
                    BooUtil.ExecuteBooScript(actionsGraph, fileName);
                }
                catch (Exception ex)
                {
                    Assert.IsTrue(false, "Error executing file: " + fileName + " Exception: " + ex.Message);
                }
                try
                {
                    document.Undo();
                }
                catch (Exception ex)
                {
                    Assert.IsTrue(false, "Error on undo file: " + fileName + " Exception: " + ex.Message);
                }
            }
        }
Esempio n. 19
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();
        }
        public void BuildForm(int width, int height)
        {
            var form = new OccVisualForm
            {
                Width  = width,
                Height = height
            };

            var multiview = form.multiviewTableLayoutPanel;

            SetupUtils = new SetupUtils {
                AttachedView = multiview
            };
            SetupUtils.InitializeModifiersSetup();
            SetupUtils.ResetSetupEnvironment();

            Viewer = SetupUtils.Viewer;
            View   = SetupUtils.View;

            Form         = form;
            Form.Paint  += FormPaint;
            Form.Resize += FormResize;

            DefaultInterpreters.Setup();
            var actionsGraph = new ActionsGraph();

            actionsGraph.Register(new FunctionFactoryInput());
            DefaultFunctions.Setup(actionsGraph);

            InitializeSetupUtils();
        }
Esempio n. 21
0
        public static void ExecuteBooProgram(ActionsGraph actionsGraph, string fileName)
        {
            var scriptLines = File.ReadAllText(fileName);
            var context     = CompileCode(scriptLines);

            ExecuteBooProgram(fileName, context, actionsGraph);
        }
        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();
        }
        public ActionsGraph AddNewChildGraph()
        {
            var childGraph = new ActionsGraph();

            childGraph.Register(new ParentActionGraphInput(ActionsGraph));
            _documents.Add(childGraph);
            return(childGraph);
        }
Esempio n. 24
0
        private static void UpdateConfig(ActionsGraph actionGraph)
        {
            var optionsSetup   = actionGraph[InputNames.OptionsSetupInput].Get <OptionsSetup>();
            var optionsSection = optionsSetup.UpdateSectionNode(OptionSectionNames.SolverPageTitle);

            SolverConstraintFactory.Instance.SolverOptions = optionsSection;
            _computeIntersections = optionsSection.GetBoolValue(7);
        }
Esempio n. 25
0
        public DimensionToolsView(InteractionContainer selectedEntity, ActionsGraph actionsGraph)
        {
            _actionsGraph = actionsGraph;
            var items = selectedEntity[TopAbsShapeEnum.TopAbs_FACE];

            _selectedEntity = items[0];
            InitializeComponent();
        }
        private void OnSetValue(DataPackage data)
        {
            _currentActionGraph = data.Get <ActionsGraph>();

            _document =
                _currentActionGraph[InputNames.Document].GetData(NotificationNames.GetValue).Get <Document>();
            AddData(_document);
        }
        private static void Setup()
        {
            DefaultInterpreters.Setup();
            var actionsGraph = new ActionsGraph();

            actionsGraph.Register(new FunctionFactoryInput());
            DefaultFunctions.Setup(actionsGraph);
        }
 private void DefaultsSetup()
 {
     DefaultInterpreters.Setup();
     _actionsGraph = new ActionsGraph();
     _actionsGraph.Register(new FunctionFactoryInput());
     _actionsGraph.Register(new OptionsSetupInput());
     DefaultFunctions.Setup(_actionsGraph);
 }
        public void Init()
        {
            DefaultsSetup();
            _actionsGraph = new ActionsGraph();
            var documentInput = new DocumentInput(new Document());

            documentInput.OnConnect();
            _actionsGraph.Register(documentInput);
        }
            public TestWrapper(ActionsGraph actionsGraph, string fileName, bool isScript, BooUnitTestRemote remote)
            {
                _actionsGraph = actionsGraph;
                _fileName     = fileName;
                _isScript     = isScript;
                _remote       = remote;

                _document =
                    _actionsGraph.InputContainer[InputNames.Document].GetData(NotificationNames.GetValue).Get <Document>();
            }