public override void OnConnection(SolidEdgeFramework.SeConnectMode ConnectMode) { ComEventsManager = new ComEventsManager(this); // Prepend '\n' to the description to allow the addin to have its own Ribbon Tab. // Otherwise, addin commands will appear in the Add-Ins tab. AddInInstance.Description = $"\n{AddInInstance.Description}"; // If you makes changes to your ribbon, be sure to increment the GuiVersion. That makes bFirstTime = true // next time Solid Edge is started. bFirstTime is used to setup the ribbon so if you make a change but don't // see the changes, that could be why. AddInInstance.GuiVersion = 2; // Example of how to hide addin from the Add-In Manager GUI. //AddInInstance.Visible = false; // Connect to select COM events. // 1) Modify class to implement desired event interface(s). // 2) Attach to each event set via ComEventsManager.Attach(). ComEventsManager.Attach <SolidEdgeFramework.ISEAddInEventsEx>(AddInInstance); ComEventsManager.Attach <SolidEdgeFramework.ISEAddInEdgeBarEventsEx>(AddInInstance); ComEventsManager.Attach <SolidEdgeFramework.ISEApplicationEvents>(Application); // Solid Edge 2020 or higher. if (SolidEdgeVersion.Major >= 220) { ComEventsManager.Attach <SolidEdgeFramework.ISEAddInEventsEx2>(AddInInstance); ComEventsManager.Attach <SolidEdgeFramework.ISEApplicationEventsEx2>(Application); } My3dViewOverlay = new My3dViewOverlay(this); }
public override void OnDisconnection(SolidEdgeFramework.SeDisconnectMode DisconnectMode) { My3dViewOverlay?.Dispose(); My3dViewOverlay = null; // Disconnect from all COM events. ComEventsManager.DetachAll(); ComEventsManager = null; }