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);
        }
Exemplo n.º 3
0
        public bool ConnectToSW(object thisSw, int cookie)
        {
            SwApp = (SldWorks)thisSw;

            Active = this;

            SwApp.SetAddinCallbackInfo2(0, this, cookie);

            CommandManager = SwApp.GetCommandManager(cookie);

            _Bmp = new BitmapHandler();
            AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;
            var d0 = Disposable.Create(() => AppDomain.CurrentDomain.AssemblyResolve -= ResolveAssembly);
            var d1 = OpenGlRenderer.Setup((SldWorks)SwApp);
            var d2 = new CompositeDisposable(Setup());

            _Disposable = new CompositeDisposable(_Bmp, d0, d1, d2);

            return(true);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
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);
        }