Ejemplo n.º 1
0
 public void UnloadNozzle(Nozzle nozzle)
 {
     UnloadNozzle_(nozzle);
 }
Ejemplo n.º 2
0
        private void UnloadNozzle_(Nozzle nozzle)
        {
            if (!nozzle.IsLoaded) return;

            Cnc.Zup();
            Cnc.ZGuardOff();
            //Cnc.RawWrite("{\"gc\":\"G1 F " + speed + "\"}");
            string strSpeed = "G1 F" + speed;
            string strSend;
            bool first = true;
            foreach (nozzleLocations NozzleLocation in nozzle.loadSequence.Reverse())
            {
                strSend = "{\"gc\":\"";
                if (first) { strSend = strSend + " G0 "; first = false; } else { strSend = strSend + strSpeed; }
                strSend = strSend + " X" + ((double)NozzleLocation.X).ToString(CultureInfo.InvariantCulture) +
                    " Y" + ((double)NozzleLocation.Y).ToString(CultureInfo.InvariantCulture) +
                    " Z" + ((double)NozzleLocation.Z).ToString(CultureInfo.InvariantCulture) +
                    "\"}";
                Cnc.RawWrite(strSend);
                //    Cnc.CNC_XYZA(NozzleLocation.X, NozzleLocation.Y, 0, NozzleLocation.Z);
            }
            Cnc.ZGuardOn();
            Cnc.Zup();

            nozzle.IsLoaded = false;
        }
Ejemplo n.º 3
0
        public void LoadNozzle(Nozzle nozzle)
        {
            if (nozzle.IsLoaded) return;

            Nozzle loadedNozzle = GetLoadedNozzle();
            if (loadedNozzle != null)
            {
                UnloadNozzle(loadedNozzle);
                MainForm.DisplayText("Unloaded nozzle " + nozzle.Id, Color.Green);
            }

            Cnc.Zup();
            Cnc.ZGuardOff();//("{\"gc\":\""
            string strSpeed = "G1 F" + speed;
            string strSend;
            //Cnc.RawWrite("{\"gc\":\"G1 F " + speed + " X"  ((double)X).ToString(CultureInfo.InvariantCulture);"\"}");
            bool first = true;
            foreach (nozzleLocations NozzleLocation in nozzle.loadSequence)
            {
                strSend = "{\"gc\":\"";
                if (first) { strSend = strSend + " G0 "; first = false; } else { strSend = strSend + strSpeed; }
                strSend = strSend +" X" + ((double)NozzleLocation.X).ToString(CultureInfo.InvariantCulture) +
                    " Y" + ((double)NozzleLocation.Y).ToString(CultureInfo.InvariantCulture) +
                    " Z" + ((double)NozzleLocation.Z).ToString(CultureInfo.InvariantCulture) +
                    "\"}";
                Cnc.RawWrite(strSend);
                //Cnc.CNC_XYZA(NozzleLocation.X, NozzleLocation.Y,0,NozzleLocation.Z);
            }
            Cnc.ZGuardOn();
            Cnc.Zup();

            nozzle.IsLoaded = true;

            MainForm.DisplayText("Loaded nozzle " + nozzle.Id, Color.Green);
        }