Пример #1
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.

            CWebServicesManager mgr = new CWebServicesManager();
            bool isInitialized      = mgr.Initialize();

            if (isInitialized)
            {
                try
                {
                    m_inventorApplication.Login();
                    string userId = "";
                    mgr.GetUserId(ref userId);
                    string userName = "";
                    mgr.GetLoginUserName(ref userName);
                    MsgBox.Show(
                        "User ID = '" + userId + "\n" +
                        "User Name = '" + userName + "'");
                }
                catch (Exception ex)
                {
                    MsgBox.Show(ex.Message);
                }
            }
        }
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.
            // Connect to the user-interface events to handle a ribbon reset.

            {
                m_uiEvents = m_inventorApplication.UserInterfaceManager.UserInterfaceEvents;
                m_uiEvents.OnResetRibbonInterface += m_uiEvents_OnResetRibbonInterface;

                stdole.IPictureDisp         largeIcon   = PictureDispConverter.ToIPictureDisp(InvAddIn.Resource1.Large);
                stdole.IPictureDisp         smallIcon   = PictureDispConverter.ToIPictureDisp(InvAddIn.Resource1.Small);
                Inventor.ControlDefinitions controlDefs = m_inventorApplication.CommandManager.ControlDefinitions;
                m_sampleButton1            = controlDefs.AddButtonDefinition("License check", "Entitlement API", CommandTypesEnum.kShapeEditCmdType, AddInClientID(), "Entitlement api", "Entitlement api", smallIcon, largeIcon);
                m_sampleButton1.OnExecute += m_sampleButton1_OnExecute;

                // Add to the user interface, if it's the first time.
                if (firstTime)
                {
                    AddToUserInterface();
                }
            }
        }
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.

            var_es.InventorApp = addInSiteObject.Application;
            try
            {
                var_es.Get_addInClassId(this.GetType());
                Icon iconSmall = new Icon("logoSmall.ico");
                Icon iconLarge = new Icon("logoLarge.ico");


                //MessageBox.Show("Test addIn say: \"Hello\" to you!!! " +  var_es._ClientId);

                button = new addInButtonDefinition("Shaft", "\"Shaft\" is a simple plug-in to work with shaft`s angles", "ShaftButton_" + Guid.NewGuid().ToString(), "Simple plug-in to work with axel`s angels", iconSmall, iconLarge, CommandTypesEnum.kShapeEditCmdType);

                if (firstTime)
                {
                    UserInterfaceCreate();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.
        }
        public FeatureMigratorDockWnd(
            Inventor.ApplicationAddInSite addInSite,
            Inventor.DockingStateEnum initialDockingState)
        {
            if (addInSite == null) // We can't build the dockable window without the add-in site object.
            {
                throw new ArgumentNullException("addInSite");
            }

            _addInSite = addInSite;

            _applicationEvents = addInSite.Application.ApplicationEvents;

            _applicationEvents.OnActivateDocument += ApplicationEvents_OnActivateDocument;

            _applicationEvents.OnCloseDocument += _applicationEvents_OnCloseDocument;

            InitializeComponent();

            _browserControl.Initialize();

            _browserControl.RefreshControl(addInSite.Application.ActiveDocument);

            // Make sure the components object is created. (The designer doesn't always create it.)
            if (components == null)
            {
                components = new Container();
            }

            // Create the DockableWindow using a managed wrapper and add it to the components collection.
            components.Add(
                new DockableWindowWrapper(addInSite, this, initialDockingState),
                typeof(DockableWindowWrapper).Name);
        }
Пример #5
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // Connect to AMEE and make a profile
            AMEE.Connection.Instance().Connect("AMEEMaterials.Resources.AMEE.xml");
            m_AMEEProfile = new AMEE.Profile();
            try
            {
                ConfigureButtons();
                m_summaryForm = new CarbonSummaryForm();
                if (firstTime == true)
                {
                    ConfigureRibbon();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            m_inventorApplication.ApplicationEvents.OnOpenDocument   += new ApplicationEventsSink_OnOpenDocumentEventHandler(ApplicationEvents_OnOpenDocument);
            m_inventorApplication.ApplicationEvents.OnDocumentChange += new ApplicationEventsSink_OnDocumentChangeEventHandler(ApplicationEvents_OnDocumentChange);
        }
Пример #6
0
        /// <summary>
        ///  This method is called by Inventor when it loads the addin.
        ///  The AddInSiteObject provides access to the Inventor Application object.
        ///  The FirstTime flag indicates if the addin is loaded for the first time.
        /// </summary>
        /// <param name="addInSiteObject"></param>
        /// <param name="firstTime"></param>
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            try
            {
                InventorApplication = addInSiteObject.Application;

                //retrieve the GUID for this class and assign it to the string member variable
                //intended to hold it
                GuidAttribute addInClsid = (GuidAttribute)Attribute.GetCustomAttribute
                                               (typeof(StandardAddInServer), typeof(GuidAttribute));
                string addInClsidString = "{" + addInClsid.Value + "}";
                AddInServerId = addInClsidString;

                //Set a reference to the user interface manager to determine the interface style
                UserInterfaceManager userInterfaceManager = InventorApplication.UserInterfaceManager;
                InterfaceStyleEnum   interfaceStyle       = userInterfaceManager.InterfaceStyle;

                RectangleDependencyManager = new RectangleToolsDependencyMapper();

                if (interfaceStyle == InterfaceStyleEnum.kRibbonInterface)
                {
                    if (firstTime == true)
                    {
                        RectangleDependencyManager.InitializeUserInterface();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Пример #7
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            ControlDefinitions controlDefs = m_inventorApplication.CommandManager.ControlDefinitions;

            // Create Icons
            buildIcons();

            // Create button objects
            m_CrosswireBasketButton = controlDefs.AddButtonDefinition("Crosswire\nBasket", "Crosswire Basket Design Template", CommandTypesEnum.kShapeEditCmdType, addInGUID, "Generate a crosswire basket 3D model and\nengineering drawing using a template.",
                                                                      "Crosswire Basket Design Template", smallCWBasketDisp, largeCWBasketDisp);
            m_MeshBasketButton = controlDefs.AddButtonDefinition("Mesh\nBasket", "Mesh Basket Design Template", CommandTypesEnum.kShapeEditCmdType, addInGUID, "Generate a mesh basket 3D model and\nengineering drawing using a template.",
                                                                 "Mesh Basket Design Template", smallMeshBasketDisp, largeMeshBasketDisp);

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.

            if (firstTime)
            {
                try
                {
                    if (m_inventorApplication.UserInterfaceManager.InterfaceStyle == InterfaceStyleEnum.kRibbonInterface)
                    {
                        try
                        {
                            buildCustomInterface();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                    }
                    else
                    {
                        // For classic interface, possibly incorrect code
                        CommandBar oCommandBar = m_inventorApplication.UserInterfaceManager.CommandBars["ZeroDoc"];
                        oCommandBar.Controls.AddButton(m_CrosswireBasketButton, 0);
                        oCommandBar.Controls.AddButton(m_MeshBasketButton, 0);
                    }
                }
                catch
                {
                    // For classic interface, possibly incorrect code
                    CommandBar oCommandBar = m_inventorApplication.UserInterfaceManager.CommandBars["ZeroDoc"];
                    oCommandBar.Controls.AddButton(m_CrosswireBasketButton, 0);
                    oCommandBar.Controls.AddButton(m_MeshBasketButton, 0);
                }
            }

            m_CrosswireBasketButton.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(m_CrosswireBasketButton_OnExecute);
            m_MeshBasketButton.OnExecute      += new ButtonDefinitionSink_OnExecuteEventHandler(m_MeshBasketButton_OnExecute);
        }
Пример #8
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            m_inventorApplication = addInSiteObject.Application;

            m_buttonDefinition = m_inventorApplication.CommandManager.ControlDefinitions.AddButtonDefinition(
                "Reference Key Manager", "Adam.ReferenceKeyManager", CommandTypesEnum.kNonShapeEditCmdType);
            m_buttonDefinition.AutoAddToGUI();
            m_buttonDefinition.OnExecute += M_buttonDefinition_OnExecute;
        }
Пример #9
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            _addInSiteObject = addInSiteObject;

            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            _Application = addInSiteObject.Application;

            AdnInventorUtilities.Initialize(_Application, this.GetType());

            ControlDefinitions ctrlDefs =
                _Application.CommandManager.ControlDefinitions;

            System.Drawing.Icon Icon32 = Resources.CGAUDemo_32x32;
            System.Drawing.Icon Icon16 = Resources.CGAUDemo_16x16;

            object IPictureDisp32 = PictureDispConverter.ToIPictureDisp(Icon32);
            object IPictureDisp16 = PictureDispConverter.ToIPictureDisp(Icon16);

            try
            {
                _MainControlButtonDef =
                    ctrlDefs["Autodesk:AdskCGAUDemo:MainCtrl"] as ButtonDefinition;
            }
            catch
            {
                _MainControlButtonDef =
                    ctrlDefs.AddButtonDefinition(
                        "   Demo   \n   Control   ",
                        "Autodesk:AdskCGAUDemo:MainCtrl",
                        CommandTypesEnum.kEditMaskCmdType,
                        AdnInventorUtilities.AddInGuid,
                        "Client Graphics Demo AU",
                        "Client Graphics Demo AU",
                        IPictureDisp16,
                        IPictureDisp32,
                        ButtonDisplayEnum.kDisplayTextInLearningMode);
            }

            _MainControlButtonDef.OnExecute +=
                new ButtonDefinitionSink_OnExecuteEventHandler(MainControlButtonDef_OnExecute);

            if (firstTime)
            {
                Ribbon partRibbon = _Application.UserInterfaceManager.Ribbons["Part"];
                Ribbon asmRibbon  = _Application.UserInterfaceManager.Ribbons["Assembly"];
                Ribbon dwgRibbon  = _Application.UserInterfaceManager.Ribbons["Drawing"];

                AddToRibbon(partRibbon, AdnInventorUtilities.AddInGuid);
                AddToRibbon(asmRibbon, AdnInventorUtilities.AddInGuid);
                AddToRibbon(dwgRibbon, AdnInventorUtilities.AddInGuid);
            }
        }
Пример #10
0
            /// <summary>Initializes the <see cref="DockableWindowWrapper"/>.</summary>
            /// <param name="addInSite">The ApplicationAddInSite object supplied by Inventor.</param>
            /// <param name="form">The managed form to add to the DockableWindow.</param>
            /// <param name="initialDockingState">The initial docking state of the DockableWindow
            /// if it is created for the first time.</param>
            internal DockableWindowWrapper(
                Inventor.ApplicationAddInSite addInSite,
                Form form,
                Inventor.DockingStateEnum initialDockingState)
            {
                System.Diagnostics.Debug.Assert(addInSite != null && form != null);

                _form = form;

                // Set up the parameters.
                string clientId     = addInSite.Parent.ClientId;
                string internalName = _form.GetType().FullName + "." + form.Name;
                string title        = _form.Text;

                // We don't want the border to show since the form will be docked inside the DockableWindow.
                _form.FormBorderStyle = FormBorderStyle.None;

                // Retrieve or create the dockable window.
                try
                {
                    dockableWindow = addInSite.Application.UserInterfaceManager.DockableWindows[internalName];
                }
                catch
                {
                    dockableWindow = addInSite.Application.UserInterfaceManager.DockableWindows.Add(
                        clientId,
                        internalName,
                        title);
                }

                // Set the minimum size of the dockable window.
                System.Drawing.Size minimumSize = form.MinimumSize;
                if (!minimumSize.IsEmpty)
                {
                    dockableWindow.SetMinimumSize(minimumSize.Height, minimumSize.Width);
                }

                // Set the initial docking state of the DockableWindow if it is not remembered by Inventor.
                if (initialDockingState != default(Inventor.DockingStateEnum)) // && !dockableWindow.IsCustomized)
                {
                    dockableWindow.DockingState = initialDockingState;
                }

                // Set initial state to invisible.
                dockableWindow.Visible = false;

                // Listen for events.
                _form.HandleCreated  += new EventHandler(OnHandleCreated);
                _form.VisibleChanged += new EventHandler(OnVisibleChanged);

                _dockableWindowsEvents =
                    addInSite.Application.UserInterfaceManager.DockableWindows.Events;

                _dockableWindowsEvents.OnHide +=
                    new DockableWindowsEventsSink_OnHideEventHandler(DockableWindowsEvents_OnHide);
            }
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            //Create dock able window
            dockableWindow = m_inventorApplication.UserInterfaceManager.DockableWindows.Add(ClientId,
                                                                                            "docable_window.StandardAddInServer.dockableWindow", "Example");
            dockableWindow.ShowVisibilityCheckBox = true;
        }
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            inventor = addInSiteObject.Application;


            inventor.ApplicationEvents.OnDocumentChange += onChange;
            inventor.ApplicationEvents.OnSaveDocument   += onSaving;
            inventor.ApplicationEvents.OnCloseDocument  += onClosing;
            inventor.ApplicationEvents.OnOpenDocument   += onOpen;
        }
Пример #13
0
            public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
            {
                m_inventorApplication = addInSiteObject.Application;

                m_ApplicationEvents = m_inventorApplication.ApplicationEvents;
                m_ApplicationEvents.OnOpenDocument += this.m_ApplicationEvents_OnOpenDocument;

                mControlForm = new Form1(m_inventorApplication);
                mControlForm.ShowModeless();
            }
Пример #14
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            mInventorApp      = addInSiteObject.Application;
            mRubiksCubePlugin = new RubikPlugin.RubikCubePlugin(mInventorApp);
            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.
        }
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.

            int largeIconSize = 0;

            if (m_inventorApplication.UserInterfaceManager.InterfaceStyle == InterfaceStyleEnum.kRibbonInterface)
            {
                largeIconSize = 32;
            }
            else
            {
                largeIconSize = 24;
            }

            ControlDefinitions controlDefs = m_inventorApplication.CommandManager.ControlDefinitions;

            stdole.IPictureDisp smallPicture1 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon1.ico").ToBitmap());
            stdole.IPictureDisp largePicture1 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon1.ico").ToBitmap());
            m_TreeViewBrowser            = controlDefs.AddButtonDefinition("HierarchyPane", "BrowserSample:HierarchyPane", CommandTypesEnum.kNonShapeEditCmdType, m_ClientId, null, null, smallPicture1, largePicture1);
            m_TreeViewBrowser.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(m_TreeViewBrowser_OnExecute);



            stdole.IPictureDisp smallPicture2 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon2.ico").ToBitmap());
            stdole.IPictureDisp largePicture2 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon2.ico").ToBitmap());
            m_ActiveXBrowser            = controlDefs.AddButtonDefinition("ActiveXPane", "BrowserSample:ActiveXPane", CommandTypesEnum.kNonShapeEditCmdType, m_ClientId, null, null, smallPicture2, largePicture2);
            m_ActiveXBrowser.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(m_ActiveXBrowser_OnExecute);

            stdole.IPictureDisp smallPicture3 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon3.ico").ToBitmap());
            stdole.IPictureDisp largePicture3 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon3.ico").ToBitmap());
            m_DoBrowserEvents            = controlDefs.AddButtonDefinition("DoBrowserEvents", "BrowserSample:DoBrowserEvents", CommandTypesEnum.kNonShapeEditCmdType, m_ClientId, null, null, smallPicture3, largePicture3);
            m_DoBrowserEvents.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(m_DoBrowserEvents_OnExecute);


            // Get the assembly ribbon.
            Inventor.Ribbon partRibbon = m_inventorApplication.UserInterfaceManager.Ribbons["Part"];
            // Get the "Part" tab.
            Inventor.RibbonTab   partTab   = partRibbon.RibbonTabs[1];
            Inventor.RibbonPanel partPanel = partTab.RibbonPanels[1];
            partPanel.CommandControls.AddButton(m_TreeViewBrowser, true);
            partPanel.CommandControls.AddButton(m_DoBrowserEvents);
            partPanel.CommandControls.AddButton(m_ActiveXBrowser);
        }
Пример #16
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.
            System.Windows.Forms.MessageBox.Show("I am loaded!!", "Hello World AddIn");
        }
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.
            var cmdMgr = m_inventorApplication.CommandManager;

            m_btnDef = cmdMgr.ControlDefinitions.AddButtonDefinition(
                "Show URDF converter", "Show URDF converter", CommandTypesEnum.kQueryOnlyCmdType);
            m_btnDef.OnExecute += CtrlDef_OnExecute;

            Inventor.Ribbons ribbons;
            ribbons = m_inventorApplication.UserInterfaceManager.Ribbons;

            Inventor.Ribbon partRibbon;
            partRibbon = ribbons["Assembly"]; //replace with Assembly for final version

            //get the tabls associated with part ribbon
            RibbonTabs ribbonTabs;

            ribbonTabs = partRibbon.RibbonTabs;

            RibbonTab partSketchRibbonTab;

            partSketchRibbonTab = ribbonTabs.Add("URDF", "id_URDF", "{880b4435-f9c2-4c5e-b234-d543a20b5c36}");// ["id_TabSketch"];

            //create a new panel with the tab
            RibbonPanels ribbonPanels;

            ribbonPanels = partSketchRibbonTab.RibbonPanels;

            m_partSketchSlotRibbonPanel = ribbonPanels.Add("URDF", "Autodesk:URDFConverter:SlotRibbonPanel", "{880b4435-f9c2-4c5e-b234-d543a20b5c36}", "", false);

            //add controls to the slot panel
            CommandControls partSketchSlotRibbonPanelCtrls;

            partSketchSlotRibbonPanelCtrls = m_partSketchSlotRibbonPanel.CommandControls;

            //add the buttons to the ribbon panel
            CommandControl drawSlotCmdBtnCmdCtrl;

            drawSlotCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_btnDef, false, true, "", false);

            //CtrlDef_OnExecute(null);
        }
Пример #18
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            //m_inventorApplication = addInSiteObject.Application;
            m_inventorServer = addInSiteObject.InventorServer;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.
            m_commands = new Commands(m_inventorServer);
        }
Пример #19
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            //MASSIF NOTES: Probably best not to put license checks here, otherwise you might slow down the Inventor startup.

            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            //Create some UI
            Ribbon      partRibbon  = m_inventorApplication.UserInterfaceManager.Ribbons["ZeroDoc"];
            RibbonTab   massifTab   = partRibbon.RibbonTabs.Add("Massif SDK", "MASSIF_TAB_SAMPLE", Guid.NewGuid().ToString());
            RibbonPanel massifPanel = massifTab.RibbonPanels.Add("Massif Sample Tool", "PNL_MASSIF_SAMPLE", Guid.NewGuid().ToString());

            //Add a control definition for a button
            ControlDefinitions controlDefs = m_inventorApplication.CommandManager.ControlDefinitions;

            //Sort out the icon
            var btnImage = Properties.Resources.MassifIcon;

            stdole.IPictureDisp iPictDisp = PictureDispConverter.ToIPictureDisp(btnImage);

            //Create button definition
            runBtnDef = controlDefs.AddButtonDefinition("Run Test",
                                                        "{6C426CFE-E9BC-44CB-8B46-F2D4BDE05AE6}",
                                                        CommandTypesEnum.kQueryOnlyCmdType,
                                                        "573e1c9f-6fa9-4799-9afc-c4f0ad2b9d44",
                                                        "Test Massif licensing",
                                                        "Click to check that you have a license to run this addin.",
                                                        iPictDisp,
                                                        iPictDisp,
                                                        ButtonDisplayEnum.kDisplayTextInLearningMode
                                                        );

            //Add button to panel
            CommandControl startControl = massifPanel.CommandControls.AddButton(runBtnDef, true, true);

            uiEvents = m_inventorApplication.UserInterfaceManager.UserInterfaceEvents;

            try
            {
                runBtnDef.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(RunBtnDef_OnExecute);
            }

            catch
            {
            }
        }
Пример #20
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.
            m_appEvents = m_inventorApplication.ApplicationEvents;
            m_appEvents.OnActivateDocument += new ApplicationEventsSink_OnActivateDocumentEventHandler(ApplicationEvents_OnActivateDocument);
        }
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            mApp = addInSiteObject.Application;

            // Create a button and connect it to the CreateMesh method.
            var ribbon = mApp.UserInterfaceManager.Ribbons["Part"];
            var tab    = ribbon.RibbonTabs["id_TabTools"];
            var panel  = tab.RibbonPanels.Add("Update", "ToolsTabUpdatePanel", "SampleClientId", "id_PanelP_ToolsMeasure");

            var cd = mApp.CommandManager.ControlDefinitions;

            mButton = cd.AddButtonDefinition("TestMesh", "TestMesh", CommandTypesEnum.kShapeEditCmdType,
                                             null, "TestMesh", "TestMesh", null, null);

            panel.CommandControls.AddButton(mButton);
            mButton.OnExecute += CreateMesh;
        }
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.
            var cmdMgr = m_inventorApplication.CommandManager;

            m_btnDef = cmdMgr.ControlDefinitions.AddButtonDefinition(
                "ShowWpfDialog", "ShowWpfDialog", CommandTypesEnum.kQueryOnlyCmdType);
            m_btnDef.OnExecute += ctrlDef_OnExecute;
            m_btnDef.AutoAddToGUI();
        }
Пример #23
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.

            // Get a reference to the UserInterfaceManager object.
            Inventor.UserInterfaceManager UIManager = m_inventorApplication.UserInterfaceManager;

            // Get a reference to the ControlDefinitions object.
            ControlDefinitions controlDefs = m_inventorApplication.CommandManager.ControlDefinitions;

            // Get the images from the resources.  They are stored as .Net images and the
            // PictureConverter class is used to convert them to IPictureDisp objects, which
            // the Inventor API requires.
            stdole.IPictureDisp icon_large = PictureConverter.ImageToPictureDisp(Properties.Resources.ribbon_icon);
            stdole.IPictureDisp icon_small = PictureConverter.ImageToPictureDisp(Properties.Resources.icon16);

            // Create the button definition.
            m_buttonDef = controlDefs.AddButtonDefinition("Tabs", "UIRibbonSampleOne",
                                                          CommandTypesEnum.kNonShapeEditCmdType,
                                                          "{0defbf22-e302-4266-9bc9-fb80d5c8eb7e}", "", "", icon_small, icon_large);

            // Call the function to add information to the user-interface.
            if (firstTime)
            {
                CreateUserInterface();
                //PrintRibbonNames();
            }

            // Connect to UI events to be able to handle a UI reset.
            m_uiEvents = m_inventorApplication.UserInterfaceManager.UserInterfaceEvents;
            m_uiEvents.OnResetRibbonInterface += m_uiEvents_OnResetRibbonInterface;

            m_buttonDef.OnExecute += m_buttonDef_OnExecute;
        }
Пример #24
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            inventor = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.
            selectionInfoWnd = inventor.UserInterfaceManager.DockableWindows.Add(ClientId,
                                                                                 "SelectionInfo.StandardAddInServer.selectionInfoWnd", "Selection");

            selectionPropertyGrid = new PropertyGrid();
            selectionInfoWnd.AddChild(selectionPropertyGrid.Handle);

            selectionInfoWnd.ShowVisibilityCheckBox = true;

            inventor.CommandManager.UserInputEvents.OnSelect += UserInputEvents_OnSelect;
        }
Пример #25
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            try
            {
                //the Activate method is called by Inventor when it loads the addin
                //the AddInSiteObject provides access to the Inventor Application object
                //the FirstTime flag indicates if the addin is loaded for the first time

                //initialize AddIn members
                m_inventorApplication = addInSiteObject.Application;

                // Initialize the UI components
                m_turnBlueUI = new TurnBlueUI();
                m_turnBlueUI.InitUI(this, firstTime, m_inventorApplication);

                MessageBox.Show("Turn Blue Add-in enabled");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Пример #26
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.

            // Initialize add-in model
            model   = new SettingsModel();
            handler = new InventorHandler(m_inventorApplication, model);

            // get icon objects
            getIcons();

            // modify the ribbon
            modifyRibbon();
        }
Пример #27
0
        public void Activate(Inventor.ApplicationAddInSite AddInSiteObject, bool FirstTime)
        {
            Inventor = AddInSiteObject.Application;
            UserInterfaceEvents.OnResetCommandBars     += OnResetCommandBars;
            UserInterfaceEvents.OnEnvironmentChange    += OnEnvironmentChange;
            UserInterfaceEvents.OnResetRibbonInterface += OnResetRibbonInterface;

            try
            {
                _createTopAndLeftViewButton        = new CreateTopAndLeftProjectedViewsButton();
                _createPartViewsFromAssemblyButton = new CreatePartViewsFromAssemblyButton();
                _exportPdfButton = new ExportPdfButton();
                _generateSheetMetalDrawingsButton  = new GenerateSheetMetalDrawingsButton();
                _generateMdfDrawingsButton         = new GenerateMdfDrawingsButton();
                _generateSubAssemblyDrawingsButton = new GenerateSubassemblyDrawingsButton();

                if (FirstTime == true)
                {
                    if (UserInterfaceManager.InterfaceStyle == InterfaceStyleEnum.kClassicInterface)
                    {
                        //// Create a new command bar
                        //var slotCommandBar = Runtime.UserInterfaceManager.CommandBars.Add("Slot", "Autodesk:SimpleAddIn:SlotToolbar", CommandBarTypeEnum.kRegularCommandBar, Runtime.AddInId);
                        //slotCommandBar.Controls.AddButton(_createTopAndLeftViewButton.ButtonDefinition, 0);

                        //// Make the command bar accessible in the panel menu for the 2d sketch environment.
                        //Runtime.UserInterfaceManager.Environments["PMxPartSketchEnvironment"].PanelBar.CommandBarList.Add(slotCommandBar);
                    }
                    else
                    {
                        RegisterButtons();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public ProfilerDockableWnd(
            Inventor.ApplicationAddInSite addInSite,
            Inventor.DockingStateEnum initialDockingState)
        {
            if (addInSite == null) // We can't build the dockable window without the add-in site object.
            {
                throw new ArgumentNullException("addInSite");
            }

            // Initialize the form with the designer code.
            InitializeComponent();

            // Make sure the components object is created. (The designer doesn't always create it.)
            if (components == null)
            {
                components = new Container();
            }

            // Create the DockableWindow using a managed wrapper and add it to the components collection.
            components.Add(
                new DockableWindowWrapper(addInSite, this, initialDockingState),
                typeof(DockableWindowWrapper).Name);
        }
Пример #29
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            AddInGlobal.InventorApp = addInSiteObject.Application;
            AddInGlobal.GetAddinClassId(GetType());

            IButton button = new Button();
            var     action = new ButtonActions.ButtonActions();

            addIcon                        = new ButtonIcons(Resources.add_16x16, Resources.add_32x32);
            addButtonDefinition            = button.CreateButton("Add", "Add", addIcon);
            addButtonDefinition.OnExecute += action.AddButtonDefinitionOnExecute;

            addFromFolderIcon                        = new ButtonIcons(Resources.folder_add_16x16, Resources.folder_add_32x32);
            addFromFolderButtonDefinition            = button.CreateButton("Add Folder", "Add Folder", addFromFolderIcon);
            addFromFolderButtonDefinition.OnExecute += action.AddFromFolderButtonDefinitionOnExecute;

            searchIcon                        = new ButtonIcons(Resources.icon_search_16x16, Resources.icon_search_32x32);
            searchButtonDefinition            = button.CreateButton("Search", "Search", searchIcon);
            searchButtonDefinition.OnExecute += action.SearchButtonDefinitionOnExecute;

            settingsIcon                        = new ButtonIcons(Resources.setting_16x16, Resources.setting_32x32);
            settingsButtonDefinition            = button.CreateButton("Settings", "Settings", settingsIcon);
            settingsButtonDefinition.OnExecute += action.SettingsButtonDefinitionOnExecute;
        }
Пример #30
0
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.

            ControlDefinitions oCtrlDefs = m_inventorApplication.CommandManager.ControlDefinitions;

            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();

            string[] resources = assembly.GetManifestResourceNames();

            System.IO.Stream oStream1 = assembly.GetManifestResourceStream("ZeroRibbon.resources.Icon1.ico");
            System.IO.Stream oStream2 = assembly.GetManifestResourceStream("ZeroRibbon.resources.Icon2.ico");

            System.Drawing.Icon oIcon1 = new System.Drawing.Icon(oStream1);
            System.Drawing.Icon oIcon2 = new System.Drawing.Icon(oStream2);

            object oIPictureDisp1 = AxHostConverter.ImageToPictureDisp(oIcon1.ToBitmap());
            object oIPictureDisp2 = AxHostConverter.ImageToPictureDisp(oIcon2.ToBitmap());

            try
            {
                Zero_GetStarted_LaunchPanel_ButtonDef = oCtrlDefs["Autodesk:ZeroRibbon:ButtonDef1"] as ButtonDefinition;
                Zero_GetStarted_NewPanel_ButtonDef    = oCtrlDefs["Autodesk:ZeroRibbon:ButtonDef2"] as ButtonDefinition;
            }
            catch (Exception ex)
            {
                Zero_GetStarted_LaunchPanel_ButtonDef = oCtrlDefs.AddButtonDefinition("Ribbon Demo1",
                                                                                      "Autodesk:ZeroRibbon:ButtonDef1",
                                                                                      CommandTypesEnum.kEditMaskCmdType,
                                                                                      addInGuid,
                                                                                      "Ribbon Demo",
                                                                                      "Ribbon Demo Description",
                                                                                      oIPictureDisp1,
                                                                                      oIPictureDisp1,
                                                                                      ButtonDisplayEnum.kDisplayTextInLearningMode);

                Zero_GetStarted_NewPanel_ButtonDef = oCtrlDefs.AddButtonDefinition("Ribbon Demo2",
                                                                                   "Autodesk:ZeroRibbon:ButtonDef2",
                                                                                   CommandTypesEnum.kEditMaskCmdType,
                                                                                   addInGuid,
                                                                                   "Ribbon Demo",
                                                                                   "Ribbon Demo Description",
                                                                                   oIPictureDisp2,
                                                                                   oIPictureDisp2,
                                                                                   ButtonDisplayEnum.kDisplayTextInLearningMode);

                CommandCategory cmdCat = m_inventorApplication.CommandManager.CommandCategories.Add("RibbonDemo C#", "Autodesk:CmdCategory:RibbonDemoC#", addInGuid);


                cmdCat.Add(Zero_GetStarted_LaunchPanel_ButtonDef);
                cmdCat.Add(Zero_GetStarted_NewPanel_ButtonDef);
            }



            Ribbon      ribbon      = m_inventorApplication.UserInterfaceManager.Ribbons["ZeroDoc"];
            RibbonTab   tab         = ribbon.RibbonTabs["id_GetStarted"];
            RibbonPanel built_panel = tab.RibbonPanels["id_Panel_Launch"];

            built_panel.CommandControls.AddButton(Zero_GetStarted_LaunchPanel_ButtonDef, true);

            RibbonPanel panel1 = tab.RibbonPanels.Add("Ribbon Demo", "Autodesk:RibbonDemoC#:Panel1", addInGuid, "", false);

            panel1.CommandControls.AddButton(Zero_GetStarted_NewPanel_ButtonDef, true);


            Zero_GetStarted_LaunchPanel_ButtonDef.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(Zero_GetStarted_LaunchPanel_ButtonDef_OnExecute);
            Zero_GetStarted_NewPanel_ButtonDef.OnExecute    += new ButtonDefinitionSink_OnExecuteEventHandler(Zero_GetStarted_NewPanel_ButtonDef_OnExecute);
        }