public TestGenerator()
 {
     InitializeComponent();
     RegMemory.RestoreWindowPos("testGeneratorWindow", this);
     comboTestCase.SelectedIndex = 0;
     gen = Main.generator;
 }
Esempio n. 2
0
        public void FromForm()
        {
            GCodeGenerator g = Main.generator;

            g.DefaultPrecision  = comboDefaultPrecision.SelectedIndex;
            g.ExtruderPrecision = comboExtruderPrecision.SelectedIndex;
            int i;

            int.TryParse(textTemperature.Text, out i);
            g.ExtruderTemperature     = i;
            g.FilamentDiameter        = ToD(textFilamentDiameter.Text);
            g.FilamentPackingDensity  = ToD(textPackingDensity.Text);
            g.FirstLayerHeight        = ToD(textFirstLayerHeight.Text);
            g.FirstLayerSpeedFactor   = ToD(textFirstLayerSpeedFactor.Text);
            g.LayerHeight             = ToD(textLayerHeight.Text);
            g.ExtruderRetractionSpeed = ToD(textRetractionSpeed.Text);
            g.RetractionRestartExtra  = ToD(textRetractionRestartExtra.Text);
            g.RetractionDistance      = ToD(textRetractionDistance.Text);
            g.MaximumFeedRate         = ToD(textMaxFeedRate.Text);
            g.TravelFeedRate          = ToD(textTravelFeedRate.Text);
            g.ZFeedRate       = ToD(textZAxisFeedRate.Text);
            g.PrintFeedRate   = ToD(textPrintFeedRate.Text);
            g.ClipFactor      = ToD(textClipFactor.Text);
            g.WidthOverHeight = ToD(textWidthOverThickness.Text);
            g.Save();
        }
Esempio n. 3
0
 public Main()
 {
     repetierKey     = Registry.CurrentUser.CreateSubKey("Software\\Repetier");
     main            = this;
     generator       = new GCodeGenerator();
     globalSettings  = new GlobalSettings();
     conn            = new PrinterConnection();
     printerSettings = new FormPrinterSettings();
     threeDSettings  = new ThreeDSettings();
     InitializeComponent();
     conn.eventConnectionChange += OnPrinterConnectionChange;
     conn.eventPrinterAction    += OnPrinterAction;
     conn.eventJobProgress      += OnJobProgress;
     printPanel      = new PrintPanel();
     printPanel.Dock = DockStyle.Fill;
     splitContainerPrinterGraphic.Panel1.Controls.Add(printPanel);
     logView      = new LogView();
     logView.Dock = DockStyle.Fill;
     splitVert.Panel2.Controls.Add(logView);
     skeinforge = new Skeinforge();
     PrinterChanged(printerSettings.currentPrinterKey, true);
     printerSettings.eventPrinterChanged += PrinterChanged;
     // GCode print preview
     printPreview      = new ThreeDControl();
     printPreview.Dock = DockStyle.Fill;
     splitContainerPrinterGraphic.Panel2.Controls.Add(printPreview);
     printPreview.SetEditor(false);
     printPreview.AutoUpdateable = true;
     printVisual = new GCodeVisual(conn.analyzer);
     printPreview.models.AddLast(printVisual);
     basicTitle = Text;
 }
Esempio n. 4
0
        //NOTE: at the moment temperature checking has only been enable for the #1 extruder, support for more extruders and heatbed(s) should be added later
        /// <summary>
        /// Initialise a Communication Controller which will handle all low level communication
        /// with the connected device
        /// </summary>
        /// <param name="_hostPage">The page that who's dispatcher will be used to display messageboxes with info regarding connection related events</param>
        /// <param name="_file_Listpicker">The listpicker tha will contain the list of GCode files that can be printed</param>
        /// <param name="_device_Listpicker">The listpicker that will contain the list of paired devices that can be connected to</param>
        /// <param name="_log_Stackpanel">The stackpanel that will be used to log communication</param>
        /// <param name="_temperature_Textblock">The textblock that will be used to display the current extruder temperature</param>
        public ComController(PhoneApplicationPage _hostPage, ListPicker _device_Listpicker, StackPanel _log_Stackpanel,
                             TextBlock _temperature_Textblock)
        {
            //Store local references of the recieved instances
            hostPage              = _hostPage;
            device_Listpicker     = _device_Listpicker;
            log_Stackpanel        = _log_Stackpanel;
            temperature_Textblock = _temperature_Textblock;

            //Initialise the needed classes
            bluetoothIO      = new BluetoothIO();
            responseReceiver = new GCodeResponseReciever(bluetoothIO);
            GCodeSender      = new GCodeSender(bluetoothIO, responseReceiver, hostPage.Dispatcher);
            GCodeGenerator   = new GCodeGenerator(GCodeSender);

            //Connect the needed events to our local handlers
            bluetoothIO.ConnectedToDevice     += bluetoothIO_ConnectedToDevice;
            bluetoothIO.ConnectionFailed      += bluetoothIO_ConnectionFailed;
            bluetoothIO.DiconnectedFromDevice += bluetoothIO_DiconnectedFromDevice;

            //Setup the GCodefilereader
            GCodeFileReader = new GCodeFileReader(GCodeSender, GCodeGenerator);
            GCodeFileReader.FileReadingStarted += GCodeFileReader_FileReadingStarted;
            GCodeFileReader.FileReadingStopped += GCodeFileReader_FileReadingStopped;

            //Fill the listpicker that contains the list of connectable bluetooth with a list of all the currently paired bluetooth devices
            Devicefinder.getListOfBluetoothDevices(device_Listpicker);

            //Link the external events to our local handlers
            GCodeSender.CommandSent              += GCodeSender_CommandSent;
            responseReceiver.MessageRecieved     += responseReceiver_MessageRecieved;
            responseReceiver.TemperatureRecieved += responseReceiver_TemperatureRecieved;

            //Start the probing thread with a function that probes the printer for the #1 extruders temperature every 5 second (5000 milliseconds)
            temperatureProbingThread = new Thread(new ThreadStart(() => GCodeTemperatureProber.probeTemperature(5000, GCodeGenerator)));

            //Initialise the logboxbox that will log all communication between the application and the connected device
            logBox = new LogBox(log_Stackpanel, hostPage, 25);
        }
Esempio n. 5
0
        public void ToForm()
        {
            GCodeGenerator g = Main.generator;

            g.Load();
            comboDefaultPrecision.SelectedIndex  = g.DefaultPrecision;
            comboExtruderPrecision.SelectedIndex = g.ExtruderPrecision;
            textTemperature.Text            = g.ExtruderTemperature.ToString();
            textFilamentDiameter.Text       = ReadD2(g.FilamentDiameter);
            textPackingDensity.Text         = ReadD(g.FilamentPackingDensity);
            textFirstLayerHeight.Text       = ReadD2(g.FirstLayerHeight);
            textFirstLayerSpeedFactor.Text  = ReadD2(g.FirstLayerSpeedFactor);
            textLayerHeight.Text            = ReadD2(g.LayerHeight);
            textRetractionSpeed.Text        = ReadD(g.ExtruderRetractionSpeed);
            textRetractionRestartExtra.Text = ReadD2(g.RetractionRestartExtra);
            textRetractionDistance.Text     = ReadD2(g.RetractionDistance);
            textMaxFeedRate.Text            = ReadD(g.MaximumFeedRate);
            textTravelFeedRate.Text         = ReadD(g.TravelFeedRate);
            textZAxisFeedRate.Text          = ReadD(g.ZFeedRate);
            textPrintFeedRate.Text          = ReadD(g.PrintFeedRate);
            textClipFactor.Text             = ReadD2(g.ClipFactor);
            textWidthOverThickness.Text     = ReadD2(g.WidthOverHeight);
        }
 public void Setup()
 {
     _generator = new GCodeGenerator();
 }
Esempio n. 7
0
        GCodeGenerator GCodeGenerator; //The generator that will home and cool

        /// <summary>
        /// Intialise a class that can read and send GCode line for line from
        /// a file.
        /// </summary>
        /// <param name="_GCodeSender">The fully intialised GCodeSender that will be used to send the GCode</param>
        public GCodeFileReader(GCodeSender _GCodeSender, GCodeGenerator _GCodeGenerator)
        {
            GCodeSender    = _GCodeSender;
            GCodeGenerator = _GCodeGenerator;
        }
Esempio n. 8
0
 public TestGenerator()
 {
     InitializeComponent();
     comboTestCase.SelectedIndex = 0;
     gen = Main.generator;
 }
Esempio n. 9
0
        public Main()
        {
            executeHostCall = new executeHostCommandDelegate(this.executeHostCommand);
            repetierKey     = Registry.CurrentUser.CreateSubKey("Software\\Repetier");
            repetierKey.SetValue("installPath", Application.StartupPath);
            if (Path.DirectorySeparatorChar != '\\' && IsRunningOnMac())
            {
                IsMac = true;
            }

            /*String[] parms = Environment.GetCommandLineArgs();
             * string lastcom = "";
             * foreach (string s in parms)
             * {
             *  if (lastcom == "-home")
             *  {
             *      repetierKey.SetValue("installPath",s);
             *      lastcom = "";
             *      continue;
             *  }
             *  if (s == "-macosx") IsMac = true;
             *  lastcom = s;
             * }*/
            main            = this;
            generator       = new GCodeGenerator();
            globalSettings  = new GlobalSettings();
            conn            = new PrinterConnection();
            printerSettings = new FormPrinterSettings();
            threeDSettings  = new ThreeDSettings();
            InitializeComponent();
            RegMemory.RestoreWindowPos("mainWindow", this);
            if (WindowState == FormWindowState.Maximized)
            {
                Application.DoEvents();
            }
            splitLog.SplitterDistance = RegMemory.GetInt("logSplitterDistance", splitLog.SplitterDistance);
            if (IsMono)
            {
                if (!IsMac)
                {
                    splitContainerPrinterGraphic.SplitterDistance += 52;
                    foreach (ToolStripItem m in menu.Items)
                    {
                        m.Text = m.Text.Replace("&", null);
                    }
                }
                if (IsMac)
                {
                    /*Application.Events.Quit += delegate (object sender, ApplicationEventArgs e) {
                     *      Application.Quit ();
                     *      e.Handled = true;
                     * };
                     *
                     * ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
                     *      WindowState = FormWindowState.Normal;
                     *      e.Handled = true;
                     * };*/

                    MinimumSize              = new Size(500, 640);
                    tab.MinimumSize          = new Size(500, 500);
                    splitLog.Panel1MinSize   = 520;
                    splitLog.Panel2MinSize   = 100;
                    splitLog.IsSplitterFixed = true;
                    splitJob.IsSplitterFixed = true;
                    //splitContainerPrinterGraphic.SplitterDistance -= 52;
                    splitLog.SplitterDistance = splitLog.Height - 100;
                }
            }
            toolShowLog.Checked         = RegMemory.GetBool("logShow", true);
            conn.eventConnectionChange += OnPrinterConnectionChange;
            conn.eventPrinterAction    += OnPrinterAction;
            conn.eventJobProgress      += OnJobProgress;
            printPanel      = new PrintPanel();
            printPanel.Dock = DockStyle.Fill;
            splitContainerPrinterGraphic.Panel1.Controls.Add(printPanel);
            printerSettings.formToCon();
            logView      = new LogView();
            logView.Dock = DockStyle.Fill;
            splitLog.Panel2.Controls.Add(logView);
            skeinforge = new Skeinforge();
            PrinterChanged(printerSettings.currentPrinterKey, true);
            printerSettings.eventPrinterChanged += PrinterChanged;
            // GCode print preview
            printPreview      = new ThreeDControl();
            printPreview.Dock = DockStyle.Fill;
            splitContainerPrinterGraphic.Panel2.Controls.Add(printPreview);
            printPreview.SetEditor(false);
            printPreview.AutoUpdateable = true;
            printVisual          = new GCodeVisual(conn.analyzer);
            printVisual.liveView = true;
            printPreview.models.AddLast(printVisual);
            basicTitle      = Text;
            jobPreview      = new ThreeDControl();
            jobPreview.Dock = DockStyle.Fill;
            splitJob.Panel2.Controls.Add(jobPreview);
            jobPreview.SetEditor(false);
            jobPreview.models.AddLast(jobVisual);
            editor.contentChangedEvent += JobPreview;
            editor.commands             = new Commands();
            editor.commands.Read("default", "en");
            UpdateHistory();
            UpdateConnections();
            Main.slic3r = new Slic3r();
            slicer      = new Slicer();
            if (IsMac)
            {
                tabGCode.Controls.Remove(splitJob);
                tabPrint.Controls.Remove(splitContainerPrinterGraphic);
            }
        }