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);
        }
            // 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. However, with the introduction of the ribbon this argument is always true.
            public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
            {
                try
                {
                    // Initialize AddIn members.
                    Globals.invApp = addInSiteObject.Application;

                    // Connect to the user-interface events to handle a ribbon reset.
                    m_uiEvents = Globals.invApp.UserInterfaceManager.UserInterfaceEvents;

                    // *********************************************************************************
                    // * The remaining code in this Sub is all for adding the add-in into Inventor's UI.
                    // * It can be deleted if this add-in doesn't have a UI and only runs in the
                    // * background handling events.
                    // *********************************************************************************

                    // Create the button definition using the CreateButtonDefinition function to simplify this step.
                    // ButtonName = Utilities.CreateButtonDefinition(display_text, internal_name, "", icon_path)
                    MyFirstButton  = Utilities.CreateButtonDefinition("    My First    \n    Command    ", "MyFirstCommand", "", @"ButtonResources\MyIcon1");
                    MySecondButton = Utilities.CreateButtonDefinition("    My Second    \n    Command    ", "MySecondCommand", "", @"ButtonResources\MyIcon2");
                    CloseDocButton = Utilities.CreateButtonDefinition("    Close    \n    Document    ", "CloseDocCommand", "", @"ButtonResources\MyIcon3");

                    // Add to the user interface, if it's the first time.
                    // If this add-in doesn't have a UI but runs in the background listening
                    // to events, you can delete this.
                    if (firstTime)
                    {
                        AddToUserInterface();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unexpected failure in the activation of the add-in \"My_CSharp_AddIn\"" + System.Environment.NewLine + System.Environment.NewLine + ex.Message);
                }
            }
Example #3
0
        public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            inventor = addInSiteObject.Application;

            occurrenceBundler = new OccurrenceBundler(inventor, this.getGUID());
            inventor.CommandManager.UserInputEvents.OnContextMenu += occurrenceBundler.OnContextMenu;
        }
 public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
 {
     Trace.TraceInformation(": CreateThumbnailPlugin (" + Assembly.GetExecutingAssembly().GetName().Version.ToString(4) + "): initializing...");
     // Initialize AddIn members.
     _inventorServer = addInSiteObject.InventorServer;
     Automation      = new CreateThumbnailAutomation(_inventorServer);
 }
Example #5
0
        public void Activate(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.
            _inventorApplication = addInSiteObject.Application;

            ControlDefinitions controlDefs   = _inventorApplication.CommandManager.ControlDefinitions;
            IPictureDisp       smallPicture2 = AxHostConverter.ImageToPictureDisp(Resources.CreateMasterM.ToBitmap());
            IPictureDisp       largePicture2 = AxHostConverter.ImageToPictureDisp(Resources.CreateMasterM.ToBitmap());

            _dockableWindow            = controlDefs.AddButtonDefinition("Dockable Window", "DockableWindow:Show", CommandTypesEnum.kNonShapeEditCmdType, "{" + ClientId + "}", null, null, smallPicture2, largePicture2);
            _dockableWindow.OnExecute += m_dockableWindow_OnExecute;

            // Get the initial ribbon.
            Ribbon ribbon = _inventorApplication.UserInterfaceManager.Ribbons["ZeroDoc"];
            // Get "Extras" tab.
            RibbonTab extrasTab = ribbon.RibbonTabs["id_TabTools"];

            const string chatPanelInternalName = "DockableWindow:ChatPanel";
            RibbonPanel  panel = extrasTab.RibbonPanels.OfType <RibbonPanel>().SingleOrDefault(rp => rp.InternalName == chatPanelInternalName);

            if (panel == null)
            {
                panel = extrasTab.RibbonPanels.Add("Chat", chatPanelInternalName, "{" + ClientId + "}");
            }

            panel.CommandControls.AddButton(_dockableWindow, true);
        }
Example #6
0
 public void Activate(
     ApplicationAddInSite site,
     bool firstTime)
 {
     m_InventorServer = site.InventorServer;
     m_Processor      = new CProcessor(m_InventorServer);
 }
        public void Activate(ApplicationAddInSite AddInSiteObject, bool FirstTime)
        {
            Trace.TraceInformation("Add Param Plugin: initializing... ");

            // Initialize AddIn members.
            m_inventorServer = AddInSiteObject.InventorServer;
            m_automation     = new SampleAutomation(m_inventorServer);
        }
Example #8
0
        public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            InventorApp = addInSiteObject.Application;

            AdnInventorUtilities.Initialize(InventorApp, this.GetType());
            AddMainButtonToRibbon();
            Dispatcher.CurrentDispatcher.UnhandledException += CurrentDispatcherOnUnhandledException;
        }
 public static void CreateInstance(
     ApplicationAddInSite addInSiteObject,
     DockingStateEnum initialDockingState)
 {
     _instance = new ProfilerDockableWnd(
         addInSiteObject,
         initialDockingState);
 }
Example #10
0
        public void Activate(ApplicationAddInSite AddInSiteObject, bool FirstTime)
        {
            Trace.TraceInformation(": samplePlugin (" + Assembly.GetExecutingAssembly().GetName().Version.ToString(4) + "): initializing... ");

            // Initialize AddIn members.
            m_inventorServer = AddInSiteObject.InventorServer;
            m_automation     = new SampleAutomation(m_inventorServer);
        }
Example #11
0
        public override void Activate(
            ApplicationAddInSite addInSiteObject,
            bool firstTime)
        {
            base.Activate(addInSiteObject, firstTime);

            // Forces exported types loading - issue in x64 Release
            System.Reflection.Assembly.GetExecutingAssembly().GetExportedTypes();
        }
Example #12
0
        public FeatureMigratorAsmCtrlCmd(
            Inventor.Application Application,
            ApplicationAddInSite addInSiteObject,
            FeatureMigratorDockWnd dockableWindow) : base(Application)
        {
            _addInSiteObject = addInSiteObject;

            _dockableWindow = dockableWindow;
        }
Example #13
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);
            }
        }
Example #14
0
        public void Activate(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_invApp   = addInSiteObject.Application;
                m_Importer = new McMasterImporter(this);

                if (Properties.Settings.Default.projectFolder == "")
                {
                    Properties.Settings.Default.projectFolder =
                        m_invApp.DesignProjectManager.ActiveDesignProject
                        .WorkspacePath + "\\MCMASTER_REPOSITORY\\";
                    Properties.Settings.Default.Save();
                }
                //initialize event delegates
                m_UIEvents = m_invApp.UserInterfaceManager.UserInterfaceEvents;

                UIESink_OnResetRibbonInterfaceEventDelegate = new
                                                              UserInterfaceEventsSink_OnResetRibbonInterfaceEventHandler(
                    UIE_OnResetRibbonInterface);
                m_UIEvents.OnResetRibbonInterface +=
                    UIESink_OnResetRibbonInterfaceEventDelegate;

                m_Button = new McMasterButton(this);

                if (firstTime == true)
                {
                    //access user interface manager
                    UserInterfaceManager UIManager = m_invApp.UserInterfaceManager;

                    //create the UI for classic interface
                    if (UIManager.InterfaceStyle == InterfaceStyleEnum.kClassicInterface)
                    {
                        //For first iterations assume RibbonInterface
                    }
                    //create the UI for ribbon interface
                    else if (UIManager.InterfaceStyle ==
                             InterfaceStyleEnum.kRibbonInterface)
                    {
                        CreateOrUpdateRibbonUserInterface();
                    }
                }

                InitializeCEF();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Example #15
0
 public void Activate(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.
     Trace.TraceInformation("Activate IPT Param");
     // Initialize AddIn members.
     m_server     = addInSiteObject.InventorServer;
     m_automation = new Commands(m_server);
     // TODO: Add ApplicationAddInServer.Activate implementation.
     // e.g. event initialization, command creation etc.
 }
Example #16
0
        public void Activate(ApplicationAddInSite AddInSiteObject, bool FirstTime)
        {
            Inventor = AddInSiteObject.Application;
            UserInterfaceEvents.OnResetCommandBars     += OnResetCommandBars;
            UserInterfaceEvents.OnEnvironmentChange    += OnEnvironmentChange;
            UserInterfaceEvents.OnResetRibbonInterface += OnResetRibbonInterface;

            try
            {
                // Buttons only visible when in drawing edit mode.
                _createLeftThenThreeTopProjectedViewsButton =
                    new CreateLeftThenThreeTopProjectedViewsButton();
                _createTopAndLeftProjectedViewsButton = new CreateTopAndLeftProjectedViewsButton();
                _createPartViewsFromAssemblyButton    = new CreatePartViewsFromAssemblyButton();
                _exportPdfButton = new ExportPdfButton();

                // Buttons only visible when in assembly edit mode.
                _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());
            }
        }
Example #17
0
        public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            _application = addInSiteObject.Application;
            var controlDefs  = _application.CommandManager.ControlDefinitions;
            var smallPicture = PictureConverter.ImageToPictureDisp(Properties.Resources.Autodesk.ToBitmap());
            var largePicture = PictureConverter.ImageToPictureDisp(Properties.Resources.Autodesk.ToBitmap());

            _buttonDefinition = controlDefs.AddButtonDefinition(_buttonDisplayName, _buttonInternalName,
                                                                CommandTypesEnum.kNonShapeEditCmdType, _clientId, _buttonDescription, _buttonTooltip,
                                                                smallPicture, largePicture);
            _buttonDefinition.OnExecute += ButtonOnExecute;

            if (firstTime)
            {
                CreateUserInterface();
            }

            _userInterfaceEvents = _application.UserInterfaceManager.UserInterfaceEvents;
            _userInterfaceEvents.OnResetRibbonInterface += context => CreateUserInterface();
        }
        public void Activate(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.

            mApp = addInSiteObject.Application;

            // Create a button and connect it to the CreateSurface 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("TestSurface", "TestSurface", CommandTypesEnum.kShapeEditCmdType,
                                             null, "TestSurface", "TestSurface", null, null);

            panel.CommandControls.AddButton(mButton);
            mButton.OnExecute += CreateSurface;
        }
Example #19
0
        public static ProfilerDockableWnd MakeVisible(
            ApplicationAddInSite addInSiteObject,
            DockingStateEnum initialDockingState)
        {
            if (Instance == null)
            {
                CreateInstance(
                    addInSiteObject,
                    initialDockingState);

                Instance.Show();

                Instance.RefreshContent();
            }
            else
            {
                Instance.RefreshContent();
                Instance.Visible = true;
            }

            return(_instance);
        }
            // 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. However, with the introduction of the ribbon this argument is always true.
            public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
            {
                try
                {
                    // Initialize AddIn members.
                    Globals.invApp = addInSiteObject.Application;

                    // Connect to the user-interface events to handle a ribbon reset.
                    m_uiEvents = Globals.invApp.UserInterfaceManager.UserInterfaceEvents;

                    // *********************************************************************************
                    // * The remaining code in this Sub is all for adding the add-in into Inventor's UI.
                    // * It can be deleted if this add-in doesn't have a UI and only runs in the
                    // * background handling events.
                    // *********************************************************************************

                    // ButtonName = create_button(display_text, internal_name, icon_path)
                    CreateButton create_button = new CreateButton(button_template);
                    MyFirstButton   = create_button("    My First    \n    Command    ", "my_first_button", @"ButtonResources\MyIcon1");
                    MySecondButton  = create_button("    My Second    \n    Command    ", "my_second_button", @"ButtonResources\MyIcon2");
                    CloseDocButton  = create_button("    Close    \n    Document    ", "close_doc_button", @"ButtonResources\MyIcon3");
                    ExportDxfButton = create_button("    Export    \n    DXF    ", "export_dxf_button", @"ButtonResources\MyIcon4");

                    // Add to the user interface, if it's the first time.
                    // If this add-in doesn't have a UI but runs in the background listening
                    // to events, you can delete this.
                    if (firstTime)
                    {
                        AddToUserInterface();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unexpected failure in the activation of the add-in \"Part_Library_Inventor\"" + System.Environment.NewLine + System.Environment.NewLine + ex.Message);
                }
            }
Example #21
0
 public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
 {
     m_inventorApplication = addInSiteObject.Application;
 }
Example #22
0
 public override void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
 {
     base.Activate(addInSiteObject, firstTime);
 }
        public void Activate(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.
            _inventorApplication = addInSiteObject.Application;

            try
            {
                _vaultAddin = _inventorApplication.ApplicationAddIns.ItemById["{48b682bc-42e6-4953-84c5-3d253b52e77b}"];
            }
            catch
            {
                MessageBox.Show(Resources.VaultAddinNotFound, @"MyVaultBrowser", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                throw;
            }

            _applicationEvents = _inventorApplication.ApplicationEvents;
            _dockableWindowsEvents = _inventorApplication.UserInterfaceManager.DockableWindows.Events;
            _userInterfaceEvents = _inventorApplication.UserInterfaceManager.UserInterfaceEvents;

            _activeProjectType = _inventorApplication.DesignProjectManager.ActiveDesignProject.ProjectType;

            _hwndDic = new Dictionary<Document, IntPtr>();
            Hook.Initialize(this);

            _myVaultBrowser =
                _inventorApplication.UserInterfaceManager.DockableWindows.Add("{ffbbb57a-07f3-4d5c-97b0-e8e302247c7a}",
                    "myvaultbrowser", "MyVaultBrowser");
            _myVaultBrowser.Title = "Vault";
            _myVaultBrowser.ShowTitleBar = true;
            _myVaultBrowser.DisabledDockingStates = DockingStateEnum.kDockBottom | DockingStateEnum.kDockTop;
            _myVaultBrowser.SetMinimumSize(200, 150);

            SetShortCut();

            if (!_myVaultBrowser.IsCustomized)
            {
                _myVaultBrowser.DockingState = DockingStateEnum.kDockRight;
                _myVaultBrowser.Visible = true;
            }

            _applicationEvents.OnActiveProjectChanged += ApplicationEvents_OnActiveProjectChanged;
            _userInterfaceEvents.OnResetShortcuts += UserInterfaceEvents_OnResetShortcuts;

            if (_inventorApplication.Ready)
            {
                if (_activeProjectType == MultiUserModeEnum.kVaultMode)
                    TryLoadVaultAddin();
            }
            else
                _applicationEvents.OnReady += ApplicationEvents_OnReady;

        }
Example #24
0
        public void Activate(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.
            _inventorApplication = addInSiteObject.Application;

            try
            {
                _vaultAddin = _inventorApplication.ApplicationAddIns.ItemById["{48b682bc-42e6-4953-84c5-3d253b52e77b}"];
            }
            catch
            {
                MessageBox.Show(Resources.VaultAddinNotFound, @"MyVaultBrowser", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                throw;
            }

            _applicationEvents     = _inventorApplication.ApplicationEvents;
            _dockableWindowsEvents = _inventorApplication.UserInterfaceManager.DockableWindows.Events;
            _userInputEvents       = _inventorApplication.CommandManager.UserInputEvents;

            _activeProjectType = _inventorApplication.DesignProjectManager.ActiveDesignProject.ProjectType;

            _hwndDic = new Dictionary <Document, IntPtr>();
            Hook.Initialize(this);

            _myVaultBrowser =
                _inventorApplication.UserInterfaceManager.DockableWindows.Add("{ffbbb57a-07f3-4d5c-97b0-e8e302247c7a}",
                                                                              "myvaultbrowser", "MyVaultBrowser");
            _myVaultBrowser.Title                 = "Vault";
            _myVaultBrowser.ShowTitleBar          = true;
            _myVaultBrowser.DisabledDockingStates = DockingStateEnum.kDockBottom | DockingStateEnum.kDockTop;
            _myVaultBrowser.SetMinimumSize(200, 150);

            _myVaultBrowserButton = _inventorApplication.CommandManager.ControlDefinitions.AddButtonDefinition(
                "MyVaultBrowser", "myvaultbrowserbutton", CommandTypesEnum.kQueryOnlyCmdType, "{ffbbb57a-07f3-4d5c-97b0-e8e302247c7a}",
                "Toggle MyVaultBrowser", "", "", "", ButtonDisplayEnum.kNoTextWithIcon);
            _myVaultBrowserButton.OnExecute += _myVaultBrowserButton_OnExecute;

            if (!_myVaultBrowser.IsCustomized)
            {
                _myVaultBrowser.DockingState = DockingStateEnum.kDockRight;
                _myVaultBrowser.Visible      = true;
            }

            _applicationEvents.OnActiveProjectChanged += ApplicationEvents_OnActiveProjectChanged;

            if (_inventorApplication.Ready)
            {
                if (_activeProjectType == MultiUserModeEnum.kVaultMode)
                {
                    TryLoadVaultAddin();
                }
            }
            else
            {
                _applicationEvents.OnReady += ApplicationEvents_OnReady;
            }
        }
Example #25
0
 public void Activate(ApplicationAddInSite AddInSiteObject, bool FirstTime)
 {
     throw new NotImplementedException();
 }
Example #26
0
        /// <summary>
        /// Called when the <see cref="StandardAddInServer"/> is being loaded
        /// </summary>
        /// <param name="AddInSiteObject"></param>
        /// <param name="FirstTime"></param>
        public void Activate(ApplicationAddInSite AddInSiteObject, bool FirstTime)
        {
            MainApplication = AddInSiteObject.Application; //Gets the application object, which is used in many different ways throughout this whole process
            string ClientID = "{0c9a07ad-2768-4a62-950a-b5e33b88e4a3}";

            Utilities.LoadSettings();

            #region Add Parallel Environment

            #region Load Images

            stdole.IPictureDisp ExportRobotIconSmall = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.SynthesisLogo16));
            stdole.IPictureDisp ExportRobotIconLarge = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.SynthesisLogo32));

            stdole.IPictureDisp SaveRobotIconSmall = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Save16));
            stdole.IPictureDisp SaveRobotIconLarge = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Save32));

            stdole.IPictureDisp ExportSetupRobotIconSmall = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Gears16));
            stdole.IPictureDisp ExportSetupRobotIconLarge = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Gears32));

            stdole.IPictureDisp YeetRobotIconSmall = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Wand16));//these are still here at request of QA
            stdole.IPictureDisp YeetRobotIconLarge = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Wand32));

            stdole.IPictureDisp WeightRobotIconSmall = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Weight16));
            stdole.IPictureDisp WeightRobotIconLarge = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Weight32));

            stdole.IPictureDisp SynthesisLogoSmall = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.SynthesisLogo16));
            stdole.IPictureDisp SynthesisLogoLarge = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.SynthesisLogo32));

            #region DEBUG
#if DEBUG
            stdole.IPictureDisp DebugButtonSmall = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Wand16));
            stdole.IPictureDisp DebugButtonLarge = PictureDispConverter.ToIPictureDisp(new Bitmap(Resource.Wand32));
#endif
            #endregion

            #endregion

            #region UI Creation

            #region Setup New Environment and Ribbon
            Environments environments = MainApplication.UserInterfaceManager.Environments;
            ExporterEnv = environments.Add("Robot Exporter", "BxD:RobotExporter:Environment", null, SynthesisLogoSmall, SynthesisLogoLarge);

            Ribbon    assemblyRibbon = MainApplication.UserInterfaceManager.Ribbons["Assembly"];
            RibbonTab ExporterTab    = assemblyRibbon.RibbonTabs.Add("Robot Exporter", "BxD:RobotExporter:RobotExporterTab", ClientID, "", false, true);

            ControlDefinitions ControlDefs = MainApplication.CommandManager.ControlDefinitions;

            SetupPanel    = ExporterTab.RibbonPanels.Add("Start Over", "BxD:RobotExporter:SetupPanel", ClientID);
            SettingsPanel = ExporterTab.RibbonPanels.Add("Settings", "BxD:RobotExporter:SettingsPanel", ClientID);
            FilePanel     = ExporterTab.RibbonPanels.Add("File", "BxD:RobotExporter:FilePanel", ClientID);

            // Reset positioning of panels
            SettingsPanel.Reposition("BxD:RobotExporter:SetupPanel", false);
            FilePanel.Reposition("BxD:RobotExporter:SettingsPanel", false);
            #endregion

            #region Setup Buttons
            //Begin Wizard Export
            WizardExportButton            = ControlDefs.AddButtonDefinition("Exporter Setup", "BxD:RobotExporter:BeginWizardExport", CommandTypesEnum.kNonShapeEditCmdType, ClientID, null, "Quickly configure wheel and joint information.", ExportSetupRobotIconSmall, ExportSetupRobotIconLarge);
            WizardExportButton.OnExecute += BeginWizardExport_OnExecute;
            WizardExportButton.OnHelp    += _OnHelp;
            SetupPanel.CommandControls.AddButton(WizardExportButton, true);

            //Set Weight
            SetWeightButton            = ControlDefs.AddButtonDefinition("Robot Weight", "BxD:RobotExporter:SetWeight", CommandTypesEnum.kNonShapeEditCmdType, ClientID, null, "Change the weight of the robot.", WeightRobotIconSmall, WeightRobotIconLarge);
            SetWeightButton.OnExecute += SetWeight_OnExecute;
            SetWeightButton.OnHelp    += _OnHelp;
            SettingsPanel.CommandControls.AddButton(SetWeightButton, true);

            //Save Button
            SaveButton            = ControlDefs.AddButtonDefinition("Save Configuration", "BxD:RobotExporter:SaveRobot", CommandTypesEnum.kNonShapeEditCmdType, ClientID, null, "Save robot configuration to your assembly file for future exporting.", SaveRobotIconSmall, SaveRobotIconLarge);
            SaveButton.OnExecute += SaveButton_OnExecute;
            SaveButton.OnHelp    += _OnHelp;
            FilePanel.CommandControls.AddButton(SaveButton, true);

            //Export Button
            ExportButton            = ControlDefs.AddButtonDefinition("Export to Synthesis", "BxD:RobotExporter:ExportRobot", CommandTypesEnum.kNonShapeEditCmdType, ClientID, null, "Export your robot's model to Synthesis.", ExportRobotIconSmall, ExportRobotIconLarge);
            ExportButton.OnExecute += ExportButton_OnExecute;
            ExportButton.OnHelp    += _OnHelp;
            FilePanel.CommandControls.AddButton(ExportButton, true);

            #endregion

            #region DEBUG
#if DEBUG
            DebugPanel = ExporterTab.RibbonPanels.Add("Debug", "BxD:RobotExporter:DebugPanel", ClientID);
            //Selection Test
            DedectionTestButton            = ControlDefs.AddButtonDefinition("Detection Test", "BxD:RobotExporter:DetectionTestButton", CommandTypesEnum.kNonShapeEditCmdType, ClientID, null, null, DebugButtonSmall, DebugButtonLarge);
            DedectionTestButton.OnExecute += delegate(NameValueMap context)
            {
                if (Wizard.WizardUtilities.DetectWheels(Utilities.GUI.SkeletonBase, out List <RigidNode_Base> leftWheels, out List <RigidNode_Base> rightWheels))
                {
                    List <RigidNode_Base> allWheels = new List <RigidNode_Base>();
                    allWheels.AddRange(leftWheels);
                    allWheels.AddRange(rightWheels);
                    SelectNodes(allWheels);
                }
            };
            DebugPanel.CommandControls.AddButton(DedectionTestButton, true);
            //UI Test
            UITestButton            = ControlDefs.AddButtonDefinition("UI Test", "BxD:RobotExporter:UITestButton", CommandTypesEnum.kNonShapeEditCmdType, ClientID, null, null, DebugButtonSmall, DebugButtonLarge);
            UITestButton.OnExecute += delegate(NameValueMap context)
            {
                Wizard.WizardForm wizard = new Wizard.WizardForm();

                wizard.ShowDialog();
                if (Properties.Settings.Default.ShowExportOrAdvancedForm)
                {
                    Form finishDialog = new Wizard.ExportOrAdvancedForm();
                    finishDialog.ShowDialog();
                }
            };
            DebugPanel.CommandControls.AddButton(UITestButton, true);
#endif
            #endregion

            #endregion

            #region Final Environment Setup
            ExporterEnv.DefaultRibbonTab = "BxD:RobotExporter:RobotExporterTab";
            MainApplication.UserInterfaceManager.ParallelEnvironments.Add(ExporterEnv);
            ExporterEnv.DisabledCommandList.Add(MainApplication.CommandManager.ControlDefinitions["BxD:RobotExporter:Environment"]);
            #endregion

            #region Event Handler Assignment
            MainApplication.UserInterfaceManager.UserInterfaceEvents.OnEnvironmentChange += UIEvents_OnEnvironmentChange;
            MainApplication.ApplicationEvents.OnActivateDocument   += ApplicationEvents_OnActivateDocument;
            MainApplication.ApplicationEvents.OnDeactivateDocument += ApplicationEvents_OnDeactivateDocument;
            MainApplication.ApplicationEvents.OnCloseDocument      += ApplicationEvents_OnCloseDocument;
            LegacyInterchange.LegacyEvents.RobotModified           += new Action(() => { PendingChanges = true; });
            #endregion

            #endregion

            Instance = this;
        }
Example #27
0
 public void Activate(ApplicationAddInSite AddInSiteObject, bool FirstTime)
 {
     Debug.WriteLine("Activate");
 }
        public void Activate(ApplicationAddInSite AddInSiteObject, bool FirstTime)
        {
            Debug.WriteLine("Activate");

            CreateRibbonPanel(GetAddInId(), AddInSiteObject.Application);
        }
Example #29
0
 public GalleryUploaderCmd(ApplicationAddInSite addInSite) :
     base(addInSite.Application)
 {
     AddInSite = addInSite;
 }
 public MaterialProfilerCmd(ApplicationAddInSite addInSiteObject) :
     base(addInSiteObject.Application)
 {
     _addInSiteObject = addInSiteObject;
 }
Example #31
-1
        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);
            } 
        }