From a43ebd53fe68abc35bb78ba6e5e5acfc7d6dfbb3 Mon Sep 17 00:00:00 2001 From: "zhengxuan.zhang" Date: Wed, 13 Mar 2024 10:47:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=BB=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=BF=AB=E9=80=9F=E5=AE=9A=E4=BD=8D=EF=BC=8C=E8=BF=90=E5=8A=A8?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=8D=95=E8=BD=B4?= =?UTF-8?q?JOG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HexcalMC/Hexcal/TcpIpServer.cs | 1 + HexcalMC/HexcalMC.csproj | 2 + HexcalMC/MainFrom.Designer.cs | 385 +++++++++------ HexcalMC/MainFrom.cs | 558 ++++++++++------------ HexcalMC/MainFrom.resx | 226 ++++++++- HexcalMC/Motion/Motion.Designer.cs | 193 ++++---- HexcalMC/Motion/Motion.cs | 537 +++++++++++++++------ HexcalMC/Motion/Motion.resx | 2 +- HexcalMC/Program.cs | 22 +- HexcalMC/Properties/Resources.Designer.cs | 20 + HexcalMC/Properties/Resources.resx | 32 +- Motion/ACS Motion/MainForm.Designer.cs | 2 + Motion/ACS Motion/MainForm.cs | 10 + 13 files changed, 1273 insertions(+), 717 deletions(-) diff --git a/HexcalMC/Hexcal/TcpIpServer.cs b/HexcalMC/Hexcal/TcpIpServer.cs index 9c42ebb..7cd9790 100644 --- a/HexcalMC/Hexcal/TcpIpServer.cs +++ b/HexcalMC/Hexcal/TcpIpServer.cs @@ -290,6 +290,7 @@ namespace HexcalMC.Hexcal int sentBytes = socket.Send(data); return sentBytes == data.Length; // 检查是否完全发送成功 } + public void SendMessageToAllClients(string strMsg) { byte[] arrMsg = Encoding.Default.GetBytes(strMsg); diff --git a/HexcalMC/HexcalMC.csproj b/HexcalMC/HexcalMC.csproj index 739563f..082c6f8 100644 --- a/HexcalMC/HexcalMC.csproj +++ b/HexcalMC/HexcalMC.csproj @@ -280,6 +280,8 @@ + + diff --git a/HexcalMC/MainFrom.Designer.cs b/HexcalMC/MainFrom.Designer.cs index fc8d428..2c1746c 100644 --- a/HexcalMC/MainFrom.Designer.cs +++ b/HexcalMC/MainFrom.Designer.cs @@ -51,6 +51,7 @@ this.radRibbonBarButtonGroup7 = new Telerik.WinControls.UI.RadRibbonBarButtonGroup(); this.rtb_demo = new Telerik.WinControls.UI.RadButtonElement(); this.radRibbonBarGroup6 = new Telerik.WinControls.UI.RadRibbonBarGroup(); + this.rtb_quick_loc = new Telerik.WinControls.UI.RadButtonElement(); this.ribbonTab2 = new Telerik.WinControls.UI.RibbonTab(); this.radRibbonBarGroup2 = new Telerik.WinControls.UI.RadRibbonBarGroup(); this.rtb_about = new Telerik.WinControls.UI.RadButtonElement(); @@ -83,11 +84,9 @@ this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.formsPlot1 = new ScottPlot.FormsPlot(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.openGLControl1 = new SharpGL.OpenGLControl(); - this.elementHost1 = new System.Windows.Forms.Integration.ElementHost(); this.groupBox7 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lamp_hexcal = new HexcalMC.Lamp(); this.Btn_StopServer = new System.Windows.Forms.Button(); this.Btn_StartServer = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); @@ -108,20 +107,31 @@ this.label19 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.grpMst = new System.Windows.Forms.GroupBox(); - this.cboAxisNo = new System.Windows.Forms.ComboBox(); + this.label21 = new System.Windows.Forms.Label(); + this.lblEnable2 = new System.Windows.Forms.Label(); + this.label22 = new System.Windows.Forms.Label(); + this.lblInPos2 = new System.Windows.Forms.Label(); + this.label23 = new System.Windows.Forms.Label(); + this.lblAcc2 = new System.Windows.Forms.Label(); + this.lblMoving2 = new System.Windows.Forms.Label(); + this.lblEnable1 = new System.Windows.Forms.Label(); + this.lblInPos1 = new System.Windows.Forms.Label(); + this.lblAcc1 = new System.Windows.Forms.Label(); + this.lblMoving1 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); - this.lblEnable = new System.Windows.Forms.Label(); - this.lblInPos = new System.Windows.Forms.Label(); - this.lblAcc = new System.Windows.Forms.Label(); - this.lblMoving = new System.Windows.Forms.Label(); + this.lblEnable0 = new System.Windows.Forms.Label(); + this.lblInPos0 = new System.Windows.Forms.Label(); + this.lblAcc0 = new System.Windows.Forms.Label(); + this.lblMoving0 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox6 = new System.Windows.Forms.GroupBox(); this.btnEnable = new System.Windows.Forms.Button(); this.btnDisable = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.lamp_acs = new HexcalMC.Lamp(); this.txtPort = new System.Windows.Forms.TextBox(); this.txtIP = new System.Windows.Forms.TextBox(); this.btn_ACSStop = new System.Windows.Forms.Button(); @@ -132,8 +142,10 @@ this.TextBoxMsg = new System.Windows.Forms.RichTextBox(); this.tmrMonitor = new System.Windows.Forms.Timer(this.components); this.timer_RefreshUI = new System.Windows.Forms.Timer(this.components); - this.lamp_hexcal = new HexcalMC.Lamp(); - this.lamp_acs = new HexcalMC.Lamp(); + this.radRibbonBarButtonGroup8 = new Telerik.WinControls.UI.RadRibbonBarButtonGroup(); + this.rtb_SetX = new Telerik.WinControls.UI.RadTextBoxElement(); + this.rtb_Sety = new Telerik.WinControls.UI.RadTextBoxElement(); + this.rtb_SetZ = new Telerik.WinControls.UI.RadTextBoxElement(); ((System.ComponentModel.ISupportInitialize)(this.radRibbonBar1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radRibbonBarBackstageView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).BeginInit(); @@ -143,8 +155,6 @@ this.splitContainer1.SuspendLayout(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.openGLControl1)).BeginInit(); this.groupBox7.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox5.SuspendLayout(); @@ -325,15 +335,26 @@ // this.rtb_demo.Image = global::HexcalMC.Properties.Resources.demo_show; this.rtb_demo.Name = "rtb_demo"; + this.rtb_demo.ShowBorder = false; this.rtb_demo.Text = ""; this.rtb_demo.TextAlignment = System.Drawing.ContentAlignment.BottomLeft; this.rtb_demo.Click += new System.EventHandler(this.rtb_demo_Click); // // radRibbonBarGroup6 // + this.radRibbonBarGroup6.Items.AddRange(new Telerik.WinControls.RadItem[] { + this.rtb_quick_loc, + this.radRibbonBarButtonGroup8}); this.radRibbonBarGroup6.Name = "radRibbonBarGroup6"; this.radRibbonBarGroup6.Text = "快速定位"; // + // rtb_quick_loc + // + this.rtb_quick_loc.Image = global::HexcalMC.Properties.Resources.quick_location_64; + this.rtb_quick_loc.Name = "rtb_quick_loc"; + this.rtb_quick_loc.Text = ""; + this.rtb_quick_loc.Click += new System.EventHandler(this.rtb_quick_loc_Click); + // // ribbonTab2 // this.ribbonTab2.AutoEllipsis = false; @@ -403,7 +424,7 @@ // this.radRibbonBar1.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren; this.radRibbonBar1.ShowExpandButton = false; - this.radRibbonBar1.Size = new System.Drawing.Size(1192, 173); + this.radRibbonBar1.Size = new System.Drawing.Size(1192, 176); this.radRibbonBar1.StartButtonImage = global::HexcalMC.Properties.Resources.Hexagon; this.radRibbonBar1.StartMenuItems.AddRange(new Telerik.WinControls.RadItem[] { this.radMenuItem2}); @@ -609,7 +630,7 @@ // splitContainer1 // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.Location = new System.Drawing.Point(0, 173); + this.splitContainer1.Location = new System.Drawing.Point(0, 176); this.splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 @@ -623,14 +644,13 @@ // this.splitContainer1.Panel2.BackColor = System.Drawing.SystemColors.Control; this.splitContainer1.Panel2.Controls.Add(this.groupBox3); - this.splitContainer1.Size = new System.Drawing.Size(1192, 696); + this.splitContainer1.Size = new System.Drawing.Size(1192, 693); this.splitContainer1.SplitterDistance = 760; this.splitContainer1.TabIndex = 2; // // tabControl1 // this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Location = new System.Drawing.Point(9, 330); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; @@ -656,44 +676,6 @@ this.formsPlot1.Size = new System.Drawing.Size(728, 336); this.formsPlot1.TabIndex = 0; // - // tabPage2 - // - this.tabPage2.Controls.Add(this.openGLControl1); - this.tabPage2.Controls.Add(this.elementHost1); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(740, 337); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "3D绘图"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // openGLControl1 - // - this.openGLControl1.DrawFPS = false; - this.openGLControl1.Location = new System.Drawing.Point(10, 16); - this.openGLControl1.Name = "openGLControl1"; - this.openGLControl1.OpenGLVersion = SharpGL.Version.OpenGLVersion.OpenGL2_1; - this.openGLControl1.RenderContextType = SharpGL.RenderContextType.DIBSection; - this.openGLControl1.RenderTrigger = SharpGL.RenderTrigger.TimerBased; - this.openGLControl1.Size = new System.Drawing.Size(724, 314); - this.openGLControl1.TabIndex = 1; - this.openGLControl1.Visible = false; - this.openGLControl1.OpenGLInitialized += new System.EventHandler(this.openGLControl1_OpenGLInitialized); - this.openGLControl1.OpenGLDraw += new SharpGL.RenderEventHandler(this.openGLControl1_OpenGLDraw); - this.openGLControl1.GDIDraw += new SharpGL.RenderEventHandler(this.openGLControl1_GDIDraw); - this.openGLControl1.Resized += new System.EventHandler(this.openGLControl1_Resized); - // - // elementHost1 - // - this.elementHost1.Dock = System.Windows.Forms.DockStyle.Fill; - this.elementHost1.Location = new System.Drawing.Point(3, 3); - this.elementHost1.Name = "elementHost1"; - this.elementHost1.Size = new System.Drawing.Size(734, 331); - this.elementHost1.TabIndex = 0; - this.elementHost1.Text = "elementHost1"; - this.elementHost1.Child = null; - // // groupBox7 // this.groupBox7.Controls.Add(this.groupBox1); @@ -717,6 +699,18 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "通讯状态"; // + // lamp_hexcal + // + this.lamp_hexcal.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.lamp_hexcal.Location = new System.Drawing.Point(57, 23); + this.lamp_hexcal.LText = ""; + this.lamp_hexcal.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.lamp_hexcal.Name = "lamp_hexcal"; + this.lamp_hexcal.Shadow = false; + this.lamp_hexcal.Size = new System.Drawing.Size(24, 24); + this.lamp_hexcal.State = -1; + this.lamp_hexcal.TabIndex = 29; + // // Btn_StopServer // this.Btn_StopServer.Location = new System.Drawing.Point(113, 79); @@ -775,9 +769,9 @@ this.grpSafety.Controls.Add(this.label20); this.grpSafety.Controls.Add(this.label19); this.grpSafety.Controls.Add(this.label17); - this.grpSafety.Location = new System.Drawing.Point(492, 15); + this.grpSafety.Location = new System.Drawing.Point(516, 15); this.grpSafety.Name = "grpSafety"; - this.grpSafety.Size = new System.Drawing.Size(223, 133); + this.grpSafety.Size = new System.Drawing.Size(199, 133); this.grpSafety.TabIndex = 12; this.grpSafety.TabStop = false; this.grpSafety.Text = "安全限位"; @@ -869,16 +863,16 @@ this.label25.Name = "label25"; this.label25.Size = new System.Drawing.Size(13, 13); this.label25.TabIndex = 5; - this.label25.Text = "8"; + this.label25.Text = "Z"; // // label24 // this.label24.AutoSize = true; this.label24.Location = new System.Drawing.Point(102, 21); this.label24.Name = "label24"; - this.label24.Size = new System.Drawing.Size(13, 13); + this.label24.Size = new System.Drawing.Size(12, 13); this.label24.TabIndex = 5; - this.label24.Text = "1"; + this.label24.Text = "Y"; // // label20 // @@ -887,7 +881,7 @@ this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(13, 13); this.label20.TabIndex = 5; - this.label20.Text = "0"; + this.label20.Text = "X"; // // label19 // @@ -909,35 +903,123 @@ // // grpMst // - this.grpMst.Controls.Add(this.cboAxisNo); + this.grpMst.Controls.Add(this.label21); + this.grpMst.Controls.Add(this.lblEnable2); + this.grpMst.Controls.Add(this.label22); + this.grpMst.Controls.Add(this.lblInPos2); + this.grpMst.Controls.Add(this.label23); + this.grpMst.Controls.Add(this.lblAcc2); + this.grpMst.Controls.Add(this.lblMoving2); + this.grpMst.Controls.Add(this.lblEnable1); + this.grpMst.Controls.Add(this.lblInPos1); + this.grpMst.Controls.Add(this.lblAcc1); + this.grpMst.Controls.Add(this.lblMoving1); this.grpMst.Controls.Add(this.label16); this.grpMst.Controls.Add(this.label9); this.grpMst.Controls.Add(this.label15); this.grpMst.Controls.Add(this.label14); - this.grpMst.Controls.Add(this.lblEnable); - this.grpMst.Controls.Add(this.lblInPos); - this.grpMst.Controls.Add(this.lblAcc); - this.grpMst.Controls.Add(this.lblMoving); + this.grpMst.Controls.Add(this.lblEnable0); + this.grpMst.Controls.Add(this.lblInPos0); + this.grpMst.Controls.Add(this.lblAcc0); + this.grpMst.Controls.Add(this.lblMoving0); this.grpMst.Controls.Add(this.label13); this.grpMst.Location = new System.Drawing.Point(332, 15); this.grpMst.Name = "grpMst"; - this.grpMst.Size = new System.Drawing.Size(154, 133); + this.grpMst.Size = new System.Drawing.Size(178, 133); this.grpMst.TabIndex = 11; this.grpMst.TabStop = false; this.grpMst.Text = "电机状态 (MST)"; // - // cboAxisNo + // label21 // - this.cboAxisNo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cboAxisNo.FormattingEnabled = true; - this.cboAxisNo.Items.AddRange(new object[] { - "1", - "0", - "8"}); - this.cboAxisNo.Location = new System.Drawing.Point(88, 17); - this.cboAxisNo.Name = "cboAxisNo"; - this.cboAxisNo.Size = new System.Drawing.Size(60, 20); - this.cboAxisNo.TabIndex = 6; + this.label21.AutoSize = true; + this.label21.Location = new System.Drawing.Point(139, 21); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(13, 13); + this.label21.TabIndex = 6; + this.label21.Text = "Z"; + // + // lblEnable2 + // + this.lblEnable2.Image = ((System.Drawing.Image)(resources.GetObject("lblEnable2.Image"))); + this.lblEnable2.Location = new System.Drawing.Point(139, 106); + this.lblEnable2.Name = "lblEnable2"; + this.lblEnable2.Size = new System.Drawing.Size(19, 17); + this.lblEnable2.TabIndex = 12; + // + // label22 + // + this.label22.AutoSize = true; + this.label22.Location = new System.Drawing.Point(117, 21); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(12, 13); + this.label22.TabIndex = 7; + this.label22.Text = "Y"; + // + // lblInPos2 + // + this.lblInPos2.Image = ((System.Drawing.Image)(resources.GetObject("lblInPos2.Image"))); + this.lblInPos2.Location = new System.Drawing.Point(139, 85); + this.lblInPos2.Name = "lblInPos2"; + this.lblInPos2.Size = new System.Drawing.Size(19, 17); + this.lblInPos2.TabIndex = 13; + // + // label23 + // + this.label23.AutoSize = true; + this.label23.Location = new System.Drawing.Point(95, 21); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(13, 13); + this.label23.TabIndex = 8; + this.label23.Text = "X"; + // + // lblAcc2 + // + this.lblAcc2.Image = ((System.Drawing.Image)(resources.GetObject("lblAcc2.Image"))); + this.lblAcc2.Location = new System.Drawing.Point(139, 64); + this.lblAcc2.Name = "lblAcc2"; + this.lblAcc2.Size = new System.Drawing.Size(19, 17); + this.lblAcc2.TabIndex = 14; + // + // lblMoving2 + // + this.lblMoving2.Image = ((System.Drawing.Image)(resources.GetObject("lblMoving2.Image"))); + this.lblMoving2.Location = new System.Drawing.Point(139, 43); + this.lblMoving2.Name = "lblMoving2"; + this.lblMoving2.Size = new System.Drawing.Size(19, 17); + this.lblMoving2.TabIndex = 15; + // + // lblEnable1 + // + this.lblEnable1.Image = ((System.Drawing.Image)(resources.GetObject("lblEnable1.Image"))); + this.lblEnable1.Location = new System.Drawing.Point(114, 106); + this.lblEnable1.Name = "lblEnable1"; + this.lblEnable1.Size = new System.Drawing.Size(19, 17); + this.lblEnable1.TabIndex = 8; + // + // lblInPos1 + // + this.lblInPos1.Image = ((System.Drawing.Image)(resources.GetObject("lblInPos1.Image"))); + this.lblInPos1.Location = new System.Drawing.Point(114, 85); + this.lblInPos1.Name = "lblInPos1"; + this.lblInPos1.Size = new System.Drawing.Size(19, 17); + this.lblInPos1.TabIndex = 9; + // + // lblAcc1 + // + this.lblAcc1.Image = ((System.Drawing.Image)(resources.GetObject("lblAcc1.Image"))); + this.lblAcc1.Location = new System.Drawing.Point(114, 64); + this.lblAcc1.Name = "lblAcc1"; + this.lblAcc1.Size = new System.Drawing.Size(19, 17); + this.lblAcc1.TabIndex = 10; + // + // lblMoving1 + // + this.lblMoving1.Image = ((System.Drawing.Image)(resources.GetObject("lblMoving1.Image"))); + this.lblMoving1.Location = new System.Drawing.Point(114, 43); + this.lblMoving1.Name = "lblMoving1"; + this.lblMoving1.Size = new System.Drawing.Size(19, 17); + this.lblMoving1.TabIndex = 11; // // label16 // @@ -975,37 +1057,37 @@ this.label14.TabIndex = 5; this.label14.Text = "加速中"; // - // lblEnable + // lblEnable0 // - this.lblEnable.Image = ((System.Drawing.Image)(resources.GetObject("lblEnable.Image"))); - this.lblEnable.Location = new System.Drawing.Point(120, 107); - this.lblEnable.Name = "lblEnable"; - this.lblEnable.Size = new System.Drawing.Size(19, 17); - this.lblEnable.TabIndex = 5; + this.lblEnable0.Image = ((System.Drawing.Image)(resources.GetObject("lblEnable0.Image"))); + this.lblEnable0.Location = new System.Drawing.Point(89, 107); + this.lblEnable0.Name = "lblEnable0"; + this.lblEnable0.Size = new System.Drawing.Size(19, 17); + this.lblEnable0.TabIndex = 5; // - // lblInPos + // lblInPos0 // - this.lblInPos.Image = ((System.Drawing.Image)(resources.GetObject("lblInPos.Image"))); - this.lblInPos.Location = new System.Drawing.Point(120, 86); - this.lblInPos.Name = "lblInPos"; - this.lblInPos.Size = new System.Drawing.Size(19, 17); - this.lblInPos.TabIndex = 5; + this.lblInPos0.Image = ((System.Drawing.Image)(resources.GetObject("lblInPos0.Image"))); + this.lblInPos0.Location = new System.Drawing.Point(89, 86); + this.lblInPos0.Name = "lblInPos0"; + this.lblInPos0.Size = new System.Drawing.Size(19, 17); + this.lblInPos0.TabIndex = 5; // - // lblAcc + // lblAcc0 // - this.lblAcc.Image = ((System.Drawing.Image)(resources.GetObject("lblAcc.Image"))); - this.lblAcc.Location = new System.Drawing.Point(120, 65); - this.lblAcc.Name = "lblAcc"; - this.lblAcc.Size = new System.Drawing.Size(19, 17); - this.lblAcc.TabIndex = 5; + this.lblAcc0.Image = ((System.Drawing.Image)(resources.GetObject("lblAcc0.Image"))); + this.lblAcc0.Location = new System.Drawing.Point(89, 65); + this.lblAcc0.Name = "lblAcc0"; + this.lblAcc0.Size = new System.Drawing.Size(19, 17); + this.lblAcc0.TabIndex = 5; // - // lblMoving + // lblMoving0 // - this.lblMoving.Image = ((System.Drawing.Image)(resources.GetObject("lblMoving.Image"))); - this.lblMoving.Location = new System.Drawing.Point(120, 44); - this.lblMoving.Name = "lblMoving"; - this.lblMoving.Size = new System.Drawing.Size(19, 17); - this.lblMoving.TabIndex = 5; + this.lblMoving0.Image = ((System.Drawing.Image)(resources.GetObject("lblMoving0.Image"))); + this.lblMoving0.Location = new System.Drawing.Point(89, 44); + this.lblMoving0.Name = "lblMoving0"; + this.lblMoving0.Size = new System.Drawing.Size(19, 17); + this.lblMoving0.TabIndex = 5; // // label13 // @@ -1063,6 +1145,18 @@ this.groupBox2.TabStop = false; this.groupBox2.Text = "通讯状态"; // + // lamp_acs + // + this.lamp_acs.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.lamp_acs.Location = new System.Drawing.Point(57, 50); + this.lamp_acs.LText = ""; + this.lamp_acs.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.lamp_acs.Name = "lamp_acs"; + this.lamp_acs.Shadow = false; + this.lamp_acs.Size = new System.Drawing.Size(24, 24); + this.lamp_acs.State = -1; + this.lamp_acs.TabIndex = 30; + // // txtPort // this.txtPort.Location = new System.Drawing.Point(103, 52); @@ -1147,29 +1241,42 @@ this.timer_RefreshUI.Interval = 1000; this.timer_RefreshUI.Tick += new System.EventHandler(this.Timer_RefreshUI_Tick); // - // lamp_hexcal + // radRibbonBarButtonGroup8 // - this.lamp_hexcal.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.lamp_hexcal.Location = new System.Drawing.Point(57, 23); - this.lamp_hexcal.LText = ""; - this.lamp_hexcal.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.lamp_hexcal.Name = "lamp_hexcal"; - this.lamp_hexcal.Shadow = false; - this.lamp_hexcal.Size = new System.Drawing.Size(24, 24); - this.lamp_hexcal.State = -1; - this.lamp_hexcal.TabIndex = 29; + this.radRibbonBarButtonGroup8.Items.AddRange(new Telerik.WinControls.RadItem[] { + this.rtb_SetX, + this.rtb_Sety, + this.rtb_SetZ}); + this.radRibbonBarButtonGroup8.Name = "radRibbonBarButtonGroup8"; + this.radRibbonBarButtonGroup8.Orientation = System.Windows.Forms.Orientation.Vertical; + this.radRibbonBarButtonGroup8.Text = "radRibbonBarButtonGroup8"; + this.radRibbonBarButtonGroup8.TextOrientation = System.Windows.Forms.Orientation.Horizontal; // - // lamp_acs + // rtb_SetX // - this.lamp_acs.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.lamp_acs.Location = new System.Drawing.Point(57, 50); - this.lamp_acs.LText = ""; - this.lamp_acs.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.lamp_acs.Name = "lamp_acs"; - this.lamp_acs.Shadow = false; - this.lamp_acs.Size = new System.Drawing.Size(24, 24); - this.lamp_acs.State = -1; - this.lamp_acs.TabIndex = 30; + this.rtb_SetX.Name = "rtb_SetX"; + this.rtb_SetX.Padding = new System.Windows.Forms.Padding(0, 2, 0, 1); + this.rtb_SetX.Text = "100.0"; + this.rtb_SetX.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; + this.rtb_SetX.UseCompatibleTextRendering = false; + // + // rtb_Sety + // + this.rtb_Sety.Name = "rtb_Sety"; + this.rtb_Sety.Padding = new System.Windows.Forms.Padding(0, 2, 0, 1); + this.rtb_Sety.Text = "150.0"; + this.rtb_Sety.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; + this.rtb_Sety.UseCompatibleTextRendering = false; + // + // rtb_SetZ + // + this.rtb_SetZ.AutoSize = false; + this.rtb_SetZ.Bounds = new System.Drawing.Rectangle(0, 0, 80, 20); + this.rtb_SetZ.Name = "rtb_SetZ"; + this.rtb_SetZ.Padding = new System.Windows.Forms.Padding(0, 2, 0, 1); + this.rtb_SetZ.Text = "-100"; + this.rtb_SetZ.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; + this.rtb_SetZ.UseCompatibleTextRendering = false; // // MainFrom // @@ -1201,8 +1308,6 @@ this.splitContainer1.ResumeLayout(false); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.openGLControl1)).EndInit(); this.groupBox7.ResumeLayout(false); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); @@ -1286,10 +1391,10 @@ private System.Windows.Forms.Label label16; private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label14; - private System.Windows.Forms.Label lblEnable; - private System.Windows.Forms.Label lblInPos; - private System.Windows.Forms.Label lblAcc; - private System.Windows.Forms.Label lblMoving; + private System.Windows.Forms.Label lblEnable0; + private System.Windows.Forms.Label lblInPos0; + private System.Windows.Forms.Label lblAcc0; + private System.Windows.Forms.Label lblMoving0; private System.Windows.Forms.Label label13; private System.Windows.Forms.GroupBox grpSafety; private System.Windows.Forms.Label lblEMG; @@ -1307,7 +1412,6 @@ private System.Windows.Forms.Label label19; private System.Windows.Forms.Label label17; private System.Windows.Forms.Timer tmrMonitor; - private System.Windows.Forms.ComboBox cboAxisNo; private System.Windows.Forms.Label label9; private Telerik.WinControls.UI.RadRibbonBarBackstageView radRibbonBarBackstageView1; private Lamp lamp_hexcal; @@ -1315,16 +1419,29 @@ private System.Windows.Forms.Timer timer_RefreshUI; private Telerik.WinControls.UI.RadLabelElement rle_timer; private System.Windows.Forms.RichTextBox TextBoxMsg; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private ScottPlot.FormsPlot formsPlot1; - private System.Windows.Forms.Integration.ElementHost elementHost1; - private SharpGL.OpenGLControl openGLControl1; private Telerik.WinControls.UI.RadRibbonBarGroup radRibbonBarGroup5; private Telerik.WinControls.UI.RadRibbonBarButtonGroup radRibbonBarButtonGroup7; private Telerik.WinControls.UI.RadButtonElement rtb_demo; private Telerik.WinControls.UI.RadButtonElement btn_motion; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private ScottPlot.FormsPlot formsPlot1; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.Label lblEnable2; + private System.Windows.Forms.Label label22; + private System.Windows.Forms.Label lblInPos2; + private System.Windows.Forms.Label label23; + private System.Windows.Forms.Label lblAcc2; + private System.Windows.Forms.Label lblMoving2; + private System.Windows.Forms.Label lblEnable1; + private System.Windows.Forms.Label lblInPos1; + private System.Windows.Forms.Label lblAcc1; + private System.Windows.Forms.Label lblMoving1; private Telerik.WinControls.UI.RadRibbonBarGroup radRibbonBarGroup6; + private Telerik.WinControls.UI.RadButtonElement rtb_quick_loc; + private Telerik.WinControls.UI.RadRibbonBarButtonGroup radRibbonBarButtonGroup8; + private Telerik.WinControls.UI.RadTextBoxElement rtb_SetX; + private Telerik.WinControls.UI.RadTextBoxElement rtb_Sety; + private Telerik.WinControls.UI.RadTextBoxElement rtb_SetZ; } } diff --git a/HexcalMC/MainFrom.cs b/HexcalMC/MainFrom.cs index 40ba803..e9b4bc2 100644 --- a/HexcalMC/MainFrom.cs +++ b/HexcalMC/MainFrom.cs @@ -1,14 +1,15 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Net; +using System.Runtime.InteropServices; using System.Windows.Forms; using ACS.SPiiPlusNET; using HexcalMC.Base; using HexcalMC.Form; using HexcalMC.Hexcal; using HexcalMC.Properties; -using SharpGL; using Telerik.WinControls.UI; namespace HexcalMC @@ -17,58 +18,32 @@ namespace HexcalMC public enum HomeStates { None, //默认状态 - NotHome, - Homing, - Homed + NotHome, //未回家 + Homing, //回家中 + Homed //回家完成 } //定义 运动状态枚举,包括 正在运动,运动到位,Jog运动 public enum MotionStates { None, //默认状态 - Moving, - InPos, - Jogging + Moving, //运动中 + InPos, //运动到位 + Jogging //jog中 } public partial class MainFrom : RadRibbonForm { private readonly List _pointCloud = new List(); //运动中点集合 + private bool _mBHexcalConnected; + + private TcpIpServer _mTcpIpServer; //创建tcpserver,用于接收hexcal传来的指令,并解析传递平台 + public MainFrom() { InitializeComponent(); - - - #region 3D相关绘制,暂时取消 - - //var sharpGlViewportControl = new SharpGLViewportControl - //{ - // Dock = DockStyle.Fill - //}; - - //var tabPage = new TabPage("3D 窗口"); - //tabPage.Controls.Add(sharpGlViewportControl); - //tabControl1.TabPages.Add(tabPage); - - //// 设置容器控件的 DoubleBuffered 属性为 true - //DoubleBuffered = true; - //// 创建一个包含点云数据的列表 - //var points = new List - //{ - // new Point3D(0, 0, 0), - // new Point3D(1, 1, 1), - // new Point3D(-1, -1, -1) - // // 可以添加更多的点云数据 - //}; - - //// 将点云数据传递给 SharpGLViewportControl - //sharpGlViewportControl.SetPointCloud(points); - - tabControl1.TabPages.RemoveAt(1); - - #endregion } private void MainFrom_Load(object sender, EventArgs e) @@ -80,13 +55,11 @@ namespace HexcalMC //加载配置文件 LoadConfig(); - _acs = new Api(); //初始化 ACS运动控制类 //启动界面刷新 timer_RefreshUI.Start(); - //TopMost = true; } private void MainFrom_Shown(object sender, EventArgs e) //窗体显示准备好接受用户输入时发生 @@ -134,8 +107,6 @@ namespace HexcalMC return; } - //上电使能ACS - _enableAcs = FileIni.ReadBool(StrConfigFile, "MOTOR", "ENABLE_ACS"); MotionSpeed = FileIni.ReadDouble(StrConfigFile, "MOTOR", "MOTION_SPEED"); //运动定位速度 //正限位 @@ -173,25 +144,60 @@ namespace HexcalMC formsPlot1.Refresh(); } - private void Plot3D() //绘制3D图 - { - List points = new List(); - // 假设已经有了一些点的数据,将其添加到 List 对象中 - points.Add(new Point3D(1, 2, 3)); - points.Add(new Point3D(4, 5, 6)); + #region 运动平台变量区 - LoadPoints(points); - } + public Api _acs; + + private const int MaxUiLimitCnt = 24; + private int _mNTotalAxis; + private int _mNTotalBuffer = 0; + private Axis[] _mArrAxisList = null; + public bool _mAcsConnected; //ACS通讯状态 + + // For update values + private MotorStates _mNMotorState; //运动状态 + private ProgramStates _mNProgramState; //程序状态 + private object _mObjReadVar; + private Array _mArrReadVector; + private double _mLfRPos, _mLfFPos, _mLfPe, _mLfFvel; //参考位置,反馈位置 位置误差 反馈速度 double类型 + private int _mNValues, _mNOutputState; + + private Label[] _mLblLeftLimit; //左限位 + private Label[] _mLblRightLimit; //右限位 + private Label[] _mlblMoving; //运动中 + private Label[] _mlblAcc; //加速中 + private Label[] _mlblInPos; //轴就位 + private Label[] _mlblEnable; //使能 + + private HomeStates _homeStates; //回家状态 + private MotionStates _currentMotionState; //当前运动状态 + private MotionStates _currentMotorStateLast; + private readonly int _motionTimeout = 50000; //定义运动超时时间 + + //定义启用的轴,后面运动时会使用 + public static Axis[] UseAxis = + { Axis.ACSC_AXIS_1, Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_8, Axis.ACSC_NONE }; + + //定义 XYZ三个轴的左右行程范围 + public string StrConfigFile = Application.StartupPath + "\\File\\config.ini"; + public static double MotionSpeed = 60; + public static double XMaxstrokesw = 730; //正限位 + public static double YMaxstrokesw = 1000; + public static double ZMaxstrokesw = 5; + + public static double XMinstrokesw = -30; //负限位 + public static double YMinstrokesw = -10; + public static double ZMinstrokesw = -280; + + //定义一个3D点,存储当前平台位置 + private Point3D _mPoint3D; + + #endregion #region hexcal软件交互 - private TcpIpServer _mTcpIpServer; //创建tcpserver,用于接收hexcal传来的指令,并解析传递平台 - - private bool _mBHexcalConnected; - //public string LISTEN_ADDRESS = "100.0.0.1"; - private void StartServer() { // 对_mTcpIpServer增加判断是否已经启动且存在设备连接 @@ -203,16 +209,6 @@ namespace HexcalMC return; } - //判断 要监听的IP地址是否存在 - - //if (!Internet.IsIpReachable(LISTEN_ADDRESS)) - //{ - // MyBase.TraceWriteLine("启动服务失败,请确认本地网卡是否启用且配置 " + LISTEN_ADDRESS); - // MessageBox.Show("请确认本地网卡是否启用且配置 " + LISTEN_ADDRESS, "启动服务失败"); - // return; - //} - - //启动服务器,并获取数据,解析 _mTcpIpServer = new TcpIpServer(IPAddress.Any.ToString(), Convert.ToString(1234)); _mTcpIpServer.UseMode = 1; //设置通讯返回数据流格式 @@ -225,7 +221,6 @@ namespace HexcalMC _mTcpIpServer.OnRaisedMessage += ReceiveMessage; //接收消息回调 _mTcpIpServer.OnRaisedStatus += ReceiveStatus; //连接状态 _mTcpIpServer.DataReceived += ReceiveByte; - DebugDfn.AddLogText("TCP服务端启动成功 "); } else { @@ -455,7 +450,7 @@ namespace HexcalMC SendMsgToHexcal("%"); //收到并执行,同时状态改为忙碌 //执行回家 - Ishome(); + IsHomed(); } else if (msg.Contains("MOVABS")) //移动指令,解析移动位置 { @@ -512,6 +507,7 @@ namespace HexcalMC Btn_StartServer.Enabled = false; Btn_StopServer.Enabled = true; StartServer(); + DebugDfn.AddLogText("TCP服务端启动成功 "); } private void Btn_StopServer_Click(object sender, EventArgs e) @@ -524,67 +520,14 @@ namespace HexcalMC Btn_StopServer.Enabled = false; Btn_StartServer.Enabled = true; + _mBHexcalConnected = false; + DebugDfn.AddLogText("TCP服务端已关闭"); } #endregion #region ACS平台相关 - #region 运动平台变量区 - - public Api _acs; - - private const int MaxUiLimitCnt = 8; - private const int MaxUiIoCnt = 8; - - private readonly int _mNTotalAxis = 0; - private int _mNTotalBuffer = 0; - private Axis[] _mArrAxisList = null; - - public bool _mAcsConnected; //ACS通讯状态 - - // For update values - private MotorStates _mNMotorState; //运动状态 - - private ProgramStates _mNProgramState; //程序状态 - private object _mObjReadVar; - private Array _mArrReadVector; - private double _mLfRPos, _mLfFPos, _mLfPe, _mLfFvel; //参考位置,反馈位置 位置误差 反馈速度 double类型 - private int _mNValues, _mNOutputState; - - private Label[] _mLblLeftLimit; //左限位 - private Label[] _mLblRightLimit; //右限位 - - private HomeStates _homeStates; //回家状态 - private MotionStates _currentMotionState; //当前运动状态 - private MotionStates _currentMotorStateLast; - private readonly int _motionTimeout = 50000; //定义运动超时时间 - - - public static Axis[] UseAxis = - { Axis.ACSC_AXIS_1, Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_8, Axis.ACSC_NONE }; //定义启用的轴,后面运动时会使用 - - //定义轴的运动状态 - private readonly bool[] axisFinished = new bool[10]; // 假设只有轴 0、1和8,数组大小为10(0到9) - - //定义 XYZ三个轴的左右行程范围 - public string StrConfigFile = Application.StartupPath + "\\File\\config.ini"; - public static double MotionSpeed = 60; - public static double XMaxstrokesw = 730; //正限位 - public static double YMaxstrokesw = 1000; - public static double ZMaxstrokesw = 5; - - public static double XMinstrokesw = -30; //负限位 - public static double YMinstrokesw = -10; - public static double ZMinstrokesw = -280; - - private bool _enableAcs; //读取配置,是否上电自动连接平台 - - private Point3D _mPoint3D; //定义一个3D点,存储当前平台位置 - private Point3D _mPoint3DLast; //存储上一周期的位置 - - #endregion - private void BtnEnable_Click(object sender, EventArgs e) //使能所有轴 { if (_mAcsConnected) @@ -635,62 +578,58 @@ namespace HexcalMC return false; } + private void TmrMonitor_Tick(object sender, EventArgs e) //用于刷新状态 { - int iAxisNo = cboAxisNo.SelectedIndex; if (_mAcsConnected) { try { - //获取平台当前位置 - _mPoint3D = GetPositionXyz(); + _mPoint3D = GetPositionXyz(); //取平台当前位置 - // Get Motor State ACSPL+ Variable : MST (integer) - _mNMotorState = _acs.GetMotorState((Axis)iAxisNo); + #region 更新限位及运动状态 - // Returned value is integer, you need to use bitmaks - - // 运动中 - if ((_mNMotorState & MotorStates.ACSC_MST_MOVE) != 0) + //左右限位刷新 + _mObjReadVar = + _acs.ReadVariableAsVector("FAULT", ProgramBuffer.ACSC_NONE, 0, _mNTotalAxis - 1); + if (_mObjReadVar != null) + { + _mArrReadVector = _mObjReadVar as Array; + if (_mArrReadVector != null) + { + UpdateLimitState(0, (int)_mArrReadVector.GetValue(1)); //获取X轴 + UpdateLimitState(1, (int)_mArrReadVector.GetValue(0)); + UpdateLimitState(2, (int)_mArrReadVector.GetValue(8)); + } + } + + UpdateSingleAxisStatus(); //刷新运动状态 + + #endregion + + + #region 到位判断 + + if (IsMotionInPose()) + { + _currentMotionState = MotionStates.InPos; + //DebugDfn.AddLogText("运动到位"); + } + else { - lblMoving.Image = Resources.On; _currentMotionState = MotionStates.Moving; - } - else - { - lblMoving.Image = Resources.Off; + DebugDfn.AddLogText("运动中"); } - // 就位 - if ((_mNMotorState & MotorStates.ACSC_MST_INPOS) != 0) + //增加判断 运动中到 运动到位,主动发送READY + if (_currentMotionState == MotionStates.InPos && _currentMotionState != _currentMotorStateLast) { - lblInPos.Image = Resources.On; - //_currentMotionState = MotionStates.InPos; - } - else - { - lblInPos.Image = Resources.Off; + DebugDfn.AddLogText("运动到位"); } - // 加速 - if ((_mNMotorState & MotorStates.ACSC_MST_ACC) != 0) - { - lblAcc.Image = Resources.On; - } - else - { - lblAcc.Image = Resources.Off; - } + _currentMotorStateLast = _currentMotionState; - // 使能 - if ((_mNMotorState & MotorStates.ACSC_MST_ENABLE) != 0) - { - lblEnable.Image = Resources.On; - } - else - { - lblEnable.Image = Resources.Off; - } + #endregion } catch (Exception ex) { @@ -699,29 +638,6 @@ namespace HexcalMC Btn_ACSStop_Click(null, null); } } - - if (IsMotionInPose()) - { - _currentMotionState = MotionStates.InPos; - //DebugDfn.AddLogText("运动到位"); - } - else - { - _currentMotionState = MotionStates.Moving; - DebugDfn.AddLogText("运动中"); - } - - //增加判断 运动中到 运动到位,主动发送READY - if (_currentMotionState == MotionStates.InPos && _currentMotionState != _currentMotorStateLast) - { - // //发送READY - // CheckPlatformStatus(); - // _mPoint3DLast = _mPoint3D; - // DebugDfn.AddLogText("主动发送到位"); - DebugDfn.AddLogText("运动到位"); - } - - _currentMotorStateLast = _currentMotionState; } private void Btn_ACSStart_Click(object sender, EventArgs e) //连接 @@ -733,24 +649,32 @@ namespace HexcalMC { _acs.OpenCommEthernetTCP( txtIP.Text, // IP Address (Default : 10.0.0.100) - Convert.ToInt32(txtPort.Text.Trim())); // TCP/IP Port nubmer (default : 701) + Convert.ToInt32(txtPort.Text.Trim())); // default : 701 _mAcsConnected = true; + + //运动相关初始化操作 + InitMotion(); + + // 启动定时器 + tmrMonitor.Interval = 50; + tmrMonitor.Start(); + } + + catch (COMException comex) + { + MessageBox.Show("Connection fail", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + Debug.WriteLine("Connection fail" + comex.Message); + + _mAcsConnected = false; + } + catch (Exception ex) { DebugDfn.AddLogText("ACS平台连接异常" + ex); MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } - - - // 启动定时器 - tmrMonitor.Interval = 50; - tmrMonitor.Start(); - - - //运动相关初始化操作 - InitMotion(); } private void Btn_ACSStop_Click(object sender, EventArgs e) //断开连接 @@ -776,12 +700,93 @@ namespace HexcalMC } } - private void Ishome() //读取回家状态,当未回家时执行回家指令 + public int TranslateAxisNumber(Axis originalAxisNumber) + { + int newAxisNumber = -1; + + switch (originalAxisNumber) + { + case Axis.ACSC_AXIS_1: //X轴 + newAxisNumber = 0; + break; + case Axis.ACSC_AXIS_0: + newAxisNumber = 1; //Y轴 + break; + case Axis.ACSC_AXIS_8: + newAxisNumber = 2; + break; + + } + + return newAxisNumber; + } + + private void UpdateSingleAxisStatus() + { + Axis axis = 0; + int _axisNo = 0; + for (int i = 0; i < UseAxis.Length; i++) + { + axis = UseAxis[i]; + + _axisNo = TranslateAxisNumber(UseAxis[i]); + + // Get Motor State ACSPL+ Variable : MST (integer) + _mNMotorState = _acs.GetMotorState(axis); + + if (_axisNo == -1) + { + return; + } + + // 运动中 + if ((_mNMotorState & MotorStates.ACSC_MST_MOVE) != 0) + { + _mlblMoving[_axisNo].Image = Resources.On; + } + else + { + _mlblMoving[_axisNo].Image = Resources.Off; + } + + // 就位 + if ((_mNMotorState & MotorStates.ACSC_MST_INPOS) != 0) + { + _mlblInPos[_axisNo].Image = Resources.On; + } + else + { + _mlblInPos[_axisNo].Image = Resources.Off; + } + + // 加速 + if ((_mNMotorState & MotorStates.ACSC_MST_ACC) != 0) + { + _mlblAcc[_axisNo].Image = Resources.On; + } + else + { + _mlblAcc[_axisNo].Image = Resources.Off; + } + + // 使能 + if ((_mNMotorState & MotorStates.ACSC_MST_ENABLE) != 0) + { + _mlblEnable[_axisNo].Image = Resources.On; + } + else + { + _mlblEnable[_axisNo].Image = Resources.Off; + } + } + } + + private void IsHomed() //读取回家状态,当未回家时执行回家指令 { // 1、连接状态检查,如果未连接,提示 if (!_mAcsConnected) { - DebugDfn.AddLogText("[Ishome] ACS平台未连接,请先点击连接"); + DebugDfn.AddLogText("[IsHomed] ACS平台未连接,请先点击连接"); MessageBox.Show("ACS平台未连接,请先点击连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } @@ -841,6 +846,7 @@ namespace HexcalMC private void InitMotion() //定义 运动状态初始化函数,包括内部变量,轴启用,回家判断等 { + string strTemp; //运动相关变量初始化 _homeStates = HomeStates.None; _currentMotionState = MotionStates.None; @@ -852,12 +858,6 @@ namespace HexcalMC return; } - if (_acs == null) - { - DebugDfn.AddLogText("运动控制对象不存在"); - return; - } - //轴启用,加电 _acs.EnableM(UseAxis); for (int i = 0; i < UseAxis.Length; i++) @@ -868,48 +868,47 @@ namespace HexcalMC DebugDfn.AddLogText("电机已启用"); //回家 - Ishome(); + IsHomed(); - SetSpeedXyz(); + //设置定位速度 + SetSpeedXyz(MotionSpeed); - //注册到位事件 - //_acs.PHYSICALMOTIONEND += ACS_PHYSICALMOTIONEND; - _acs.EnableEvent(Interrupts.ACSC_INTR_PHYSICAL_MOTION_END); + //获取轴数量 + strTemp = _acs.Transaction("?SYSINFO(13)"); + _mNTotalAxis = Convert.ToInt32(strTemp.Trim()); + _mLblLeftLimit = new Label[MaxUiLimitCnt]; //左限位 + _mLblLeftLimit[0] = lblLL0; + _mLblLeftLimit[1] = lblLL1; + _mLblLeftLimit[2] = lblLL2; + + + _mLblRightLimit = new Label[MaxUiLimitCnt]; //右限位 + _mLblRightLimit[0] = lblRL0; + _mLblRightLimit[1] = lblRL1; + _mLblRightLimit[2] = lblRL2; + + _mlblMoving = new Label[MaxUiLimitCnt]; //运动中 + _mlblMoving[0] = lblMoving0; + _mlblMoving[1] = lblMoving1; + _mlblMoving[2] = lblMoving2; + + _mlblAcc = new Label[MaxUiLimitCnt]; // 加速中 + _mlblAcc[0] = lblAcc0; + _mlblAcc[1] = lblAcc1; + _mlblAcc[2] = lblAcc2; + + _mlblInPos = new Label[MaxUiLimitCnt]; //就位 + _mlblInPos[0] = lblInPos0; + _mlblInPos[1] = lblInPos1; + _mlblInPos[2] = lblInPos2; + + _mlblEnable = new Label[MaxUiLimitCnt]; //轴使能 + _mlblEnable[0] = lblEnable0; + _mlblEnable[1] = lblEnable1; + _mlblEnable[2] = lblEnable2; } - private void ACS_PHYSICALMOTIONEND(AxisMasks axis) - { - //int bit = 0x01; - //int axisNo = 0; - - //for (int i = 0; i < 64; i++) - //{ - // if ((int)axis == bit) - // { - // axisNo = i; - // axisFinished[axisNo] = true; // 将对应轴的完成情况标记为 true - // Console.WriteLine($" %d %d",axisNo, axisFinished[axisNo]); - // break; - // } - - // bit = bit << 1; - //} - //打印数组 axisFinished - - - // 检查轴0、1和8是否全部完成 - //if (axisFinished[0] && axisFinished[1] && axisFinished[8]) - { - // 三个轴均完成后的操作 - Invoke((MethodInvoker)delegate - { - _currentMotionState = MotionStates.InPos; - //DebugDfn.AddLogText("运动到位"); - }); - } - } - - public static bool IsWithinStrokes(Point3D point) //判断点是否在行程范围内 + public static bool IsWithinLimit(Point3D point) //判断点是否在行程范围内 { if (point.X >= XMinstrokesw && point.X <= XMaxstrokesw && point.Y >= YMinstrokesw && point.Y <= YMaxstrokesw && @@ -936,7 +935,7 @@ namespace HexcalMC //判断 point3D是否合法 if (point3D != null) { - if (IsWithinStrokes(point3D)) //判断点是否在行程范围内 + if (IsWithinLimit(point3D)) //判断点是否在行程范围内 { double[] pointsArray = { @@ -947,15 +946,6 @@ namespace HexcalMC //执行运动指令 _acs.ToPointM(MotionFlags.ACSC_NONE, UseAxis, pointsArray); //多轴运动到指定位置 - - ////等待运动完成 - //for (int i = 0; i < USE_AXIS.Length; i++) - //{ - // _acs.WaitMotionEnd(USE_AXIS[i], _motionTimeout); //等待回家完成 - //} - - //_currentMotionState = MotionStates.InPos; - //DebugDfn.AddLogText("运动到位"); } else { @@ -1007,75 +997,31 @@ namespace HexcalMC return point3D; } - private void SetSpeedXyz() //获取运动参数 + private void SetSpeedXyz(double speed) //获取运动参数 { //获取实际速度 double feedbackVelocity = (double)_acs.ReadVariable("FVEL", ProgramBuffer.ACSC_NONE, 0, 0); DebugDfn.AddLogText("实际速度: " + feedbackVelocity); //设置Y轴 速度参数 - _acs.SetVelocity(Axis.ACSC_AXIS_0, MotionSpeed); - _acs.SetAcceleration(Axis.ACSC_AXIS_0, MotionSpeed * 10); - _acs.SetDeceleration(Axis.ACSC_AXIS_0, MotionSpeed * 10); + _acs.SetVelocity(Axis.ACSC_AXIS_0, speed); + _acs.SetAcceleration(Axis.ACSC_AXIS_0, speed * 10); + _acs.SetDeceleration(Axis.ACSC_AXIS_0, speed * 10); //设置X轴速度参数 - _acs.SetVelocity(Axis.ACSC_AXIS_1, MotionSpeed); - _acs.SetAcceleration(Axis.ACSC_AXIS_1, MotionSpeed * 10); - _acs.SetDeceleration(Axis.ACSC_AXIS_1, MotionSpeed * 10); + _acs.SetVelocity(Axis.ACSC_AXIS_1, speed); + _acs.SetAcceleration(Axis.ACSC_AXIS_1, speed * 10); + _acs.SetDeceleration(Axis.ACSC_AXIS_1, speed * 10); //设置Z轴速度参数 - _acs.SetVelocity(Axis.ACSC_AXIS_8, MotionSpeed); - _acs.SetAcceleration(Axis.ACSC_AXIS_8, MotionSpeed * 10); - _acs.SetDeceleration(Axis.ACSC_AXIS_8, MotionSpeed * 10); + _acs.SetVelocity(Axis.ACSC_AXIS_8, speed); + _acs.SetAcceleration(Axis.ACSC_AXIS_8, speed * 10); + _acs.SetDeceleration(Axis.ACSC_AXIS_8, speed * 10); } - private void openGLControl1_OpenGLDraw(object sender, RenderEventArgs args) - { - OpenGL gl = openGLControl1.OpenGL; - - gl.ClearColor(0, 0, 0, 0); - gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); - - gl.LoadIdentity(); - //gl.Translate(0.0f, 0.0f, -5.0f); // 平移场景 - } - - private void LoadPoints(List points) - { - OpenGL gl = openGLControl1.OpenGL; - - gl.ClearColor(0, 0, 0, 0); - gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); - - gl.LoadIdentity(); - //gl.Translate(0.0f, 0.0f, -5.0f); // 平移场景 - - gl.Begin(OpenGL.GL_POINTS); - foreach (Point3D point in points) - { - // 设置点的颜色 - gl.Color(1.0f, 0.0f, 0.0f); // 红色 - - // 设置点的大小 - gl.PointSize(5.0f); // 大小为5个单位 - gl.Vertex(point.X, point.Y, point.Z); - } - - gl.End(); - - gl.Flush(); - } - - private void openGLControl1_OpenGLInitialized(object sender, EventArgs e) - { - } - - private void openGLControl1_Resized(object sender, EventArgs e) - { - } - - private void openGLControl1_GDIDraw(object sender, RenderEventArgs args) + private void rtb_quick_loc_Click(object sender, EventArgs e) { + //获取输入 } #endregion ACS平台相关 diff --git a/HexcalMC/MainFrom.resx b/HexcalMC/MainFrom.resx index c223879..9c064aa 100644 --- a/HexcalMC/MainFrom.resx +++ b/HexcalMC/MainFrom.resx @@ -307,7 +307,7 @@ KCgoHw8HBwcfKCgoKCg= - + Qk02BQAAAAAAADYEAAAoAAAAEAAAABAAAAABAAgAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAt7e3/7i4 uP+8vLz/vb29/7+/v//BwcH/wsLC/8PDw//FxcX/xsbG/8fHx//IyMj/ycnJ/8rKyv/Ly8v/zMzM/83N @@ -334,7 +334,7 @@ KCgoHw8HBwcfKCgoKCg= - + Qk02BQAAAAAAADYEAAAoAAAAEAAAABAAAAABAAgAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAt7e3/7i4 uP+8vLz/vb29/7+/v//BwcH/wsLC/8PDw//FxcX/xsbG/8fHx//IyMj/ycnJ/8rKyv/Ly8v/zMzM/83N @@ -361,7 +361,7 @@ KCgoHw8HBwcfKCgoKCg= - + Qk02BQAAAAAAADYEAAAoAAAAEAAAABAAAAABAAgAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAt7e3/7i4 uP+8vLz/vb29/7+/v//BwcH/wsLC/8PDw//FxcX/xsb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fHx8XFxcHDygoKCgoHw8XHx8fFw8HHygoKCgo + KCgoHw8HBwcfKCgoKCg= + + + Qk02BQAAAAAAADYEAAAoAAAAEAAAABAAAAABAAgAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAt7e3/7i4 uP+8vLz/vb29/7+/v//BwcH/wsLC/8PDw//FxcX/xsbG/8fHx//IyMj/ycnJ/8rKyv/Ly8v/zMzM/83N @@ -422,7 +638,7 @@ 17, 17 - 87 + 25 diff --git a/HexcalMC/Motion/Motion.Designer.cs b/HexcalMC/Motion/Motion.Designer.cs index ca985f5..91f274a 100644 --- a/HexcalMC/Motion/Motion.Designer.cs +++ b/HexcalMC/Motion/Motion.Designer.cs @@ -184,7 +184,6 @@ this.label47 = new System.Windows.Forms.Label(); this.groupBox8 = new System.Windows.Forms.GroupBox(); this.btn_movepose = new System.Windows.Forms.Button(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); this.textBox_y = new System.Windows.Forms.TextBox(); this.textBox_z = new System.Windows.Forms.TextBox(); this.textBox_x = new System.Windows.Forms.TextBox(); @@ -192,22 +191,23 @@ this.label45 = new System.Windows.Forms.Label(); this.label44 = new System.Windows.Forms.Label(); this.groupBox7 = new System.Windows.Forms.GroupBox(); + this.btn_Z_Down = new System.Windows.Forms.Button(); + this.btn_Z_Up = new System.Windows.Forms.Button(); this.btn_Y_Back = new System.Windows.Forms.Button(); this.btn_X_right = new System.Windows.Forms.Button(); this.btn_X_left = new System.Windows.Forms.Button(); this.btn_Y_Forward = new System.Windows.Forms.Button(); this.groupBox6 = new System.Windows.Forms.GroupBox(); this.btn_home = new System.Windows.Forms.Button(); - this.btn_stop = new System.Windows.Forms.Button(); - this.btn_start = new System.Windows.Forms.Button(); this.groupBox10 = new System.Windows.Forms.GroupBox(); this.label48 = new System.Windows.Forms.Label(); - this.textBox4 = new System.Windows.Forms.TextBox(); + this.textBox_cycleTimes = new System.Windows.Forms.TextBox(); this.btn_halt = new System.Windows.Forms.Button(); this.btn_run = new System.Windows.Forms.Button(); - this.checkBox4 = new System.Windows.Forms.CheckBox(); - this.checkBox3 = new System.Windows.Forms.CheckBox(); - this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.checkBox_Z = new System.Windows.Forms.CheckBox(); + this.checkBox_y = new System.Windows.Forms.CheckBox(); + this.checkBox_X = new System.Windows.Forms.CheckBox(); + this.button1 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.grpMotionTest.SuspendLayout(); this.grpMst.SuspendLayout(); @@ -1791,7 +1791,6 @@ // groupBox8 // this.groupBox8.Controls.Add(this.btn_movepose); - this.groupBox8.Controls.Add(this.checkBox1); this.groupBox8.Controls.Add(this.textBox_y); this.groupBox8.Controls.Add(this.textBox_z); this.groupBox8.Controls.Add(this.textBox_x); @@ -1807,7 +1806,7 @@ // // btn_movepose // - this.btn_movepose.Location = new System.Drawing.Point(129, 122); + this.btn_movepose.Location = new System.Drawing.Point(157, 120); this.btn_movepose.Name = "btn_movepose"; this.btn_movepose.Size = new System.Drawing.Size(120, 37); this.btn_movepose.TabIndex = 7; @@ -1815,16 +1814,6 @@ this.btn_movepose.UseVisualStyleBackColor = true; this.btn_movepose.Click += new System.EventHandler(this.btn_movepose_Click); // - // checkBox1 - // - this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(39, 133); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(48, 16); - this.checkBox1.TabIndex = 6; - this.checkBox1.Text = "等待"; - this.checkBox1.UseVisualStyleBackColor = true; - // // textBox_y // this.textBox_y.Location = new System.Drawing.Point(149, 54); @@ -1875,6 +1864,8 @@ // // groupBox7 // + this.groupBox7.Controls.Add(this.btn_Z_Down); + this.groupBox7.Controls.Add(this.btn_Z_Up); this.groupBox7.Controls.Add(this.btn_Y_Back); this.groupBox7.Controls.Add(this.btn_X_right); this.groupBox7.Controls.Add(this.btn_X_left); @@ -1886,6 +1877,28 @@ this.groupBox7.TabStop = false; this.groupBox7.Text = "Jog"; // + // btn_Z_Down + // + this.btn_Z_Down.Location = new System.Drawing.Point(198, 107); + this.btn_Z_Down.Name = "btn_Z_Down"; + this.btn_Z_Down.Size = new System.Drawing.Size(75, 35); + this.btn_Z_Down.TabIndex = 5; + this.btn_Z_Down.Text = "Z下移"; + this.btn_Z_Down.UseVisualStyleBackColor = true; + this.btn_Z_Down.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_Z_Down_MouseDown); + this.btn_Z_Down.MouseUp += new System.Windows.Forms.MouseEventHandler(this.BtnJog_MouseUp); + // + // btn_Z_Up + // + this.btn_Z_Up.Location = new System.Drawing.Point(198, 13); + this.btn_Z_Up.Name = "btn_Z_Up"; + this.btn_Z_Up.Size = new System.Drawing.Size(75, 35); + this.btn_Z_Up.TabIndex = 4; + this.btn_Z_Up.Text = "Z上移"; + this.btn_Z_Up.UseVisualStyleBackColor = true; + this.btn_Z_Up.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_Z_Up_MouseDown); + this.btn_Z_Up.MouseUp += new System.Windows.Forms.MouseEventHandler(this.BtnJog_MouseUp); + // // btn_Y_Back // this.btn_Y_Back.Location = new System.Drawing.Point(104, 107); @@ -1894,7 +1907,8 @@ this.btn_Y_Back.TabIndex = 3; this.btn_Y_Back.Text = "Y后退"; this.btn_Y_Back.UseVisualStyleBackColor = true; - this.btn_Y_Back.Click += new System.EventHandler(this.btn_Y_Back_Click); + this.btn_Y_Back.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_Y_Back_MouseDown); + this.btn_Y_Back.MouseUp += new System.Windows.Forms.MouseEventHandler(this.BtnJog_MouseUp); // // btn_X_right // @@ -1904,7 +1918,8 @@ this.btn_X_right.TabIndex = 2; this.btn_X_right.Text = "X右移"; this.btn_X_right.UseVisualStyleBackColor = true; - this.btn_X_right.Click += new System.EventHandler(this.btn_X_right_Click); + this.btn_X_right.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_X_right_MouseDown); + this.btn_X_right.MouseUp += new System.Windows.Forms.MouseEventHandler(this.BtnJog_MouseUp); // // btn_X_left // @@ -1914,7 +1929,8 @@ this.btn_X_left.TabIndex = 1; this.btn_X_left.Text = "X左移"; this.btn_X_left.UseVisualStyleBackColor = true; - this.btn_X_left.Click += new System.EventHandler(this.btn_X_left_Click); + this.btn_X_left.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_X_left_MouseDown); + this.btn_X_left.MouseUp += new System.Windows.Forms.MouseEventHandler(this.BtnJog_MouseUp); // // btn_Y_Forward // @@ -1924,13 +1940,13 @@ this.btn_Y_Forward.TabIndex = 0; this.btn_Y_Forward.Text = "Y前进"; this.btn_Y_Forward.UseVisualStyleBackColor = true; - this.btn_Y_Forward.Click += new System.EventHandler(this.btn_Y_Forward_Click); + this.btn_Y_Forward.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_Y_Forward_MouseDown); + this.btn_Y_Forward.MouseUp += new System.Windows.Forms.MouseEventHandler(this.BtnJog_MouseUp); // // groupBox6 // + this.groupBox6.Controls.Add(this.button1); this.groupBox6.Controls.Add(this.btn_home); - this.groupBox6.Controls.Add(this.btn_stop); - this.groupBox6.Controls.Add(this.btn_start); this.groupBox6.Location = new System.Drawing.Point(6, 24); this.groupBox6.Name = "groupBox6"; this.groupBox6.Size = new System.Drawing.Size(283, 70); @@ -1940,7 +1956,7 @@ // // btn_home // - this.btn_home.Location = new System.Drawing.Point(198, 24); + this.btn_home.Location = new System.Drawing.Point(7, 24); this.btn_home.Name = "btn_home"; this.btn_home.Size = new System.Drawing.Size(75, 30); this.btn_home.TabIndex = 2; @@ -1948,35 +1964,15 @@ this.btn_home.UseVisualStyleBackColor = true; this.btn_home.Click += new System.EventHandler(this.btn_home_Click); // - // btn_stop - // - this.btn_stop.Location = new System.Drawing.Point(104, 24); - this.btn_stop.Name = "btn_stop"; - this.btn_stop.Size = new System.Drawing.Size(75, 30); - this.btn_stop.TabIndex = 1; - this.btn_stop.Text = "停止"; - this.btn_stop.UseVisualStyleBackColor = true; - this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click); - // - // btn_start - // - this.btn_start.Location = new System.Drawing.Point(10, 24); - this.btn_start.Name = "btn_start"; - this.btn_start.Size = new System.Drawing.Size(75, 30); - this.btn_start.TabIndex = 0; - this.btn_start.Text = "开始"; - this.btn_start.UseVisualStyleBackColor = true; - this.btn_start.Click += new System.EventHandler(this.btn_start_Click); - // // groupBox10 // this.groupBox10.Controls.Add(this.label48); - this.groupBox10.Controls.Add(this.textBox4); + this.groupBox10.Controls.Add(this.textBox_cycleTimes); this.groupBox10.Controls.Add(this.btn_halt); this.groupBox10.Controls.Add(this.btn_run); - this.groupBox10.Controls.Add(this.checkBox4); - this.groupBox10.Controls.Add(this.checkBox3); - this.groupBox10.Controls.Add(this.checkBox2); + this.groupBox10.Controls.Add(this.checkBox_Z); + this.groupBox10.Controls.Add(this.checkBox_y); + this.groupBox10.Controls.Add(this.checkBox_X); this.groupBox10.Location = new System.Drawing.Point(919, 610); this.groupBox10.Name = "groupBox10"; this.groupBox10.Size = new System.Drawing.Size(295, 103); @@ -1987,68 +1983,78 @@ // label48 // this.label48.AutoSize = true; - this.label48.Location = new System.Drawing.Point(220, 65); + this.label48.Location = new System.Drawing.Point(244, 67); this.label48.Name = "label48"; this.label48.Size = new System.Drawing.Size(17, 12); this.label48.TabIndex = 7; this.label48.Text = "次"; // - // textBox4 + // textBox_cycleTimes // - this.textBox4.Location = new System.Drawing.Point(179, 61); - this.textBox4.Name = "textBox4"; - this.textBox4.Size = new System.Drawing.Size(35, 21); - this.textBox4.TabIndex = 5; + this.textBox_cycleTimes.Location = new System.Drawing.Point(203, 63); + this.textBox_cycleTimes.Name = "textBox_cycleTimes"; + this.textBox_cycleTimes.Size = new System.Drawing.Size(35, 21); + this.textBox_cycleTimes.TabIndex = 5; // // btn_halt // - this.btn_halt.Location = new System.Drawing.Point(94, 60); + this.btn_halt.Location = new System.Drawing.Point(99, 60); this.btn_halt.Name = "btn_halt"; - this.btn_halt.Size = new System.Drawing.Size(60, 23); + this.btn_halt.Size = new System.Drawing.Size(80, 30); this.btn_halt.TabIndex = 4; - this.btn_halt.Text = "停止"; + this.btn_halt.Text = "停止循环"; this.btn_halt.UseVisualStyleBackColor = true; - this.btn_halt.Click += new System.EventHandler(this.btn_halt_Click); + this.btn_halt.Click += new System.EventHandler(this.BtnHallAll_Click); // // btn_run // this.btn_run.Location = new System.Drawing.Point(13, 60); this.btn_run.Name = "btn_run"; - this.btn_run.Size = new System.Drawing.Size(60, 23); + this.btn_run.Size = new System.Drawing.Size(80, 30); this.btn_run.TabIndex = 3; - this.btn_run.Text = "运行"; + this.btn_run.Text = "开始循环"; this.btn_run.UseVisualStyleBackColor = true; this.btn_run.Click += new System.EventHandler(this.btn_run_Click); // - // checkBox4 + // checkBox_Z // - this.checkBox4.AutoSize = true; - this.checkBox4.Location = new System.Drawing.Point(184, 21); - this.checkBox4.Name = "checkBox4"; - this.checkBox4.Size = new System.Drawing.Size(30, 16); - this.checkBox4.TabIndex = 2; - this.checkBox4.Text = "Z"; - this.checkBox4.UseVisualStyleBackColor = true; + this.checkBox_Z.AutoSize = true; + this.checkBox_Z.Location = new System.Drawing.Point(184, 21); + this.checkBox_Z.Name = "checkBox_Z"; + this.checkBox_Z.Size = new System.Drawing.Size(30, 16); + this.checkBox_Z.TabIndex = 2; + this.checkBox_Z.Text = "Z"; + this.checkBox_Z.UseVisualStyleBackColor = true; // - // checkBox3 + // checkBox_y // - this.checkBox3.AutoSize = true; - this.checkBox3.Location = new System.Drawing.Point(100, 21); - this.checkBox3.Name = "checkBox3"; - this.checkBox3.Size = new System.Drawing.Size(30, 16); - this.checkBox3.TabIndex = 1; - this.checkBox3.Text = "Y"; - this.checkBox3.UseVisualStyleBackColor = true; + this.checkBox_y.AutoSize = true; + this.checkBox_y.Location = new System.Drawing.Point(100, 21); + this.checkBox_y.Name = "checkBox_y"; + this.checkBox_y.Size = new System.Drawing.Size(30, 16); + this.checkBox_y.TabIndex = 1; + this.checkBox_y.Text = "Y"; + this.checkBox_y.UseVisualStyleBackColor = true; // - // checkBox2 + // checkBox_X // - this.checkBox2.AutoSize = true; - this.checkBox2.Location = new System.Drawing.Point(16, 21); - this.checkBox2.Name = "checkBox2"; - this.checkBox2.Size = new System.Drawing.Size(30, 16); - this.checkBox2.TabIndex = 0; - this.checkBox2.Text = "X"; - this.checkBox2.UseVisualStyleBackColor = true; + this.checkBox_X.AutoSize = true; + this.checkBox_X.Location = new System.Drawing.Point(16, 21); + this.checkBox_X.Name = "checkBox_X"; + this.checkBox_X.Size = new System.Drawing.Size(30, 16); + this.checkBox_X.TabIndex = 0; + this.checkBox_X.Text = "X"; + this.checkBox_X.UseVisualStyleBackColor = true; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(94, 24); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 30); + this.button1.TabIndex = 3; + this.button1.Text = "立即停止"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.BtnHallAll_Click); // // Motion // @@ -2067,6 +2073,7 @@ this.Name = "Motion"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "平台运动"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Motion_FormClosed); this.Load += new System.EventHandler(this.Form1_Load); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); @@ -2251,7 +2258,6 @@ private System.Windows.Forms.GroupBox groupBox9; private System.Windows.Forms.GroupBox groupBox8; private System.Windows.Forms.Button btn_movepose; - private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.TextBox textBox_y; private System.Windows.Forms.TextBox textBox_z; private System.Windows.Forms.TextBox textBox_x; @@ -2265,16 +2271,14 @@ private System.Windows.Forms.Button btn_Y_Forward; private System.Windows.Forms.GroupBox groupBox6; private System.Windows.Forms.Button btn_home; - private System.Windows.Forms.Button btn_stop; - private System.Windows.Forms.Button btn_start; private System.Windows.Forms.GroupBox groupBox10; private System.Windows.Forms.Label label48; - private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.TextBox textBox_cycleTimes; private System.Windows.Forms.Button btn_halt; private System.Windows.Forms.Button btn_run; - private System.Windows.Forms.CheckBox checkBox4; - private System.Windows.Forms.CheckBox checkBox3; - private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.CheckBox checkBox_Z; + private System.Windows.Forms.CheckBox checkBox_y; + private System.Windows.Forms.CheckBox checkBox_X; private System.Windows.Forms.Label label56; private System.Windows.Forms.Label label55; private System.Windows.Forms.Label label54; @@ -2284,6 +2288,9 @@ private System.Windows.Forms.Label label50; private System.Windows.Forms.Label label49; private System.Windows.Forms.Label label47; + private System.Windows.Forms.Button btn_Z_Down; + private System.Windows.Forms.Button btn_Z_Up; + private System.Windows.Forms.Button button1; } } diff --git a/HexcalMC/Motion/Motion.cs b/HexcalMC/Motion/Motion.cs index f739b75..b3c3bc6 100644 --- a/HexcalMC/Motion/Motion.cs +++ b/HexcalMC/Motion/Motion.cs @@ -19,6 +19,11 @@ namespace HexcalMC private const int MaxUiLimitCnt = 8; private const int MaxUiIoCnt = 8; private readonly Api _acs; + private readonly int _motionTimeout = 5000; //延时时间 + + + private readonly Axis[] UseAxis = MainFrom.UseAxis; //获取激活的轴 + private MotionStates _currentMotionState = MotionStates.None; //运动状态 private Axis[] _mArrAxisList; private Array _mArrReadVector; @@ -59,7 +64,7 @@ namespace HexcalMC _acs.SetFPosition((Axis)cboAxisNo.SelectedIndex, 0); } - #region Move to absolute position + #region 绝对运动 private void BtnPTP_Click(object sender, EventArgs e) { @@ -85,7 +90,7 @@ namespace HexcalMC #endregion - #region On and Off General Output + #region 通用IO private void BtnSW_Click(object sender, EventArgs e) { @@ -128,11 +133,12 @@ namespace HexcalMC #endregion - #region Initialize + #region 初始化 private void Form1_Load(object sender, EventArgs e) { - btnOpen.Enabled = true; + //禁止通讯按钮 + btnOpen.Enabled = false; btnClose.Enabled = false; _mLblLeftLimit = new Label[MaxUiLimitCnt]; //左限位 @@ -213,28 +219,80 @@ namespace HexcalMC // secondaryForm.Show(); #endregion + + + #region 初始化 + + InitMotion(); + + #endregion } - private void RdoTCP_CheckedChanged(object sender, EventArgs e) + private void Motion_FormClosed(object sender, FormClosedEventArgs e) { - txtIP.Enabled = true; - txtPort.Enabled = true; - } - - private void RdoSimu_CheckedChanged(object sender, EventArgs e) - { - txtIP.Enabled = false; - txtPort.Enabled = false; + tmrMonitor.Stop(); } #endregion - #region Communication - Open / Close + #region 通讯建立 - private void BtnOpen_Click(object sender, EventArgs e) + private void InitMotion() { string strTemp; int i; + + //判断通讯对象是否存在 + if (_acs == null || !_acs.IsConnected) + { + DebugDfn.AddLogText("未建立通讯,请在主界面先建立通讯"); + + // 在合适的位置调用 MessageBox.Show() 方法 + MessageBox.Show("未建立通讯,请在主界面先建立通讯", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + _mBConnected = _acs.IsConnected; + // Get Total number of axes + // Using Transaction function : return string text from controller, we need to convert to integer value + strTemp = _acs.Transaction("?SYSINFO(13)"); + _mNTotalAxis = Convert.ToInt32(strTemp.Trim()); + + // Using Sysinfo function + //_ACS.GetSysInfo(_ACS.ACSC_SYS_NAXES_KEY, out lfTemp); + + // When we are using multi axes command (ex) ToPointM, HaltM, ...), we need to allocate the array size more 1. + // Because of the last delimeter (-1) + _mArrAxisList = new Axis[_mNTotalAxis + 1]; + //for (i = 0; i < _mNTotalAxis; i++) + //{ + // cboAxisNo.Items.Add(i.ToString()); + // _mArrAxisList[i] = (Axis)i; + //} + + // Insert '-1' at the last + _mArrAxisList[_mNTotalAxis] = Axis.ACSC_NONE; + cboAxisNo.SelectedIndex = 0; + + // Update current motion paramter to UI. + UpdateProfile(); + + strTemp = _acs.Transaction("?SYSINFO(10)"); + _mNTotalBuffer = Convert.ToInt32(strTemp.Trim()); + for (i = 0; i < _mNTotalBuffer; i++) + { + cboBufferNo.Items.Add(i.ToString()); + } + + cboBufferNo.SelectedIndex = 0; + + // Set updating timer + tmrMonitor.Interval = 50; + tmrMonitor.Start(); + } + + private void BtnOpen_Click(object sender, EventArgs e) + { //double lfTemp = 0.0f; try @@ -251,47 +309,8 @@ namespace HexcalMC Convert.ToInt32(txtPort.Text.Trim())); // TCP/IP Port nubmer (default : 701) } + InitMotion(); _mBConnected = true; - - // Get Total number of axes - // Using Transaction function : return string text from controller, we need to convert to integer value - strTemp = _acs.Transaction("?SYSINFO(13)"); - _mNTotalAxis = Convert.ToInt32(strTemp.Trim()); - - // Using Sysinfo function - //_ACS.GetSysInfo(_ACS.ACSC_SYS_NAXES_KEY, out lfTemp); - - // When we are using multi axes command (ex) ToPointM, HaltM, ...), we need to allocate the array size more 1. - // Because of the last delimeter (-1) - _mArrAxisList = new Axis[_mNTotalAxis + 1]; - //for (i = 0; i < _mNTotalAxis; i++) - //{ - // cboAxisNo.Items.Add(i.ToString()); - // _mArrAxisList[i] = (Axis)i; - //} - - // Insert '-1' at the last - _mArrAxisList[_mNTotalAxis] = Axis.ACSC_NONE; - cboAxisNo.SelectedIndex = 0; - - // Update current motion paramter to UI. - UpdateProfile(); - - strTemp = _acs.Transaction("?SYSINFO(10)"); - _mNTotalBuffer = Convert.ToInt32(strTemp.Trim()); - for (i = 0; i < _mNTotalBuffer; i++) - { - cboBufferNo.Items.Add(i.ToString()); - } - - cboBufferNo.SelectedIndex = 0; - - btnOpen.Enabled = false; - btnClose.Enabled = true; - - // Set updating timer - tmrMonitor.Interval = 50; - tmrMonitor.Start(); } catch (COMException comex) @@ -346,7 +365,7 @@ namespace HexcalMC #endregion - #region Update UI data from Controller + #region UI 刷新 /// /// Update Motion Profile from Controller @@ -379,17 +398,7 @@ namespace HexcalMC { try { - // Instruction 1. Using library functions - acsc_GetFPosition, acsc_GetRPosition, .... - // Instruction 2. Read ACS variable - Already defined almost things (FPOS, RPOS, ...) - // Motion parameters and state is array (Max length is total number of axes) - // - // * Library function can read only 1 axis information, so if you want to read several axes, you have to call the function many times. - // (This may cause communication delay.) - // Recommand (if you want to read many axes) : read/write variable using ReadVariable, ReadVariableScalar, ReadVariableVector, ReadVariableMatrix - // - // Get Motor State - // ACSPL+ Variable : MST (integer) _mNMotorState = _acs.GetMotorState((Axis)iAxisNo); // Returned value is integer, you need to use bitmaks @@ -519,7 +528,7 @@ namespace HexcalMC #endregion - #region Motor Enable / Disable + #region 电机使能 private void BtnEnable_Click(object sender, EventArgs e) { @@ -549,7 +558,7 @@ namespace HexcalMC #endregion - #region Move to relative position (from current position) + #region 相对移动 private void BtnPTP_R_Neg_Click(object sender, EventArgs e) { @@ -598,7 +607,7 @@ namespace HexcalMC #endregion - #region Stop motion using deceleration (halt command) + #region 停止运动 private void BtnHalt_Click(object sender, EventArgs e) { @@ -633,7 +642,7 @@ namespace HexcalMC #endregion - #region JOG Command + #region JOG 功能 // Move negative direction private void BtnJogNeg_MouseDown(object sender, MouseEventArgs e) @@ -695,11 +704,39 @@ namespace HexcalMC private void BtnJog_MouseUp(object sender, MouseEventArgs e) { _acs.Halt((Axis)cboAxisNo.SelectedIndex); + + + //自定义Jog + if (sender is Button button) + { + string btn_name = button.Name; + switch (btn_name) + { + case "btn_X_left": + _acs.Halt(Axis.ACSC_AXIS_1); + break; + case "btn_X_right": + _acs.Halt(Axis.ACSC_AXIS_1); + break; + case "btn_Y_Forward": + _acs.Halt(Axis.ACSC_AXIS_0); + break; + case "btn_Y_Back": + _acs.Halt(Axis.ACSC_AXIS_0); + break; + case "btn_Z_Up": + _acs.Halt(Axis.ACSC_AXIS_8); + break; + case "btn_Z_Down": + _acs.Halt(Axis.ACSC_AXIS_8); + break; + } + } } #endregion - #region Run/Stop Buffer Program + #region 运行 Buffer Program private void BtnRunBuffer_Click(object sender, EventArgs e) { @@ -742,7 +779,7 @@ namespace HexcalMC #endregion - #region Change motion profile + #region 修改运动参数 private void TextBoxes_KeyPress(object sender, KeyPressEventArgs e) { @@ -849,7 +886,7 @@ namespace HexcalMC #endregion - #region Event + #region 事件回调 private void BtnEventMotionEnd_Click(object sender, EventArgs e) { @@ -891,86 +928,6 @@ namespace HexcalMC } - private void btn_movepose_Click(object sender, EventArgs e) - { - //判断是否为textBox_x空 - if (string.IsNullOrWhiteSpace(textBox_x.Text) || string.IsNullOrEmpty(textBox_y.Text) || - string.IsNullOrEmpty(textBox_z.Text)) - { - MessageBox.Show("输入文本框为空,请修改", "警告"); - return; - } - - //获取 textBox_x 的值 - double x = double.Parse(textBox_x.Text); - double y = double.Parse(textBox_y.Text); - double z = double.Parse(textBox_z.Text); - Point3D _point3D = new Point3D(x, y, z); - - - if (MainFrom.IsWithinStrokes(_point3D)) //判断点是否在行程范围内 - { - double[] pointsArray = - { - _point3D.X, - _point3D.Y, - _point3D.Z - }; - //执行运动指令 - _acs.ToPointM(MotionFlags.ACSC_NONE, MainFrom.UseAxis, pointsArray); //多轴运动到指定位置 - - ////等待运动完成 - //for (int i = 0; i < USE_AXIS.Length; i++) - //{ - // _acs.WaitMotionEnd(USE_AXIS[i], _motionTimeout); //等待回家完成 - //} - - //_currentMotionState = MotionStates.InPos; - //DebugDfn.AddLogText("运动到位"); - } - else - { - DebugDfn.AddLogText("目标位置超出行程范围,请重新设置"); - MessageBox.Show("目标位置超出行程范围,请重新设置", "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void btn_start_Click(object sender, EventArgs e) - { - } - - private void btn_stop_Click(object sender, EventArgs e) - { - } - - private void btn_home_Click(object sender, EventArgs e) - { - } - - private void btn_X_left_Click(object sender, EventArgs e) - { - } - - private void btn_X_right_Click(object sender, EventArgs e) - { - } - - private void btn_Y_Forward_Click(object sender, EventArgs e) - { - } - - private void btn_Y_Back_Click(object sender, EventArgs e) - { - } - - private void btn_run_Click(object sender, EventArgs e) - { - } - - private void btn_halt_Click(object sender, EventArgs e) - { - } - private void ACS_PROGRAMEND(BufferMasks buffer) { int bit = 0x01; @@ -998,7 +955,7 @@ namespace HexcalMC #endregion - #region Communication Termial - Using Transaction function + #region 命令行响应 private void TxtCommand_KeyPress(object sender, KeyPressEventArgs e) { @@ -1042,5 +999,277 @@ namespace HexcalMC } #endregion + + + #region 按钮 + + private void btn_movepose_Click(object sender, EventArgs e) + { + //判断是否为textBox_x空 + if (string.IsNullOrWhiteSpace(textBox_x.Text) || string.IsNullOrEmpty(textBox_y.Text) || + string.IsNullOrEmpty(textBox_z.Text)) + { + MessageBox.Show("输入文本框为空,请修改", "警告"); + return; + } + + //获取 textBox_x 的值 + double x = double.Parse(textBox_x.Text); + double y = double.Parse(textBox_y.Text); + double z = double.Parse(textBox_z.Text); + Point3D _point3D = new Point3D(x, y, z); + + + if (MainFrom.IsWithinLimit(_point3D)) //判断点是否在行程范围内 + { + double[] pointsArray = + { + _point3D.X, + _point3D.Y, + _point3D.Z + }; + //执行运动指令 + _acs.ToPointM(MotionFlags.ACSC_NONE, UseAxis, pointsArray); //多轴运动到指定位置 + + ////等待运动完成 + //for (int i = 0; i < USE_AXIS.Length; i++) + //{ + // _acs.WaitMotionEnd(USE_AXIS[i], _motionTimeout); //等待回家完成 + //} + + //_currentMotionState = MotionStates.InPos; + //DebugDfn.AddLogText("运动到位"); + } + else + { + DebugDfn.AddLogText("目标位置超出行程范围,请重新设置"); + MessageBox.Show("目标位置超出行程范围,请重新设置", "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + + private void btn_home_Click(object sender, EventArgs e) //回零 + { + double[] pointsArray = + { + 0, + 0, + 0 + }; + //执行运动指令 + _acs.ToPointM(MotionFlags.ACSC_NONE, UseAxis, pointsArray); //多轴运动到指定位置 + + //等待运动完成 + for (int i = 0; i < UseAxis.Length-1; i++) + { + _acs.WaitMotionEnd(UseAxis[i], _motionTimeout); //等待回家完成 + } + + _currentMotionState = MotionStates.InPos; + DebugDfn.AddLogText("运动到位"); + } + + private void btn_X_left_MouseDown(object sender, MouseEventArgs e) + { + double lfVelocity = 0.0f; + try + { + if (chkUseVel.Checked) + { + lfVelocity = Convert.ToDouble(txtJogVel.Text.Trim()); + if (lfVelocity > 0) lfVelocity = lfVelocity * -1; // Negative direction : Using - (minus) velocity + + _acs.Jog( + MotionFlags.ACSC_AMF_VELOCITY, // Velocity flag 速度标志 + Axis.ACSC_AXIS_1, // Axis number + lfVelocity // Velocity + ); + } + else + { + _acs.Jog(0, Axis.ACSC_AXIS_1, (double)GlobalDirection.ACSC_NEGATIVE_DIRECTION); + } + } + catch (Exception exception) + { + DebugDfn.AddLogText("X左移异常" + exception); + } + } + + private void btn_X_right_MouseDown(object sender, MouseEventArgs e) + { + double lfVelocity = 0.0f; + try + { + if (chkUseVel.Checked) + { + lfVelocity = Convert.ToDouble(txtJogVel.Text.Trim()); + if (lfVelocity > 0) lfVelocity = lfVelocity * -1; // Negative direction : Using - (minus) velocity + + _acs.Jog( + MotionFlags.ACSC_AMF_VELOCITY, // Velocity flag 速度标志 + Axis.ACSC_AXIS_1, // Axis number + lfVelocity // Velocity + ); + } + else + { + _acs.Jog(0, Axis.ACSC_AXIS_1, (double)GlobalDirection.ACSC_POSITIVE_DIRECTION); + } + } + catch (Exception exception) + { + DebugDfn.AddLogText("X左移异常" + exception); + } + } + + private void btn_Y_Forward_MouseDown(object sender, MouseEventArgs e) + { + double lfVelocity = 0.0f; + try + { + if (chkUseVel.Checked) + { + lfVelocity = Convert.ToDouble(txtJogVel.Text.Trim()); + if (lfVelocity > 0) lfVelocity = lfVelocity * -1; // Negative direction : Using - (minus) velocity + + _acs.Jog( + MotionFlags.ACSC_AMF_VELOCITY, // Velocity flag 速度标志 + Axis.ACSC_AXIS_0, // Axis number + lfVelocity // Velocity + ); + } + else + { + _acs.Jog(0, Axis.ACSC_AXIS_0, (double)GlobalDirection.ACSC_NEGATIVE_DIRECTION); + } + } + catch (Exception exception) + { + DebugDfn.AddLogText("Y前移异常" + exception); + } + } + + private void btn_Y_Back_MouseDown(object sender, MouseEventArgs e) + { + double lfVelocity = 0.0f; + try + { + if (chkUseVel.Checked) + { + lfVelocity = Convert.ToDouble(txtJogVel.Text.Trim()); + if (lfVelocity > 0) lfVelocity = lfVelocity * -1; // Negative direction : Using - (minus) velocity + + _acs.Jog( + MotionFlags.ACSC_AMF_VELOCITY, // Velocity flag 速度标志 + Axis.ACSC_AXIS_0, // Axis number + lfVelocity // Velocity + ); + } + else + { + _acs.Jog(0, Axis.ACSC_AXIS_0, (double)GlobalDirection.ACSC_POSITIVE_DIRECTION); + } + } + catch (Exception exception) + { + DebugDfn.AddLogText("Y后移异常" + exception); + } + } + + private void btn_Z_Down_MouseDown(object sender, MouseEventArgs e) + { + double lfVelocity = 0.0f; + try + { + if (chkUseVel.Checked) + { + lfVelocity = Convert.ToDouble(txtJogVel.Text.Trim()); + if (lfVelocity > 0) lfVelocity = lfVelocity * -1; // Negative direction : Using - (minus) velocity + + _acs.Jog( + MotionFlags.ACSC_AMF_VELOCITY, // Velocity flag 速度标志 + Axis.ACSC_AXIS_8, // Axis number + lfVelocity // Velocity + ); + } + else + { + _acs.Jog(0, Axis.ACSC_AXIS_8, (double)GlobalDirection.ACSC_NEGATIVE_DIRECTION); + } + } + catch (Exception exception) + { + DebugDfn.AddLogText("Z向下异常" + exception); + } + } + + private void btn_Z_Up_MouseDown(object sender, MouseEventArgs e) + { + double lfVelocity = 0.0f; + try + { + if (chkUseVel.Checked) + { + lfVelocity = Convert.ToDouble(txtJogVel.Text.Trim()); + if (lfVelocity > 0) lfVelocity = lfVelocity * -1; // Negative direction : Using - (minus) velocity + + _acs.Jog( + MotionFlags.ACSC_AMF_VELOCITY, // Velocity flag 速度标志 + Axis.ACSC_AXIS_8, // Axis number + lfVelocity // Velocity + ); + } + else + { + _acs.Jog(0, Axis.ACSC_AXIS_8, (double)GlobalDirection.ACSC_POSITIVE_DIRECTION); + } + } + catch (Exception exception) + { + DebugDfn.AddLogText("Z向上异常" + exception); + } + } + + + private void btn_run_Click(object sender, EventArgs e) + { + //运动次数 + if (string.IsNullOrEmpty(textBox_cycleTimes.Text)) + { + MessageBox.Show("循环次数不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + int times = Convert.ToInt32(textBox_cycleTimes.Text); + DebugDfn.AddLogText("循环次数: " + times); + + do + { + //X轴 + if (checkBox_X.Checked) + { + } + + if (checkBox_y.Checked) + { + } + + + if (checkBox_Z.Checked) + { + } + + + //开始运动 + + times = times - 1; + DebugDfn.AddLogText($"当前为第{times}循环"); + } while (times > 0); + + DebugDfn.AddLogText("循环结束"); + } + + #endregion } } \ No newline at end of file diff --git a/HexcalMC/Motion/Motion.resx b/HexcalMC/Motion/Motion.resx index 7f7481b..3053904 100644 --- a/HexcalMC/Motion/Motion.resx +++ b/HexcalMC/Motion/Motion.resx @@ -1148,7 +1148,7 @@ - 77 + 25 diff --git a/HexcalMC/Program.cs b/HexcalMC/Program.cs index ab52e09..f55bcbb 100644 --- a/HexcalMC/Program.cs +++ b/HexcalMC/Program.cs @@ -1,34 +1,35 @@ -using HexcalMC.Base; -using System; +using System; using System.Diagnostics; +using System.IO; using System.Windows.Forms; -using static Telerik.WinControls.UI.Export.ExportSettings; +using HexcalMC.Base; //////////////////////////////////////////////////////////////////////////////////////////////////// // // //开发说明 -// V0.1 2024/03/1 +// V0.1 2024/03/01 //--------------------------------------- //1、初版构建 //2、调用流程: 开启TCP服务端、连接到平台轴启用—》hexcal软件连接,开启校准通讯流程—》移动至到位后反馈—》hexcal逻辑处理—》hexcal校准完成关系—》软件关闭 // -// V0.2 2024/03/7 +// +// V0.2 2024/03/07 //--------------------------------------- //1、取消上电自动连接 //2、优化运动窗体间传递 运动平台对象 //3、增加平台位置动态显示 //4、修复运动到位判断逻辑 //5、增加演示模式按钮 -// -// //6、点击停止报错,运动测试界面问题? //7、发现交互过程中,需要hexcal发送指令后,中间件再进行回应,主动回应,hexcal流程有问题 // // // // +// +// //////////////////////////////////////////////////////////////////////////////////////////////////// namespace HexcalMC @@ -42,14 +43,13 @@ namespace HexcalMC Application.SetCompatibleTextRenderingDefault(false); DebugDfn._strStartTime = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); - System.IO.TextWriter log = new System.IO.StreamWriter(DebugDfn.StrDebugFile); - System.Diagnostics.TextWriterTraceListener logger; - logger = new System.Diagnostics.TextWriterTraceListener(log); + TextWriter log = new StreamWriter(DebugDfn.StrDebugFile); + TextWriterTraceListener logger; + logger = new TextWriterTraceListener(log); Trace.Listeners.Add(logger); MyBase.TraceWriteLine("--软件Main函数开始"); Application.Run(new MainFrom()); - } } } \ No newline at end of file diff --git a/HexcalMC/Properties/Resources.Designer.cs b/HexcalMC/Properties/Resources.Designer.cs index b6749f8..3c2023e 100644 --- a/HexcalMC/Properties/Resources.Designer.cs +++ b/HexcalMC/Properties/Resources.Designer.cs @@ -169,5 +169,25 @@ namespace HexcalMC.Properties { return ((System.Drawing.Bitmap)(obj)); } } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap quick_location { + get { + object obj = ResourceManager.GetObject("quick_location", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap quick_location_64 { + get { + object obj = ResourceManager.GetObject("quick_location_64", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/HexcalMC/Properties/Resources.resx b/HexcalMC/Properties/Resources.resx index 8e82715..2d44e38 100644 --- a/HexcalMC/Properties/Resources.resx +++ b/HexcalMC/Properties/Resources.resx @@ -118,37 +118,43 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Images\HexagonNew.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\about.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\motion.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Images\On.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Error.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\HexagonNew.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\mothion_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Hexagon.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\quick_location.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\Error.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\demo_show_128.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Images\Off.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\motion.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\quick_location_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\demo_show.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\mothion_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - \ No newline at end of file diff --git a/Motion/ACS Motion/MainForm.Designer.cs b/Motion/ACS Motion/MainForm.Designer.cs index 1c3e51e..873b8c4 100644 --- a/Motion/ACS Motion/MainForm.Designer.cs +++ b/Motion/ACS Motion/MainForm.Designer.cs @@ -1837,6 +1837,7 @@ this.button8.TabIndex = 7; this.button8.Text = "移动到目标位置"; this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); // // checkBox1 // @@ -2033,6 +2034,7 @@ this.button9.TabIndex = 3; this.button9.Text = "运行"; this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); // // checkBox4 // diff --git a/Motion/ACS Motion/MainForm.cs b/Motion/ACS Motion/MainForm.cs index 40d05b4..e92bb9c 100644 --- a/Motion/ACS Motion/MainForm.cs +++ b/Motion/ACS Motion/MainForm.cs @@ -812,6 +812,16 @@ namespace ACS_DotNET_Library_Advanced_Demo lstLog.Items.Add("PROGRAM_END event enabled"); } + private void button8_Click(object sender, EventArgs e) + { + + } + + private void button9_Click(object sender, EventArgs e) + { + + } + void _ACS_PROGRAMEND(BufferMasks buffer) { int bit = 0x01;