コード例 #1
0
        public void InitUI(AddInServer addIn, bool firstTime, Inventor.Application inventorApplication)
        {
            m_inventorApplication      = inventorApplication;
            Button.InventorApplication = m_inventorApplication;

            //load image icons for UI items
            Icon ChangeParamIcon = new Icon(this.GetType(), "ChangeParam.ico");

            //retrieve the GUID for this class
            GuidAttribute addInCLSID;

            addInCLSID = (GuidAttribute)GuidAttribute.GetCustomAttribute(typeof(AddInServer), typeof(GuidAttribute));
            string addInCLSIDString;

            addInCLSIDString = "{" + addInCLSID.Value + "}";

            m_ChangeParamButton = new ChangeParamButton(addIn,
                                                        "ChangeParam", "Autodesk:ChangeParamAddIn:ChangeParamCmdBtn", CommandTypesEnum.kShapeEditCmdType,
                                                        addInCLSIDString, "Changes a part param",
                                                        "ChangeParam", ChangeParamIcon, ChangeParamIcon, ButtonDisplayEnum.kDisplayTextInLearningMode);

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

                InterfaceStyleEnum interfaceStyle;
                interfaceStyle = userInterfaceManager.InterfaceStyle;


                //get the ribbon associated with part document
                Inventor.Ribbons ribbons;
                ribbons = userInterfaceManager.Ribbons;

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

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

                RibbonTab partViewRibbonTab;
                partViewRibbonTab = ribbonTabs["id_TabModel"];

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

                RibbonPanel appearancePanel = ribbonPanels["id_PanelP_ModelModify"];

                CommandControls panelCtrls = appearancePanel.CommandControls;
                CommandControl  ChangeParamCmdBtnCmdCtrl;
                ChangeParamCmdBtnCmdCtrl = panelCtrls.AddButton(m_ChangeParamButton.ButtonDefinition, false, true, "", false);
            }
        }
コード例 #2
0
 public ChangeParamButton(AddInServer addInServer, string displayName, string internalName, CommandTypesEnum commandType, string clientId, string description, string tooltip, ButtonDisplayEnum buttonDisplayType)
     : base(displayName, internalName, commandType, clientId, description, tooltip, buttonDisplayType)
 {
     m_addInServer = addInServer;
 }