Skip to content

Commit 7e86dd8

Browse files
author
asemlucben
committed
Update README.md
1 parent 1e2c590 commit 7e86dd8

18 files changed

+372
-1
lines changed

ProjectFiles/ApplyDark.png

+3
Loading

ProjectFiles/CloseDark.png

+3
Loading

ProjectFiles/FTOptixLogo_cyan.svg

+59
Loading

ProjectFiles/Italy.svg

+1
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net6.0</TargetFramework>
4+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
5+
</PropertyGroup>
6+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
7+
<OutputPath>bin\</OutputPath>
8+
<NoWarn>1701;1702</NoWarn>
9+
</PropertyGroup>
10+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
11+
<OutputPath>bin\</OutputPath>
12+
<NoWarn>1701;1702</NoWarn>
13+
</PropertyGroup>
14+
<PropertyGroup>
15+
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
16+
</PropertyGroup>
17+
<Import Project="Training_NetLogicDesignTime.references"/>
18+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio 15
3+
VisualStudioVersion = 15.0.28307.106
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Training_NetLogicDesignTime", "Training_NetLogicDesignTime.csproj", "{8C155753-C759-8163-FE8C-4F905547992C}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{8C155753-C759-8163-FE8C-4F905547992C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{8C155753-C759-8163-FE8C-4F905547992C}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{8C155753-C759-8163-FE8C-4F905547992C}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{8C155753-C759-8163-FE8C-4F905547992C}.Release|Any CPU.Build.0 = Release|Any CPU
17+
EndGlobalSection
18+
GlobalSection(SolutionProperties) = preSolution
19+
HideSolutionNode = FALSE
20+
EndGlobalSection
21+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#region Using directives
2+
using System;
3+
using UAManagedCore;
4+
using OpcUa = UAManagedCore.OpcUa;
5+
using FTOptix.HMIProject;
6+
using FTOptix.NativeUI;
7+
using FTOptix.UI;
8+
using FTOptix.Core;
9+
using FTOptix.CoreBase;
10+
using FTOptix.NetLogic;
11+
#endregion
12+
13+
public class _1_Create_Simple_Variables : BaseNetLogic
14+
{
15+
[ExportMethod]
16+
public void CreateVariables()
17+
{
18+
var myFolder = Project.Current.Get<Folder>("Model/Variables");
19+
if (myFolder != null)
20+
{
21+
myFolder.Delete();
22+
}
23+
myFolder = InformationModel.Make<Folder>("Variables");
24+
Project.Current.Get("Model").Add(myFolder);
25+
for (int i = 1; i <= 3; i++)
26+
{
27+
var myVar = InformationModel.MakeVariable("Variable" + i, OpcUa.DataTypes.UInt16);
28+
myFolder.Add(myVar);
29+
}
30+
}
31+
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#region Using directives
2+
using System;
3+
using UAManagedCore;
4+
using OpcUa = UAManagedCore.OpcUa;
5+
using FTOptix.HMIProject;
6+
using FTOptix.NativeUI;
7+
using FTOptix.UI;
8+
using FTOptix.Core;
9+
using FTOptix.CoreBase;
10+
using FTOptix.NetLogic;
11+
#endregion
12+
13+
public class _2_Create_Motor_Type : BaseNetLogic
14+
{
15+
[ExportMethod]
16+
public void CreateMotorType()
17+
{
18+
var motorType = InformationModel.MakeObjectType("MotorType");
19+
var speed = InformationModel.MakeVariable("Speed", OpcUa.DataTypes.UInt16);
20+
var running = InformationModel.MakeVariable("Running", OpcUa.DataTypes.Boolean);
21+
motorType.Add(speed);
22+
motorType.Add(running);
23+
Project.Current.Get("Model").Add(motorType);
24+
}
25+
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#region Using directives
2+
using System;
3+
using UAManagedCore;
4+
using OpcUa = UAManagedCore.OpcUa;
5+
using FTOptix.HMIProject;
6+
using FTOptix.NativeUI;
7+
using FTOptix.UI;
8+
using FTOptix.Core;
9+
using FTOptix.CoreBase;
10+
using FTOptix.NetLogic;
11+
#endregion
12+
13+
public class _3_Create_Motor_Instances : BaseNetLogic
14+
{
15+
[ExportMethod]
16+
public void CreateMotorInstances()
17+
{
18+
var motorInstancesFolder = InformationModel.Make<Folder>("MotorInstances");
19+
Project.Current.Get("Model").Add(motorInstancesFolder);
20+
for (int i = 1; i <= 3; i++)
21+
{
22+
var motorType = Project.Current.Get("Model/MotorType");
23+
var motorInstance = InformationModel.MakeObject("Motor" + i, motorType.NodeId);
24+
motorInstancesFolder.Add(motorInstance);
25+
}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#region Using directives
2+
using System;
3+
using UAManagedCore;
4+
using OpcUa = UAManagedCore.OpcUa;
5+
using FTOptix.HMIProject;
6+
using FTOptix.NativeUI;
7+
using FTOptix.UI;
8+
using FTOptix.Core;
9+
using FTOptix.CoreBase;
10+
using FTOptix.NetLogic;
11+
#endregion
12+
13+
public class _4_Create_Motor_Widget_Instances : BaseNetLogic
14+
{
15+
[ExportMethod]
16+
public void CreateMotorWidgetInstances()
17+
{
18+
// NOTE: the "MotorWidget" type with "MotorAlias" alias,
19+
// must be already available at UI/Widgets
20+
for (int i = 1; i <= 3; i++)
21+
{
22+
var motorWidgetType = Project.Current.Get("UI/Widgets/MotorWidget");
23+
var motorWidgetInstance = InformationModel.MakeObject("MotorWidget" + i, motorWidgetType.NodeId);
24+
Project.Current.Get("UI/MainWindow").Children.Add(motorWidgetInstance);
25+
26+
var motorWidget = Project.Current.Get<Panel>("UI/MainWindow/MotorWidget" + i);
27+
motorWidget.SetAlias("MotorAlias", Project.Current.Get("Model/MotorInstances/Motor" + i));
28+
motorWidget.LeftMargin = (motorWidget.Width + 5) * (i - 1);
29+
motorWidget.TopMargin = 150;
30+
}
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#region Using directives
2+
using System;
3+
using UAManagedCore;
4+
using OpcUa = UAManagedCore.OpcUa;
5+
using FTOptix.HMIProject;
6+
using FTOptix.NativeUI;
7+
using FTOptix.UI;
8+
using FTOptix.Core;
9+
using FTOptix.CoreBase;
10+
using FTOptix.NetLogic;
11+
#endregion
12+
13+
public class _5_Script_Parameters : BaseNetLogic
14+
{
15+
[ExportMethod]
16+
public void ReadParameters()
17+
{
18+
string varName = LogicObject.GetVariable("Variable_Name").Value;
19+
string folderName = LogicObject.GetVariable("Folder_Name").Value;
20+
Log.Info(LogicObject.BrowseName, "Variable_Name = " + varName);
21+
Log.Info(LogicObject.BrowseName, "Folder_Name = " + folderName);
22+
}
23+
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#region Using directives
2+
using System;
3+
using UAManagedCore;
4+
using OpcUa = UAManagedCore.OpcUa;
5+
using FTOptix.HMIProject;
6+
using FTOptix.NativeUI;
7+
using FTOptix.UI;
8+
using FTOptix.NetLogic;
9+
using FTOptix.CoreBase;
10+
using FTOptix.Core;
11+
using System.Linq;
12+
#endregion
13+
14+
public class _6_Cleanup_Project : BaseNetLogic
15+
{
16+
[ExportMethod]
17+
public void DeleteModelVariables()
18+
{
19+
//Clear MotorInstances in MotorInstances folder
20+
if (Project.Current.Get("Model/MotorInstances") != null)
21+
Project.Current.Get("Model/MotorInstances").Children.Clear();
22+
23+
//Clear all variables in Model Folder
24+
Project.Current.Get("Model").Children.Clear();
25+
26+
//Clear all MotorWidgets in MainWindow page
27+
var panel = Project.Current.Get("UI/MainWindow").Children.OfType<Panel>();
28+
foreach (var widget in panel)
29+
widget.Delete();
30+
}
31+
}
+3
Loading

ProjectFiles/Notification-red@3x.png

+3
Loading

ProjectFiles/RadiobuttonDark.svg

+12
Loading

ProjectFiles/RadiobuttonDarkEmpty.svg

+69
Loading
Loading

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ NetLogic(s) are bits of C# code that can be used to trigger custom operations, D
44

55
## Usage
66

7-
Expand the NetLogic folder and right click on one of the NetLogic to trigger the custom script
7+
Expand the NetLogic folder and right click on one of the NetLogic to trigger the custom script
8+
9+
## Disclaimer
10+
11+
Rockwell Automation maintains these repositories as a convenience to you and other users. Although Rockwell Automation reserves the right at any time and for any reason to refuse access to edit or remove content from this Repository, you acknowledge and agree to accept sole responsibility and liability for any Repository content posted, transmitted, downloaded, or used by you. Rockwell Automation has no obligation to monitor or update Repository content
12+
13+
The examples provided are to be used as a reference for building your own application and should not be used in production as-is. It is recommended to adapt the example for the purpose, observing the highest safety standards

0 commit comments

Comments
 (0)