示例#1
0
 private void DoHome()
 {
     Script.Code("M90198");
     Script.DoButton(24);
     Script.DoButton(25);
     Script.DoButton(22);
     Script.DoButton(23);
 }
示例#2
0
 public bool RunMach3Command(Mach4.IMyScriptObject script, string command)
 {
     try
     {
         Script.Code(command);
     }
     catch (Exception e) { MessageBox.Show(e.ToString()); }
     try
     {
         while (script.IsMoving() != 0)
         {
             Thread.Sleep(10);
         }
     }
     catch (Exception e) { MessageBox.Show(e.ToString()); }
     return(true);
 }
示例#3
0
 public bool RunMach3Command(Mach4.IMyScriptObject script, string command)
 {
     SetCurrentCommandText(command);
     try
     {
         script.Code(command);
     }
     catch { }
     try
     {
         while (script.IsMoving() != 0)
         {
             Thread.Sleep(10);
         }
     }
     catch { }
     return(true);
 }
示例#4
0
文件: Form1.cs 项目: DXPower/M3EX
        // When the Send Command button is pressed.
        private void SendCommandButton(object sender, EventArgs e)
        {
            if (textBox1.Text == "LOAD")               // If the command is LOAD
            //// A custom file format .m3ex is used to store extra information alongside the gcode.
            //BinaryFormatter formatter = new BinaryFormatter();
            //Hashtable data = null;

            //try {
            //	using (FileStream fs = File.OpenRead("C:\\Users\\myaka\\Documents\\Visual Studio 2015\\Projects\\Mach3Extender\\Mach3Extender\\bin\\Debug\\gcode\\final.m3ex")) {
            //		data = (Hashtable) formatter.Deserialize(fs);
            //	}

            //	using (FileStream fs = File.OpenWrite("C:\\Users\\myaka\\Documents\\Visual Studio 2015\\Projects\\Mach3Extender\\Mach3Extender\\bin\\Debug\\gcode\\final.temp.nc")) {
            //		byte[] gcode = (byte[]) data["gcode"];
            //		byte[] header = Encoding.ASCII.GetBytes("G92 X" + data["xOffset"] + " Y" + data["yOffset"] + " Z" + data["zOffset"] + "\n\rM0");

            //		fs.Write(header, 0, header.Length);
            //		fs.Write(gcode, 0, gcode.Length);
            //	}

            //	mach.LoadGCodeFile("C:\\Users\\myaka\\Documents\\Visual Studio 2015\\Projects\\Mach3Extender\\Mach3Extender\\bin\\Debug\\gcode\\final.temp.nc");
            //	//script.Code("G92 X" + data["xOffset"] + " Y" + data["yOffset"] + " Z" + data["zOffset"]);
            //	Thread.Sleep(2000);
            //	mach.CycleStart();
            //} catch (Exception ex) {

            //}

            //mach.LoadGCodeFile("C:\\Users\\myaka\\Documents\\Visual Studio 2015\\Projects\\Mach3Extender\\Mach3Extender\\bin\\Debug\\gcode\\test.m3ex");
            {
            }
            else if (textBox1.Text == "START")
            {
                mach.CycleStart();
            }
            else
            {
                script.Code(textBox1.Text);
            }
        }