internal static void Main(string[] args)
        {
#if !DEBUG
            WpfSplash.Instance.Show();
#endif
            CoreGlobalPreferencesSingleton.Instance.StartTime = Environment.TickCount;
            XmlConfigurator.Configure();
            DefaultInterpreters.Setup();

            var app = new App();
            NaroMessage.SetFactory(new MessageBoxMessage());
            NaroStartInfo.Instance.Arguments = args;
            Application.EnableVisualStyles();
            WindowsFormsHost.EnableWindowsFormsInterop();
            Log.Info("-------------------------- Started " + NaroAppConstantNames.AppName + " " +
                     NaroAppConstantNames.Version + " session ---------------------------");

            var optionsPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
                              @"\NaroCAD\options.nxml";
            if (!File.Exists(optionsPath))
            {
                File.Copy(Directory.GetCurrentDirectory() + @"\options.nxml", optionsPath);
            }

            AppDomain.CurrentDomain.UnhandledException += HandleException;
            var shellWindow = new ShellWindow();
            shellWindow.SetActionGraph();
            app.Run(shellWindow);

            File.Delete(NaroAppConstantNames.GuardFileName);
            //MemMapper.DisplayLeaks();
        }
        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();
        }
 private void DefaultsSetup()
 {
     DefaultInterpreters.Setup();
     _actionsGraph = new ActionsGraph();
     _actionsGraph.Register(new FunctionFactoryInput());
     _actionsGraph.Register(new OptionsSetupInput());
     DefaultFunctions.Setup(_actionsGraph);
 }
        private static void Setup()
        {
            DefaultInterpreters.Setup();
            var actionsGraph = new ActionsGraph();

            actionsGraph.Register(new FunctionFactoryInput());
            DefaultFunctions.Setup(actionsGraph);
        }
Exemple #5
0
        public void Setup()
        {
            DefaultInterpreters.Setup();
            _actionsGraph = new ActionsGraph();
            _actionsGraph.Register(new FunctionFactoryInput());
            _actionsGraph.Register(new OptionsSetupInput());
            _document = TestUtils.DefaultsSetup();
            DefaultFunctions.Setup(_actionsGraph);
            var documentInput = new DocumentInput(_document);

            documentInput.OnConnect();
            _actionsGraph.Register(documentInput);
            _document.Transact();
        }
        public override void OnActivate()
        {
            DefaultInterpreters.Setup();

            UpdaterSetup();


            var somethingLoaded = false;

            try
            {
                if (NaroStartInfo.Instance.Arguments.Length > 0)
                {
                    var fileName = NaroStartInfo.Instance.Arguments[0];
                    if (File.Exists(fileName))
                    {
                        Document.LoadFromXml(fileName);
                        somethingLoaded = true;
                    }
                    else
                    {
                        NaroMessage.Show(ExtensionsResources.File_not_found_on_disk);
                    }
                }
            }
            catch
            {
                NaroMessage.Show(ExtensionsResources.Invalid_file_to_load);
            }
            if (!somethingLoaded)
            {
                RestoreAutoSavedFile();
            }
            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode,
                                                           TopAbsShapeEnum.TopAbs_SOLID);

            BackToNeutralModifier();
        }
Exemple #7
0
        public static Document DefaultsSetup()
        {
            DefaultInterpreters.Setup();
            AttributeInterpreterFactory.Register <ActionGraphInterpreter>();
            var actionsGraph = new ActionsGraph();

            actionsGraph.Register(new FunctionFactoryInput());
            actionsGraph.Register(new OptionsSetupInput());
            DefaultFunctions.Setup(actionsGraph);
            var constraintsFunctionsSetup = new DefaultConstraintFunctions();

            constraintsFunctionsSetup.Setup(actionsGraph);

            QosCreate();

            var document = new Document();

            document.Transact();
            document.Root.Set <ActionGraphInterpreter>().ActionsGraph = actionsGraph;
            document.Root.Set <DocumentContextInterpreter>().Document = document;
            document.Commit("document setup");
            return(document);
        }
 public SetupUtils()
 {
     DefaultInterpreters.Setup();
     AttributeInterpreterFactory.Register <ActionGraphInterpreter>();
 }
        public void CreateXmlDocument()
        {
            DefaultInterpreters.Setup();
            var watch = new Stopwatch();

            watch.Start();

            _document.Root.Set <LayerContainerInterpreter>();
            _document.Root.Set <ReferenceListInterpreter>();

            var root = _document.Root;

            _document.Transact();
            var sketchCreator = new SketchCreator(_document, false);
            var sketchNode    = sketchCreator.BuildSketchNode();

            _document.Commit("Added sketch");
            _document.Transact();

            var lineNode = TestUtils.Line(_document, sketchNode, new Point3D(0, 0, 100), new Point3D(1000, 0, 0));

            root.AddChild(lineNode.Node.Index);

            //Sphere is created on one clild.
            var sphereNode = TestShapes.CreateSphere(_document, new Point3D(100, 100, 100), 500);

            root.AddChild(sphereNode.Index);

            var cylinderNode = TestShapes.CreateCylinder(_document,
                                                         new gpAx1(new gpPnt(0, 0, 0),
                                                                   new gpDir(100, 100, 100)),
                                                         400, 600, GeomUtils.DegreesToRadians(360));

            root.AddChild(cylinderNode.Index);

            //var extrudeNode = TestShapes.CreateExtrude(_document, new SceneSelectedEntity(rectNode), -1000);
            //root.AddChild(extrudeNode.Index);

            var ellipseNode1 = TreeUtils.AddEllipseToNode(_document,
                                                          new Point3D(36.8453973968897, -539.199867895986, 100),
                                                          new Point3D(36.8453973968897, -462.199867895986, 100),
                                                          new Point3D(59.8453973968897, -465.119998354144, 100));

            root.AddChild(ellipseNode1.Index);

            var ellipseNode2 = TreeUtils.AddEllipseToNode(_document,
                                                          new Point3D(100, -540.334763318557, 47.2315752446135),
                                                          new Point3D(100, -500.428650277867, 49.9705790751447),
                                                          new Point3D(100, -533.349512728947, 34.6804312289804));

            root.AddChild(ellipseNode2.Index);

            var ellipseNode3 = TreeUtils.AddEllipseToNode(_document, new Point3D(50, -1000, 10),
                                                          new Point3D(90, -1000, 50),
                                                          new Point3D(97.8698501204491, -1000, 31));

            root.AddChild(ellipseNode3.Index);

            var circleNode = TreeUtils.AddCircleToNode(_document,
                                                       new Point3D(45.4376831054688, -380.445983886719, 100), 40);

            root.AddChild(circleNode.Index);

            watch.Stop();
            var ticks = watch.ElapsedMilliseconds;

            watch.Reset();
            watch.Start();
            var cutNode1 = TestShapes.CreateExtrude(_document, new SceneSelectedEntity(ellipseNode1), 100);

            root.AddChild(cutNode1.Index);

            var cutNode2 = TestShapes.CreateExtrude(_document, new SceneSelectedEntity(ellipseNode2), 100);

            root.AddChild(cutNode2.Index);

            var cutNode3 = TestShapes.CreateCut(_document, ellipseNode3, 100, CutTypes.ThroughAll);

            root.AddChild(cutNode3.Index);

            watch.Stop();
            var cutSeconds = watch.ElapsedMilliseconds;

            _document.Root.Set <StringInterpreter>().Value = "New Part";

            _document.Commit("testmethod");
            _document.SaveToXml("test.naroxml");
            _document = new Document();
            _document.LoadFromXml("test.naroxml");
            Console.WriteLine(@"elapsed ticks:{0}", (ticks + cutSeconds));
            Console.WriteLine(@"elapsed cut ticks:{0}", cutSeconds);
        }
 public void Setup()
 {
     DefaultInterpreters.Setup();
     _document = new Document();
     _document.Transact();
 }
 public void Setup()
 {
     DefaultInterpreters.Setup();
 }