diff --git a/CMS_CORE_Application/Form1.Designer.cs b/CMS_CORE_Application/Form1.Designer.cs
index 3329928..0edbcb7 100644
--- a/CMS_CORE_Application/Form1.Designer.cs
+++ b/CMS_CORE_Application/Form1.Designer.cs
@@ -69,14 +69,14 @@
this.TXTPPName = new System.Windows.Forms.TextBox();
this.TXTPPLines = new System.Windows.Forms.TextBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
+ this.label12 = new System.Windows.Forms.Label();
+ this.labelTest1TXT = new System.Windows.Forms.TextBox();
this.labelTest = new System.Windows.Forms.Label();
this.labelTest2TXT = new System.Windows.Forms.TextBox();
this.TXTNow = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.Error = new System.Windows.Forms.TextBox();
- this.label12 = new System.Windows.Forms.Label();
- this.labelTest1TXT = new System.Windows.Forms.TextBox();
this.panel1.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
@@ -207,7 +207,8 @@
"Demo",
"Fanuc",
"Siemens",
- "Osai"});
+ "Osai",
+ "S7Net"});
this.NcCombo.Location = new System.Drawing.Point(484, 3);
this.NcCombo.Name = "NcCombo";
this.NcCombo.Size = new System.Drawing.Size(150, 21);
@@ -354,7 +355,7 @@
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.76253F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 49.23747F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 296F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 297F));
this.tableLayoutPanel1.Controls.Add(this.groupBox2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox4, 2, 0);
@@ -375,7 +376,7 @@
this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox2.Location = new System.Drawing.Point(158, 3);
this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(145, 265);
+ this.groupBox2.Size = new System.Drawing.Size(144, 265);
this.groupBox2.TabIndex = 28;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Plc";
@@ -389,7 +390,7 @@
this.TXTMsg.Multiline = true;
this.TXTMsg.Name = "TXTMsg";
this.TXTMsg.ReadOnly = true;
- this.TXTMsg.Size = new System.Drawing.Size(134, 238);
+ this.TXTMsg.Size = new System.Drawing.Size(133, 238);
this.TXTMsg.TabIndex = 18;
//
// groupBox1
@@ -424,9 +425,9 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox4.Controls.Add(this.tabControl1);
this.groupBox4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.groupBox4.Location = new System.Drawing.Point(309, 3);
+ this.groupBox4.Location = new System.Drawing.Point(308, 3);
this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(291, 265);
+ this.groupBox4.Size = new System.Drawing.Size(292, 265);
this.groupBox4.TabIndex = 29;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Path";
@@ -440,7 +441,7 @@
this.tabControl1.Location = new System.Drawing.Point(6, 21);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(278, 238);
+ this.tabControl1.Size = new System.Drawing.Size(279, 238);
this.tabControl1.TabIndex = 0;
//
// tabPage1
@@ -449,7 +450,7 @@
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(270, 212);
+ this.tabPage1.Size = new System.Drawing.Size(271, 212);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Path 1";
this.tabPage1.UseVisualStyleBackColor = true;
@@ -463,7 +464,7 @@
this.TXTAlm.Multiline = true;
this.TXTAlm.Name = "TXTAlm";
this.TXTAlm.ReadOnly = true;
- this.TXTAlm.Size = new System.Drawing.Size(258, 203);
+ this.TXTAlm.Size = new System.Drawing.Size(259, 203);
this.TXTAlm.TabIndex = 18;
//
// groupBox3
@@ -590,6 +591,22 @@
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Nc Info";
//
+ // label12
+ //
+ this.label12.AutoSize = true;
+ this.label12.Location = new System.Drawing.Point(95, 73);
+ this.label12.Name = "label12";
+ this.label12.Size = new System.Drawing.Size(66, 13);
+ this.label12.TabIndex = 32;
+ this.label12.Text = "Label Test 1";
+ //
+ // labelTest1TXT
+ //
+ this.labelTest1TXT.Location = new System.Drawing.Point(164, 70);
+ this.labelTest1TXT.Name = "labelTest1TXT";
+ this.labelTest1TXT.Size = new System.Drawing.Size(217, 20);
+ this.labelTest1TXT.TabIndex = 31;
+ //
// labelTest
//
this.labelTest.AutoSize = true;
@@ -643,22 +660,6 @@
this.Error.Size = new System.Drawing.Size(462, 20);
this.Error.TabIndex = 27;
//
- // label12
- //
- this.label12.AutoSize = true;
- this.label12.Location = new System.Drawing.Point(95, 73);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(66, 13);
- this.label12.TabIndex = 32;
- this.label12.Text = "Label Test 1";
- //
- // labelTest1TXT
- //
- this.labelTest1TXT.Location = new System.Drawing.Point(164, 70);
- this.labelTest1TXT.Name = "labelTest1TXT";
- this.labelTest1TXT.Size = new System.Drawing.Size(217, 20);
- this.labelTest1TXT.TabIndex = 31;
- //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
diff --git a/CMS_CORE_Application/Form1.cs b/CMS_CORE_Application/Form1.cs
index 858e9cf..3927645 100644
--- a/CMS_CORE_Application/Form1.cs
+++ b/CMS_CORE_Application/Form1.cs
@@ -3,6 +3,7 @@ using CMS_CORE_Library.Demo;
using CMS_CORE_Library.Fanuc;
using CMS_CORE_Library.Models;
using CMS_CORE_Library.Osai;
+using CMS_CORE_Library.S7Net;
using CMS_CORE_Library.Siemens;
using System;
using System.Collections.Generic;
@@ -117,16 +118,24 @@ namespace CMS_CORE_Application
OffsetModel off = new OffsetModel();
cmsError = N.TOOLS_ROffset(1, ref off);
- try
+ // in caso di errore (es S7Net) escludo
+ if (cmsError.IsError())
{
- off.CustomDouble[3] = 88.22;
-
- off.CustomInt[1] = 15;
- cmsError = N.TOOLS_WOffset(1, ref off);
+ error = true; SetError(Lines, cmsError);
}
- catch (Exception ex)
+ else
{
- labelTest1TXT.Text = ex.Message;
+ try
+ {
+ off.CustomDouble[3] = 88.22;
+
+ off.CustomInt[1] = 15;
+ cmsError = N.TOOLS_WOffset(1, ref off);
+ }
+ catch (Exception ex)
+ {
+ labelTest1TXT.Text = ex.Message;
+ }
}
MovementBetweenMagazinesModel mov = new MovementBetweenMagazinesModel();
@@ -138,7 +147,7 @@ namespace CMS_CORE_Application
N.PROC_RSelectedProcessData(1, ref a);
sw.Stop();
- Console.WriteLine("TEMPO PER FUNZIONE " + sw.ElapsedMilliseconds);
+ Console.WriteLine("TEMPO PER FUNZIONE " + sw.ElapsedMilliseconds);
////////////////////////////////////////////////////////////// END TEST
if (!this.IsDisposed && this.InvokeRequired)
@@ -205,6 +214,8 @@ namespace CMS_CORE_Application
return new Nc_Osai(NCIp, NCPort, 50000);
if (NCType == "Fanuc")
return new Nc_Fanuc(NCIp, NCPort, 2000);
+ if (NCType == "S7Net")
+ return new Nc_S7Net(NCIp, NCPort, 500);
return null;
}
@@ -240,6 +251,13 @@ namespace CMS_CORE_Application
TXTip.Text = "localhost";
TXTport.Text = "8080";
}
+ else if (NcCombo.SelectedItem.ToString().Equals("S7Net"))
+ {
+ TXTip.Enabled = true;
+ TXTport.Enabled = false;
+ TXTip.Text = "192.168.0.102";
+ TXTport.Text = "102";
+ }
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
diff --git a/CMS_CORE_Library/S7Net/Nc_S7Net.cs b/CMS_CORE_Library/S7Net/Nc_S7Net.cs
index 0c9a9e4..eea7d2c 100644
--- a/CMS_CORE_Library/S7Net/Nc_S7Net.cs
+++ b/CMS_CORE_Library/S7Net/Nc_S7Net.cs
@@ -1,6 +1,5 @@
using CMS_CORE_Library.Models;
using S7.Net;
-using Siemens.Sinumerik.Operate.Services;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -125,8 +124,10 @@ namespace CMS_CORE_Library.S7Net
///
///Instantiate The NC-S7Net Class
///
+ /// Remote Ip-Address of the Nc
+ /// Remote Port of the Nc
///Send/Recieve timeout connection [mS]
- public Nc_S7Net(ushort ConnectionTimeOut)
+ public Nc_S7Net( string IpAddress, ushort RemotePort, ushort ConnectionTimeOut)
{
//Setup options
this.EnableAlarms = true;
@@ -137,7 +138,9 @@ namespace CMS_CORE_Library.S7Net
this.EnableAxes = false;
- //Setup timeout
+ // Setup parametri
+ Ip = IpAddress;
+ Port = RemotePort;
TimeoutConn = ConnectionTimeOut;
// mesasggi generici PLC
PlcMessages = new Dictionary();
@@ -146,6 +149,8 @@ namespace CMS_CORE_Library.S7Net
///
/// Instantiate The NC-Siemens Class
///
+ /// Remote Ip-Address of the Nc
+ /// Remote Port of the Nc
/// Send/Recieve timeout connection [mS]
/// Enable Axes Svc
/// Enable Alarms Svc
@@ -153,7 +158,7 @@ namespace CMS_CORE_Library.S7Net
/// Enable Modules Svc
/// Enable Parameters Svc
/// Enable Prod Svc
- public Nc_S7Net(ushort ConnectionTimeOut, bool EnableAxes, bool EnableAlarms, bool EnableHeaters, bool EnableModules, bool EnableParameters, bool EnableProd)
+ public Nc_S7Net(string IpAddress, ushort RemotePort, ushort ConnectionTimeOut, bool EnableAxes, bool EnableAlarms, bool EnableHeaters, bool EnableModules, bool EnableParameters, bool EnableProd)
{
//Setup options
this.EnableAlarms = EnableAlarms;
@@ -163,7 +168,9 @@ namespace CMS_CORE_Library.S7Net
this.EnableParameters = EnableParameters;
this.EnableProd = EnableProd;
- //Setup timeout
+ // Setup parametri
+ Ip = IpAddress;
+ Port = RemotePort;
TimeoutConn = ConnectionTimeOut;
// mesasggi generici PLC
PlcMessages = new Dictionary();