public bool ConnectToSW(object ThisSW, int cookie)
        {
            SwApp   = (ISldWorks)ThisSW;
            addinID = cookie;

            //Setup callbacks
            SwApp.SetAddinCallbackInfo(0, this, addinID);

            #region Setup the Command Manager

            CmdMgr = SwApp.GetCommandManager(cookie);
            AddCommandMgr();

            #endregion Setup the Command Manager

            #region Setup the Event Handlers

            SwEventPtr = (SldWorks)SwApp;
            OpenDocs   = new Hashtable();
            AttachEventHandlers();

            #endregion Setup the Event Handlers

            logger.Info("Connecting plugin to SolidWorks");
            return(true);
        }
        public bool ConnectToSW(object ThisSW, int cookie)
        {
            logger.Info("Attempting to connect to SW");
            SwApp      = (ISldWorks)ThisSW;
            add_in_id_ = cookie;

            //Setup callbacks
            logger.Info("Setting up callbacks");
            SwApp.SetAddinCallbackInfo(0, this, add_in_id_);

            #region Setup the Command Manager
            logger.Info("Setting up command manager");
            CmdMgr = SwApp.GetCommandManager(cookie);

            logger.Info("Adding command manager");
            AddCommandMgr();

            #endregion Setup the Command Manager

            #region Setup the Event Handlers
            logger.Info("Adding event handlers");
            SwEventPtr = (SldWorks)SwApp;
            OpenDocs   = new Hashtable();
            AttachEventHandlers();

            #endregion Setup the Event Handlers

            logger.Info("Connecting plugin to SolidWorks");
            return(true);
        }
        public bool ConnectToSW(object ThisSW, int cookie)
        {
            ConnectToSWPre();
            SwApp            = (SldWorks)ThisSW;
            addinID          = cookie;
            ActiveSolidWorks = this;

            //Setup callbacks
            SwApp.SetAddinCallbackInfo(0, this, addinID);

            #region Setup the Command Manager

            iCmdMgr = SwApp.GetCommandManager(cookie);

            ConnectToSWPost(SwApp);

            #endregion

            return(true);
        }
示例#4
0
        public bool ConnectToSW(object ThisSW, int cookie)
        {
            SwApp  = ThisSW as ISldWorks;
            Cookie = cookie;

            //Setup callbacks
            SwApp.SetAddinCallbackInfo(0, this, Cookie);

            CmdMgr = SwApp.GetCommandManager(this.Cookie);

            try
            {
                addUI();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                return(false);
            }

            return(true);
        }