Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions DotNetSiemensPLCToolBoxLibrary.TIAV19/Step7ProjectV19Tia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Siemens.Engineering.SW.WatchAndForceTables;
using DotNetSiemensPLCToolBoxLibrary.Projectfiles.TIA.Openness;
using Siemens.Engineering.SW.Alarm;
using Siemens.Engineering.SW.Alarm.TextLists;

namespace DotNetSiemensPLCToolBoxLibrary.Projectfiles.V19
{
Expand Down Expand Up @@ -855,6 +856,39 @@ public override void ExportTextlists(ProjectFolder folder, string exportPath)
}
}

public override void ExportAlarmTexts(ProjectFolder folder, string exportPath)
{
foreach (var d in tiapProject.Devices)
{
if (d.TypeIdentifier != null && (d.TypeIdentifier.EndsWith(".S71500") || d.TypeIdentifier.EndsWith("ET200SP_OC")))
{
foreach (DeviceItem deviceItem in d.DeviceItems)
{
var parent = deviceItem.Parent;
var target = ((IEngineeringServiceProvider)deviceItem).GetService<SoftwareContainer>();
if (target != null && target.Software is PlcSoftware)
{
var plcSoftware = (PlcSoftware)target.Software;
var plcAarmTextsProvider = plcSoftware.GetService<PlcAlarmTextProvider>();
var plcAlarmTextsName = "PLC-Meldetexte";
var filePath = Path.Combine(exportPath, folder.Name, deviceItem.Name.Replace("-", ""), "plcalarms", plcAlarmTextsName) + ".xlsx";
var fileInfo = new FileInfo(filePath);
List<Language> cultureInfos = new List<Language>();

var directory = Path.GetDirectoryName(filePath);
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}

PlcAlarmTextXlsxResult result = plcAarmTextsProvider.ExportInstanceTextsToXlsx( fileInfo, cultureInfos, PlcAlarmTextXlsxExportOption.None);
var logFilePath = (FileInfo)result.LogFilePath;
}
}
}
}
}

internal void OpenViaOpennessDlls(Credentials credentials)
{
for (int i = 0; i < 10; i++)
Expand Down
4 changes: 4 additions & 0 deletions LibNoDaveConnectionLibrary/Projectfiles/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,9 @@ public virtual void ExportTextlists(ProjectFolder folder, string exportPath)
{
}

public virtual void ExportAlarmTexts(ProjectFolder folder, string exportPath)
{
}

}
}
7 changes: 4 additions & 3 deletions TiaGitHandler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static void Main(string[] args)

prj = Projects.AttachProject(ver);
exportPath = Path.GetDirectoryName(prj.ProjectFile);
exportPath = Path.GetFullPath(Path.Combine(exportPath, "..\\out\\Export"));
exportPath = Path.GetFullPath(Path.Combine(exportPath, "..\\Export"));
}
else
{
Expand Down Expand Up @@ -273,8 +273,9 @@ static void Main(string[] args)
Console.WriteLine("Exporting to Folder: " + exportPath);
Console.WriteLine();
List<string> skippedBlocksList = new List<string>();
ParseFolder(prj.ProjectStructure, exportPath, skippedBlocksList);
prj.ExportTextlists(prj.ProjectStructure, exportPath);
//ParseFolder(prj.ProjectStructure, exportPath, skippedBlocksList);
//prj.ExportTextlists(prj.ProjectStructure, exportPath);
prj.ExportAlarmTexts(prj.ProjectStructure, exportPath);

var xlsxFiles = Directory.GetFiles(exportPath, "*.xlsx", SearchOption.AllDirectories);
foreach (var xlsxFile in xlsxFiles.Where(x => x.Contains("plcalarmtextlistgroup")))
Expand Down
Loading