using Eplan.EplApi.Base; using Eplan.EplApi.Gui; using Eplan.EplApi.Scripting; using System.Collections.Generic; public class EPLAN_PersonalRibbon { public static string _ownTabName = "Netzschutz"; public static string _iconPath = @"\\Icons\SVG\"; [DeclareRegister] public void Register_EPLAN_PersonalRibbon() { this.CreateRibbon(); } [DeclareUnregister] public void UnRegister_EPLAN_PersonalRibbon() { this.RemoveRibbon(); } [DeclareEventHandler("Eplan.EplApi.OnMainStart")] public void EPLANStart() { //create Ribbon on EPLAN start this.CreateRibbon(); } [DeclareEventHandler("Eplan.EplApi.OnMainEnd")] public void EPLANEnd() { this.RemoveRibbon(); } public void RemoveRibbon() { var ownRibbonTab = new Eplan.EplApi.Gui.RibbonBar().GetTab(_ownTabName); if (ownRibbonTab != null) { foreach (var _commandGroup in ownRibbonTab.CommandGroups) { if (_commandGroup != null) { _commandGroup.Remove(); } } ownRibbonTab.Remove(); } } public void CreateRibbon() { this.RemoveRibbon(); var ribbonTab = new Eplan.EplApi.Gui.RibbonBar().AddTab(_ownTabName); RibbonCommandGroup BFG_Scripte = ribbonTab.AddCommandGroup("Scripte"); RibbonCommandGroup BFG_Klemmentyp = ribbonTab.AddCommandGroup("Klemmentyp"); RibbonCommandGroup BFG_Verbindung = ribbonTab.AddCommandGroup("Verbindung"); RibbonCommandGroup BFG_Querschnitt = ribbonTab.AddCommandGroup("Querschnitt"); //(Anzeigename, Action, Quickinfo, Beschreibung, Icon) BFG_Scripte.AddCommand("", "SelectScriptDlg", "Script ausführen", "Script ausführen", new RibbonIcon(CommandIcon.Rectangle_A)); BFG_Scripte.AddCommand("Scripte laden", "RegisterScriptDlg", new RibbonIcon(CommandIcon.Rectangle_L)); BFG_Scripte.AddCommand("Scripte entladen", "ApiScriptRegisteredScriptsDlgAction", new RibbonIcon(CommandIcon.Rectangle_E)); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"100\"", "100", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_100.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"105\"", "105", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_105.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"104\"", "104", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_104.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"121\"", "121", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_121.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"123\"", "123", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_123.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"120\"", "120", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_120.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"101\"", "101", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_101.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"103\"", "103", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_103.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"102\"", "102", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_102.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"106\"", "106", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_106.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"112\"", "112", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_112.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"113\"", "113", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_113.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"108\"", "108", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_108.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"110\"", "110", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_110.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"109\"", "190", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_109.svg")); BFG_Klemmentyp.AddCommand("", "XEsSetPropertyAction /PropertyId:20901 /PropertyIndex:11 /PropertyValue:\"136\"", "136", "Klemmentyp", new RibbonIcon(_iconPath + "Klemmentyp/SVG_200_Klemme_136.svg")); BFG_Verbindung.AddCommand("", "XGedStartInteractionAction /Name:XMIaInsertMacro /filename:\"_Netzschutz/Verbindungen/0_5_Farbe_STAWA1020_Ader_Draht.ems\" /variant:0", "0,5mm²", "neue Verbindung \n0,5mm² \nSTAWA1020 \nweiß", new RibbonIcon(_iconPath + "Farbe/SVG_200_0_5.svg")); BFG_Verbindung.AddCommand("", "XGedStartInteractionAction /Name:XMIaInsertMacro /filename:\"_Netzschutz/Verbindungen/1_0_Farbe_STAWA1001_Ader_Draht.ems\" /variant:0", "1,0mm²", "neue Verbindung \n1,0mm² \nSTAWA1001 \norange", new RibbonIcon(_iconPath + "Farbe/SVG_200_1_0.svg")); BFG_Verbindung.AddCommand("", "XGedStartInteractionAction /Name:XMIaInsertMacro /filename:\"_Netzschutz/Verbindungen/1_5_Farbe_STAWA1002_Ader_Draht.ems\" /variant:0", "1,5mm²", "neue Verbindung \n1,5mm² \nSTAWA1002 \nhellblau", new RibbonIcon(_iconPath + "Farbe/SVG_200_1_5.svg")); BFG_Verbindung.AddCommand("", "XGedStartInteractionAction /Name:XMIaInsertMacro /filename:\"_Netzschutz/Verbindungen/2_5_Farbe_STAWA1003_Ader_Draht.ems\" /variant:0", "2,5mm²", "neue Verbindung \n2,5mm² \nSTAWA1003 \nblau", new RibbonIcon(_iconPath + "Farbe/SVG_200_2_5.svg")); BFG_Verbindung.AddCommand("", "XGedStartInteractionAction /Name:XMIaInsertMacro /filename:\"_Netzschutz/Verbindungen/4_0_Farbe_STAWA1004_Ader_Draht.ems\" /variant:0", "4,0mm²", "neue Verbindung \n4,0mm² \nSTAWA1004 \ngrau", new RibbonIcon(_iconPath + "Farbe/SVG_200_4_0.svg")); BFG_Querschnitt.AddCommand("", "SetQuerEbenenFarbe /sQuerschnitt:\"0,5\" /sEbene:\"1020\"", "0,5mm²", "Ändere Querschnitt \n0,5mm² \nSTAWA1020 \nweiß", new RibbonIcon(_iconPath + "Farbe/SVG_200_0_5.svg")); BFG_Querschnitt.AddCommand("", "SetQuerEbenenFarbe /sQuerschnitt:\"0,5\" /sEbene:\"1001\"", "1,0mm²", "Ändere Querschnitt \n1,0mm² \nSTAWA1001 \norange", new RibbonIcon(_iconPath + "Farbe/SVG_200_1_0.svg")); BFG_Querschnitt.AddCommand("", "SetQuerEbenenFarbe /sQuerschnitt:\"0,5\" /sEbene:\"1002\"", "1,5mm²", "Ändere Querschnitt \n1,5mm² \nSTAWA1002 \nhellblau", new RibbonIcon(_iconPath + "Farbe/SVG_200_1_5.svg")); BFG_Querschnitt.AddCommand("", "SetQuerEbenenFarbe /sQuerschnitt:\"0,5\" /sEbene:\"1003\"", "2,5mm²", "Ändere Querschnitt \n2,5mm² \nSTAWA1003 \nblau", new RibbonIcon(_iconPath + "Farbe/SVG_200_2_5.svg")); BFG_Querschnitt.AddCommand("", "SetQuerEbenenFarbe /sQuerschnitt:\"0,5\" /sEbene:\"1004\"", "4,0mm²", "Ändere Querschnitt \n4,0mm² \nSTAWA1004 \ngrau", new RibbonIcon(_iconPath + "Farbe/SVG_200_4_0.svg")); } }