Ejemplo n.º 1
0
        private void _load_file(String file)
        {
            // Read the file.
            System.IO.StreamReader myFile;
            try
            {
                myFile = new System.IO.StreamReader(file);
            }
            catch
            {
                return;
            }

            String str;

            UInt32 i = 1;

            //-- lecture du fichier
            while ((str = myFile.ReadLine()) != null)
            {
                TextBlock printTextBlock = new TextBlock();
                printTextBlock.Text = str;
                if ((i % 2) == 0)
                {
                    printTextBlock.Background = Brushes.LightGray;
                }
                else
                {
                    printTextBlock.Background = Brushes.LightYellow;
                }
                fileText.Items.Add(printTextBlock);
                i++;
            }
            myFile.Close();

            if (file.EndsWith(".nc"))
            {
                gcodeParser = new GCODE(file);

                moves = gcodeParser.build_3D_Model(0);
            }

            foreach (LinesVisual3D m in moves)
            {
                viewport.Children.Remove(m);
                viewport.Children.Add(m);
            }

            //viewport.CameraController.AddRotateForce(0.000000000000001, 0.000000000000001); // emulate move camera
        }
Ejemplo n.º 2
0
        private void _load_file(String file)
        {
            // Read the file.
            System.IO.StreamReader myFile;
            try
            {
                myFile = new System.IO.StreamReader(file);
            }
            catch
            {
                return;
            }

            String str;

            UInt32 i = 1;
            //-- lecture du fichier
            while ((str = myFile.ReadLine()) != null)
            {
                TextBlock printTextBlock = new TextBlock();
                printTextBlock.Text = str;
                if ((i % 2) == 0)
                    printTextBlock.Background = Brushes.LightGray;
                else
                    printTextBlock.Background = Brushes.LightYellow;
                fileText.Items.Add(printTextBlock);
                i++;
            }
            myFile.Close();

            if (file.EndsWith(".nc"))
            {
                gcodeParser = new GCODE(file);

                moves = gcodeParser.build_3D_Model(0);
            }

            foreach (LinesVisual3D m in moves)
            {
                viewport.Children.Remove(m);
                viewport.Children.Add(m);
            }

            //viewport.CameraController.AddRotateForce(0.000000000000001, 0.000000000000001); // emulate move camera
        }