예제 #1
0
        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);
        }
예제 #2
0
        private void MyEdgeBarControl_Load(object sender, EventArgs e)
        {
            // Trick to use the default system font.
            Font = SystemFonts.MessageBoxFont;

            ComEventsManager = new ComEventsManager(this);
        }
예제 #3
0
        public My3dViewOverlay(SolidEdgeAddIn solidEdgeAddIn)
        {
            SolidEdgeAddIn   = solidEdgeAddIn;
            ComEventsManager = new ComEventsManager(this);

            // Set the defaults.
            BoundingBoxInfo.LineColor = Color.Yellow;
            BoundingBoxInfo.LineWidth = 2f;
        }
예제 #4
0
        public override void OnDisconnection(SolidEdgeFramework.SeDisconnectMode DisconnectMode)
        {
            My3dViewOverlay?.Dispose();
            My3dViewOverlay = null;

            // Disconnect from all COM events.
            ComEventsManager.DetachAll();
            ComEventsManager = null;
        }
예제 #5
0
        void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                    ComEventsManager.DetachAll();
                }

                IsDisposed = true;
            }
        }
예제 #6
0
 void ISEDocumentEvents.BeforeClose()
 {
     ComEventsManager.DetachAll();
 }