Exemple #1
0
        private void ProcessComboBoxNode(RibbonPanel panel, XmlNode node)
        {
            string commandName = node.Attributes["internalName"].Value;

            ComboBoxDefinition controlDef =
                _Application.CommandManager.ControlDefinitions[commandName] as ComboBoxDefinition;

            bool?  useLargeIcon  = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "useLargeIcon");
            bool?  showText      = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "showText");
            bool?  insertBefore  = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "insertBefore");
            bool?  isInSlideout  = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "isInSlideout");
            string targetControl = XmlUtilities.GetAttributeValue <string>(node, "targetControl");

            bool slideout = isInSlideout.HasValue ? isInSlideout.Value : false;

            CommandControls controls = (slideout ? panel.SlideoutControls : panel.CommandControls);

            controls.AddComboBox(
                controlDef,
                string.IsNullOrEmpty(targetControl) ? string.Empty : targetControl,
                insertBefore.HasValue ? insertBefore.Value : false);

            XmlNodeList nodes = node.SelectNodes("ComboItem");

            foreach (XmlNode comboItemNode in nodes)
            {
                string comboItem = comboItemNode.Attributes["item"].Value;

                int?index = XmlUtilities.GetAttributeValueAsNullable <int>(comboItemNode, "index");

                controlDef.AddItem(
                    comboItem,
                    index.HasValue ? index.Value : 0);
            }
        }
 public InvComboBox(string DisplayName, string InternalName, CommandTypesEnum Classification, int DropDownWidth,
                    object ClientId, object StandardIcon, object LargeIcon, string DescriptionText = "", string ToolTipText = "",
                    ButtonDisplayEnum ButtonDisplay = ButtonDisplayEnum.kDisplayTextInLearningMode)
 {
     m_ComboBoxDef = m_inventorApplication.CommandManager.ControlDefinitions.AddComboBoxDefinition(DisplayName, InternalName, Classification, DropDownWidth, ClientId,
                                                                                                   DescriptionText, ToolTipText, StandardIcon, LargeIcon);
     m_ComboBoxDef.Enabled   = true;
     m_cbEhDelegate          = new ComboBoxDefinitionSink_OnSelectEventHandler(ComboBoxDefinition_OnSelect);
     m_ComboBoxDef.OnSelect += m_cbEhDelegate;
 }
 public void addControl(ComboBoxDefinition cbDef, string name = "")
 {
     if (name == "")
     {
         m_commandControl = m_commandControls.AddComboBox(cbDef);
     }
     else
     {
         m_commandControl = m_commandControls.AddComboBox(cbDef, name);
     }
 }
Exemple #4
0
 public ComboBoxEventsLib(ComboBoxDefinition comboBoxDefinition)
 {
     ComboBoxDefinition = comboBoxDefinition;
     Activate();
 }
        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;
                Button.InventorApplication = m_inventorApplication;

                //initialize event delegates
                m_userInterfaceEvents = m_inventorApplication.UserInterfaceManager.UserInterfaceEvents;

                UserInterfaceEventsSink_OnResetCommandBarsEventDelegate = new UserInterfaceEventsSink_OnResetCommandBarsEventHandler(UserInterfaceEvents_OnResetCommandBars);
                m_userInterfaceEvents.OnResetCommandBars += UserInterfaceEventsSink_OnResetCommandBarsEventDelegate;

                UserInterfaceEventsSink_OnResetEnvironmentsEventDelegate = new UserInterfaceEventsSink_OnResetEnvironmentsEventHandler(UserInterfaceEvents_OnResetEnvironments);
                m_userInterfaceEvents.OnResetEnvironments += UserInterfaceEventsSink_OnResetEnvironmentsEventDelegate;

                UserInterfaceEventsSink_OnResetRibbonInterfaceEventDelegate = new UserInterfaceEventsSink_OnResetRibbonInterfaceEventHandler(UserInterfaceEvents_OnResetRibbonInterface);
                m_userInterfaceEvents.OnResetRibbonInterface += UserInterfaceEventsSink_OnResetRibbonInterfaceEventDelegate;

                //load image icons for UI items
                Icon addSlotOptionIcon = new Icon(this.GetType(), "AddSlotOption.ico");
                Icon drawSlotIcon =  new Icon(this.GetType(), "DrawSlot.ico");
                Icon toggleSlotStateIcon = new Icon(this.GetType(), "ToggleSlotState.ico");

                //retrieve the GUID for this class
                GuidAttribute addInCLSID;
                addInCLSID = (GuidAttribute)GuidAttribute.GetCustomAttribute(typeof(AddInServer), typeof(GuidAttribute));
                string addInCLSIDString;
                addInCLSIDString = "{" + addInCLSID.Value + "}";

                //create the comboboxes
                m_slotWidthComboBoxDefinition = m_inventorApplication.CommandManager.ControlDefinitions.AddComboBoxDefinition("Slot Width", "Autodesk:SimpleAddIn:SlotWidthCboBox", CommandTypesEnum.kShapeEditCmdType, 100, addInCLSIDString, "Slot width", "Slot width", Type.Missing, Type.Missing, ButtonDisplayEnum.kDisplayTextInLearningMode);
                m_slotHeightComboBoxDefinition = m_inventorApplication.CommandManager.ControlDefinitions.AddComboBoxDefinition("Slot Height", "Autodesk:SimpleAddIn:SlotHeightCboBox", CommandTypesEnum.kShapeEditCmdType, 100, addInCLSIDString, "Slot height", "Slot height", Type.Missing, Type.Missing, ButtonDisplayEnum.kDisplayTextInLearningMode);

                //add some initial items to the comboboxes
                m_slotWidthComboBoxDefinition.AddItem("1 cm", 0);
                m_slotWidthComboBoxDefinition.AddItem("2 cm", 0);
                m_slotWidthComboBoxDefinition.AddItem("3 cm", 0);
                m_slotWidthComboBoxDefinition.AddItem("4 cm", 0);
                m_slotWidthComboBoxDefinition.AddItem("5 cm", 0);
                m_slotWidthComboBoxDefinition.ListIndex = 1;
                m_slotWidthComboBoxDefinition.ToolTipText = m_slotWidthComboBoxDefinition.Text;
                m_slotWidthComboBoxDefinition.DescriptionText = "Slot width: " + m_slotWidthComboBoxDefinition.Text;

                SlotWidthComboBox_OnSelectEventDelegate = new ComboBoxDefinitionSink_OnSelectEventHandler(SlotWidthComboBox_OnSelect);
                m_slotWidthComboBoxDefinition.OnSelect += SlotWidthComboBox_OnSelectEventDelegate;

                m_slotHeightComboBoxDefinition.AddItem("1 cm", 0);
                m_slotHeightComboBoxDefinition.AddItem("2 cm", 0);
                m_slotHeightComboBoxDefinition.AddItem("3 cm", 0);
                m_slotHeightComboBoxDefinition.AddItem("4 cm", 0);
                m_slotHeightComboBoxDefinition.AddItem("5 cm", 0);
                m_slotHeightComboBoxDefinition.ListIndex = 1;
                m_slotHeightComboBoxDefinition.ToolTipText = m_slotHeightComboBoxDefinition.Text;
                m_slotHeightComboBoxDefinition.DescriptionText = "Slot height: " + m_slotHeightComboBoxDefinition.Text;

                SlotHeightComboBox_OnSelectEventDelegate = new ComboBoxDefinitionSink_OnSelectEventHandler(SlotHeightComboBox_OnSelect);
                m_slotHeightComboBoxDefinition.OnSelect += SlotHeightComboBox_OnSelectEventDelegate;

                //create buttons
                m_addSlotOptionButton = new AddSlotOptionButton(
                    "Add Slot width/height", "Autodesk:SimpleAddIn:AddSlotOptionCmdBtn", CommandTypesEnum.kShapeEditCmdType,
                    addInCLSIDString, "Adds option for slot width/height",
                    "Add slot option", addSlotOptionIcon, addSlotOptionIcon, ButtonDisplayEnum.kDisplayTextInLearningMode);

                m_drawSlotButton = new DrawSlotButton(
                    "Draw Slot", "Autodesk:SimpleAddIn:DrawSlotCmdBtn", CommandTypesEnum.kShapeEditCmdType,
                    addInCLSIDString, "Create slot sketch graphics",
                    "Draw Slot", drawSlotIcon, drawSlotIcon, ButtonDisplayEnum.kDisplayTextInLearningMode);

                m_toggleSlotStateButton = new ToggleSlotStateButton(
                    "Toggle Slot State", "Autodesk:SimpleAddIn:ToggleSlotStateCmdBtn", CommandTypesEnum.kShapeEditCmdType,
                    addInCLSIDString, "Enables/Disables state of slot command",
                    "Toggle Slot State", toggleSlotStateIcon, toggleSlotStateIcon, ButtonDisplayEnum.kDisplayTextInLearningMode);

                //create the command category
                CommandCategory slotCmdCategory = m_inventorApplication.CommandManager.CommandCategories.Add("Slot", "Autodesk:SimpleAddIn:SlotCmdCat", addInCLSIDString);

                slotCmdCategory.Add(m_slotWidthComboBoxDefinition);
                slotCmdCategory.Add(m_slotHeightComboBoxDefinition);
                slotCmdCategory.Add(m_addSlotOptionButton.ButtonDefinition);
                slotCmdCategory.Add(m_drawSlotButton.ButtonDefinition);
                slotCmdCategory.Add(m_toggleSlotStateButton.ButtonDefinition);

                if (firstTime == true)
                {
                    //access user interface manager
                    UserInterfaceManager userInterfaceManager;
                    userInterfaceManager = m_inventorApplication.UserInterfaceManager;

                    InterfaceStyleEnum interfaceStyle;
                    interfaceStyle = userInterfaceManager.InterfaceStyle;

                    //create the UI for classic interface
                    if (interfaceStyle == InterfaceStyleEnum.kClassicInterface)
                    {
                        //create toolbar
                        CommandBar slotCommandBar;
                        slotCommandBar = userInterfaceManager.CommandBars.Add("Slot", "Autodesk:SimpleAddIn:SlotToolbar", CommandBarTypeEnum.kRegularCommandBar, addInCLSIDString);

                        //add comboboxes to toolbar
                        slotCommandBar.Controls.AddComboBox(m_slotWidthComboBoxDefinition, 0);
                        slotCommandBar.Controls.AddComboBox(m_slotHeightComboBoxDefinition, 0);

                        //add buttons to toolbar
                        slotCommandBar.Controls.AddButton(m_addSlotOptionButton.ButtonDefinition, 0);
                        slotCommandBar.Controls.AddButton(m_drawSlotButton.ButtonDefinition, 0);
                        slotCommandBar.Controls.AddButton(m_toggleSlotStateButton.ButtonDefinition, 0);

                        //Get the 2d sketch environment base object
                        Inventor.Environment partSketchEnvironment;
                        partSketchEnvironment = userInterfaceManager.Environments["PMxPartSketchEnvironment"];

                        //make this command bar accessible in the panel menu for the 2d sketch environment.
                        partSketchEnvironment.PanelBar.CommandBarList.Add(slotCommandBar);
                    }
                    //create the UI for ribbon interface
                    else
                    {
                        //get the ribbon associated with part document
                        Inventor.Ribbons ribbons;
                        ribbons = userInterfaceManager.Ribbons;

                        Inventor.Ribbon partRibbon;
                        partRibbon = ribbons["Part"];

                        //get the tabls associated with part ribbon
                        RibbonTabs ribbonTabs;
                        ribbonTabs = partRibbon.RibbonTabs;

                        RibbonTab partSketchRibbonTab;
                        partSketchRibbonTab = ribbonTabs["id_TabSketch"];

                        //create a new panel with the tab
                        RibbonPanels ribbonPanels;
                        ribbonPanels = partSketchRibbonTab.RibbonPanels;

                        m_partSketchSlotRibbonPanel = ribbonPanels.Add("Slot", "Autodesk:SimpleAddIn:SlotRibbonPanel", "{DB59D9A7-EE4C-434A-BB5A-F93E8866E872}", "",  false);

                        //add controls to the slot panel
                        CommandControls partSketchSlotRibbonPanelCtrls;
                        partSketchSlotRibbonPanelCtrls = m_partSketchSlotRibbonPanel.CommandControls;

                        //add the combo boxes to the ribbon panel
                        CommandControl slotWidthCmdCboBoxCmdCtrl;
                        slotWidthCmdCboBoxCmdCtrl = partSketchSlotRibbonPanelCtrls.AddComboBox(m_slotWidthComboBoxDefinition, "", false);

                        CommandControl slotHeightCmdCboBoxCmdCtrl;
                        slotHeightCmdCboBoxCmdCtrl = partSketchSlotRibbonPanelCtrls.AddComboBox(m_slotHeightComboBoxDefinition, "", false);

                        //add the buttons to the ribbon panel
                        CommandControl drawSlotCmdBtnCmdCtrl;
                        drawSlotCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_drawSlotButton.ButtonDefinition, false, true, "", false);

                        CommandControl slotOptionCmdBtnCmdCtrl;
                        slotOptionCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_addSlotOptionButton.ButtonDefinition, false, true, "", false);

                        CommandControl toggleSlotStateCmdBtnCmdCtrl;
                        toggleSlotStateCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_toggleSlotStateButton.ButtonDefinition, false,true, "", false);

                    }
                }

                MessageBox.Show ("To access the commands of the sample addin, activate a 2d sketch of a part \n document and select the \"AddInSlot\" toolbar within the panel menu");
            }
            catch(Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Exemple #6
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;
                Button.InventorApplication = m_inventorApplication;

                //initialize event delegates
                m_userInterfaceEvents = m_inventorApplication.UserInterfaceManager.UserInterfaceEvents;

                UserInterfaceEventsSink_OnResetCommandBarsEventDelegate = new UserInterfaceEventsSink_OnResetCommandBarsEventHandler(UserInterfaceEvents_OnResetCommandBars);
                m_userInterfaceEvents.OnResetCommandBars += UserInterfaceEventsSink_OnResetCommandBarsEventDelegate;

                UserInterfaceEventsSink_OnResetEnvironmentsEventDelegate = new UserInterfaceEventsSink_OnResetEnvironmentsEventHandler(UserInterfaceEvents_OnResetEnvironments);
                m_userInterfaceEvents.OnResetEnvironments += UserInterfaceEventsSink_OnResetEnvironmentsEventDelegate;

                UserInterfaceEventsSink_OnResetRibbonInterfaceEventDelegate = new UserInterfaceEventsSink_OnResetRibbonInterfaceEventHandler(UserInterfaceEvents_OnResetRibbonInterface);
                m_userInterfaceEvents.OnResetRibbonInterface += UserInterfaceEventsSink_OnResetRibbonInterfaceEventDelegate;

                //load image icons for UI items
                Icon addSlotOptionIcon   = new Icon(this.GetType(), "AddSlotOption.ico");
                Icon drawSlotIcon        = new Icon(this.GetType(), "DrawSlot.ico");
                Icon toggleSlotStateIcon = new Icon(this.GetType(), "ToggleSlotState.ico");

                //retrieve the GUID for this class
                GuidAttribute addInCLSID;
                addInCLSID = (GuidAttribute)GuidAttribute.GetCustomAttribute(typeof(AddInServer), typeof(GuidAttribute));
                string addInCLSIDString;
                addInCLSIDString = "{" + addInCLSID.Value + "}";

                //create the comboboxes
                m_slotWidthComboBoxDefinition  = m_inventorApplication.CommandManager.ControlDefinitions.AddComboBoxDefinition("Slot Width", "Autodesk:SimpleAddIn:SlotWidthCboBox", CommandTypesEnum.kShapeEditCmdType, 100, addInCLSIDString, "Slot width", "Slot width", Type.Missing, Type.Missing, ButtonDisplayEnum.kDisplayTextInLearningMode);
                m_slotHeightComboBoxDefinition = m_inventorApplication.CommandManager.ControlDefinitions.AddComboBoxDefinition("Slot Height", "Autodesk:SimpleAddIn:SlotHeightCboBox", CommandTypesEnum.kShapeEditCmdType, 100, addInCLSIDString, "Slot height", "Slot height", Type.Missing, Type.Missing, ButtonDisplayEnum.kDisplayTextInLearningMode);

                //add some initial items to the comboboxes
                m_slotWidthComboBoxDefinition.AddItem("1 cm", 0);
                m_slotWidthComboBoxDefinition.AddItem("2 cm", 0);
                m_slotWidthComboBoxDefinition.AddItem("3 cm", 0);
                m_slotWidthComboBoxDefinition.AddItem("4 cm", 0);
                m_slotWidthComboBoxDefinition.AddItem("5 cm", 0);
                m_slotWidthComboBoxDefinition.ListIndex       = 1;
                m_slotWidthComboBoxDefinition.ToolTipText     = m_slotWidthComboBoxDefinition.Text;
                m_slotWidthComboBoxDefinition.DescriptionText = "Slot width: " + m_slotWidthComboBoxDefinition.Text;

                SlotWidthComboBox_OnSelectEventDelegate = new ComboBoxDefinitionSink_OnSelectEventHandler(SlotWidthComboBox_OnSelect);
                m_slotWidthComboBoxDefinition.OnSelect += SlotWidthComboBox_OnSelectEventDelegate;

                m_slotHeightComboBoxDefinition.AddItem("1 cm", 0);
                m_slotHeightComboBoxDefinition.AddItem("2 cm", 0);
                m_slotHeightComboBoxDefinition.AddItem("3 cm", 0);
                m_slotHeightComboBoxDefinition.AddItem("4 cm", 0);
                m_slotHeightComboBoxDefinition.AddItem("5 cm", 0);
                m_slotHeightComboBoxDefinition.ListIndex       = 1;
                m_slotHeightComboBoxDefinition.ToolTipText     = m_slotHeightComboBoxDefinition.Text;
                m_slotHeightComboBoxDefinition.DescriptionText = "Slot height: " + m_slotHeightComboBoxDefinition.Text;

                SlotHeightComboBox_OnSelectEventDelegate = new ComboBoxDefinitionSink_OnSelectEventHandler(SlotHeightComboBox_OnSelect);
                m_slotHeightComboBoxDefinition.OnSelect += SlotHeightComboBox_OnSelectEventDelegate;

                //create buttons
                m_addSlotOptionButton = new AddSlotOptionButton(
                    "Add Slot width/height", "Autodesk:SimpleAddIn:AddSlotOptionCmdBtn", CommandTypesEnum.kShapeEditCmdType,
                    addInCLSIDString, "Adds option for slot width/height",
                    "Add slot option", addSlotOptionIcon, addSlotOptionIcon, ButtonDisplayEnum.kDisplayTextInLearningMode);

                m_drawSlotButton = new DrawSlotButton(
                    "Draw Slot", "Autodesk:SimpleAddIn:DrawSlotCmdBtn", CommandTypesEnum.kShapeEditCmdType,
                    addInCLSIDString, "Create slot sketch graphics",
                    "Draw Slot", drawSlotIcon, drawSlotIcon, ButtonDisplayEnum.kDisplayTextInLearningMode);

                m_toggleSlotStateButton = new ToggleSlotStateButton(
                    "Toggle Slot State", "Autodesk:SimpleAddIn:ToggleSlotStateCmdBtn", CommandTypesEnum.kShapeEditCmdType,
                    addInCLSIDString, "Enables/Disables state of slot command",
                    "Toggle Slot State", toggleSlotStateIcon, toggleSlotStateIcon, ButtonDisplayEnum.kDisplayTextInLearningMode);

                //create the command category
                CommandCategory slotCmdCategory = m_inventorApplication.CommandManager.CommandCategories.Add("Slot", "Autodesk:SimpleAddIn:SlotCmdCat", addInCLSIDString);

                slotCmdCategory.Add(m_slotWidthComboBoxDefinition);
                slotCmdCategory.Add(m_slotHeightComboBoxDefinition);
                slotCmdCategory.Add(m_addSlotOptionButton.ButtonDefinition);
                slotCmdCategory.Add(m_drawSlotButton.ButtonDefinition);
                slotCmdCategory.Add(m_toggleSlotStateButton.ButtonDefinition);

                if (firstTime == true)
                {
                    //access user interface manager
                    UserInterfaceManager userInterfaceManager;
                    userInterfaceManager = m_inventorApplication.UserInterfaceManager;

                    InterfaceStyleEnum interfaceStyle;
                    interfaceStyle = userInterfaceManager.InterfaceStyle;

                    //create the UI for classic interface
                    if (interfaceStyle == InterfaceStyleEnum.kClassicInterface)
                    {
                        //create toolbar
                        CommandBar slotCommandBar;
                        slotCommandBar = userInterfaceManager.CommandBars.Add("Slot", "Autodesk:SimpleAddIn:SlotToolbar", CommandBarTypeEnum.kRegularCommandBar, addInCLSIDString);

                        //add comboboxes to toolbar
                        slotCommandBar.Controls.AddComboBox(m_slotWidthComboBoxDefinition, 0);
                        slotCommandBar.Controls.AddComboBox(m_slotHeightComboBoxDefinition, 0);

                        //add buttons to toolbar
                        slotCommandBar.Controls.AddButton(m_addSlotOptionButton.ButtonDefinition, 0);
                        slotCommandBar.Controls.AddButton(m_drawSlotButton.ButtonDefinition, 0);
                        slotCommandBar.Controls.AddButton(m_toggleSlotStateButton.ButtonDefinition, 0);

                        //Get the 2d sketch environment base object
                        Inventor.Environment partSketchEnvironment;
                        partSketchEnvironment = userInterfaceManager.Environments["PMxPartSketchEnvironment"];

                        //make this command bar accessible in the panel menu for the 2d sketch environment.
                        partSketchEnvironment.PanelBar.CommandBarList.Add(slotCommandBar);
                    }
                    //create the UI for ribbon interface
                    else
                    {
                        //get the ribbon associated with part document
                        Inventor.Ribbons ribbons;
                        ribbons = userInterfaceManager.Ribbons;

                        Inventor.Ribbon partRibbon;
                        partRibbon = ribbons["Part"];

                        //get the tabls associated with part ribbon
                        RibbonTabs ribbonTabs;
                        ribbonTabs = partRibbon.RibbonTabs;

                        RibbonTab partSketchRibbonTab;
                        partSketchRibbonTab = ribbonTabs["id_TabSketch"];

                        //create a new panel with the tab
                        RibbonPanels ribbonPanels;
                        ribbonPanels = partSketchRibbonTab.RibbonPanels;

                        m_partSketchSlotRibbonPanel = ribbonPanels.Add("Slot", "Autodesk:SimpleAddIn:SlotRibbonPanel", "{DB59D9A7-EE4C-434A-BB5A-F93E8866E872}", "", false);

                        //add controls to the slot panel
                        CommandControls partSketchSlotRibbonPanelCtrls;
                        partSketchSlotRibbonPanelCtrls = m_partSketchSlotRibbonPanel.CommandControls;

                        //add the combo boxes to the ribbon panel
                        CommandControl slotWidthCmdCboBoxCmdCtrl;
                        slotWidthCmdCboBoxCmdCtrl = partSketchSlotRibbonPanelCtrls.AddComboBox(m_slotWidthComboBoxDefinition, "", false);

                        CommandControl slotHeightCmdCboBoxCmdCtrl;
                        slotHeightCmdCboBoxCmdCtrl = partSketchSlotRibbonPanelCtrls.AddComboBox(m_slotHeightComboBoxDefinition, "", false);

                        //add the buttons to the ribbon panel
                        CommandControl drawSlotCmdBtnCmdCtrl;
                        drawSlotCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_drawSlotButton.ButtonDefinition, false, true, "", false);


                        CommandControl slotOptionCmdBtnCmdCtrl;
                        slotOptionCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_addSlotOptionButton.ButtonDefinition, false, true, "", false);

                        CommandControl toggleSlotStateCmdBtnCmdCtrl;
                        toggleSlotStateCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_toggleSlotStateButton.ButtonDefinition, false, true, "", false);
                    }
                }

                MessageBox.Show("To access the commands of the sample addin, activate a 2d sketch of a part \n document and select the \"AddInSlot\" toolbar within the panel menu");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
 public DataToArray(PartDocument doc, ComboBoxDefinition cbDef)
 {
     this.doc = doc;
     def      = cbDef;
     addData();
 }