The ilxButtonPanel
After installation two elements are added to the interface.
A new ribbon tab named ilxButtons. This tab can be customized to hold the controls added from rules.
And a side panel that custom buttons can be added to from rules. The side panel can be closed if it does not need to be shown.
Configure iLogic to reference the ilxButtonPanel support files. On the Tools menu select the Options flyout panel. Pick the "Setup Button Rules" button. This will add the ilxButtonPanel support folder to the iLogic configuration.
If you are upgrading from version 1.0 and have the file ilxBtnPanel.vb in a custom directory this file can be removed.
2. Add the snippets for the ilxButtonPanel API (OPTIONAL)
To aid and simplify adding controls using the ilxButtonPanel API snippets can be added to you iLogic rule editor. (Note: This step is NOT required for the Addin to work.)
To add the snippets open a document in the editor and edit a rule or create a new rule. Switch to the snippets panel and click the merge button.
Navigate to the ilxButtonPanel installation and select the file ilxBtnPanelSnippets.xml. In a typical installation this will be located at "C:\ProgramData\Autodesk\ApplicationPlugins\JaytekDevelopment_ilxButtonPanel.bundle\Contents\".
Click the save button to apply the merged snippets.
Two new categories, "ilxButtonPanel: Side Panel and ilxButtonPanel: Ribbon", will have been added.
The ilxButton Panel addin looks for three rules to automatically run to add controls to the ribbon or button panel. An external ruled named AddGlobalButtons, an external rule named AddButtons, and an internal document rule named AddButtons. Check the option "Don't run automatically" on these rules. The Addin will run the rules automatically.
AddGlobalButtons: An external rule that runs only once at the beginning of a session. The controls added in this rule should only be global buttons and fire only external rules. (Note: If this rule is in the folder of an iLogic rule directory it will be run. Remove from all the iLogic directories if it's not to be used.)
AddButtons (external): An external rule that runs for every document that is opened for editing. The controls added in this rule should be external rules. The rules fired should be rules that are not specific to a particular document. The controls added should only be added to the default document ribbon panel or side panel.
AddButtons (internal): An internal rule that runs when the document is opened for editing. The controls added should only be added to the default document panel, custom named panels or the side panel. The rules fired can be internal or external rules. These controls are specific to the the document containing this rule.
It is not required for all three rules to be present. But atleast one of the rules are needed to have rules automatically added to the ribbon or side panel.
Controls can be added from any rule but it is recommended to add them from one of the three automatically run rules.
This example will add a button control to the ribbon.
Create and save a new part document. (Document rules can only be added to saved documents.)
Create a new Internal rule named TestButton.
In the rule add this line.
MessageBox.Show("A ribbon button was pressed.")
Next, create a new internal rule named AddButtons. Copy and paste these lines to it.
'Reference the ilxBtnPanel Addin AddVbFile "ilxBtnPanel.vb" 'Set a reference to the Button Panel First ilxBtnPanel = ilxBtnPanelVB.GetBtnPanel(ThisDoc.Document, ThisApplication) 'Add a document level rule. Rules can be in the document or external. ilxBtnPanel.AddRibbonButton("btnDocumentTest", "Document Rule", "TestButton", False)
One button with the label with the default icon will be added to the Document's controls panel on the ribbon. The button will only be displayed when the document that added the button is the active document. When the document window is closed the button will be removed from the ribbon. This rule will also automatically be run the next time this file is opened readding the button to the ribbon.
There are a variety of different ribbon controls that can be added. (See Extended Help and ilxButtonPanel API)
Buttons can be added from any rule but it is recommended to add them from one of the three automatically run rules.
Sample rule adding buttons to the side panel.
'Reference the ilxBtnPanel Addin AddVbFile "ilxBtnPanel.vb" 'Set a reference to the Button Panel First ilxBtnPanel = ilxBtnPanelVB.GetBtnPanel(ThisDoc.Document, ThisApplication) 'Add a global button. Global buttons must fire external rules. ilxBtnPanel.AddButton("btnGlobalTest", "Global Rule", "TestRuleExternal", "GLOBAL", True) 'Add a document level rule. Rules can be in the document or external. ilxBtnPanel.AddButton("btnDocumentTest", "Document Rule", "TestRule")
All buttons can also have an image added to them. (See API)
When this rule is run two buttons will be added to the Button Panel. One to the global panel and one to the document panel.
Adding buttons that are conditionally displayed. This is especially useful if you need rules to be run only in specific conditions or a specific order.
'Reference the ilxBtnPanel Addin AddVbFile "ilxBtnPanel.vb" 'Set a reference to the Button Panel First ilxBtnPanel = ilxBtnPanelVB.GetBtnPanel(ThisDoc.Document, ThisApplication) 'Conditional Sample ilxBtnPanel.AddButton("btnAssignPartNumber", "(1) Assign Part Number", "PartAssignNumber", True) ilxBtnPanel.AddButton("btnCfgPart", "(2) Configure Part", "PartConfigure", True) ilxBtnPanel.AddButton("btnGenerate", "(3) Generate Part*", "PartGenerate", True)
When this rule is run three buttons are added to the document panel that fire external rules. This rule can also be added to a rule named "AddButtons" in the document. Whenever this document is opened the AddButtons rule is automatically run adding any buttons defined in it. Another rule can be run that handles the visibilty of specific buttons as defined below.
After the buttons are added, using the parameters NumbersAssigned and PartConfigured in the document as conditionals, the buttons are hidden and/or shown.
Another document level rule can be created to control the visibility of the buttons.
'Reference the ilxBtnPanel Addin AddVbFile "ilxBtnPanel.vb" 'Set a reference to the Button Panel First ilxBtnPanel = ilxBtnPanelVB.GetBtnPanel(ThisDoc.Document, ThisApplication) 'Hide/show buttons If Not NumbersAssigned Then ilxBtnPanel.HideButton("btnCfgPart") ilxBtnPanel.HideButton("btnGenerate") Else ilxBtnPanel.HideButton("btnAssignPartNumber") ilxBtnPanel.ShowButton("btnCfgPart") If PartConfigured Then ilxBtnPanel.ShowButton("btnGenerate") Else ilxBtnPanel.HideButton("btnGenerate") End If End If
If NumbersAssigned is false the buttons 'btnCfgPart' and 'btnGenerate' are hidden. Leaving only the button 'btnAssignPartNumber' visible.
Setting the parameter NumbersAssigned to true will show the 'btnCfgPart' button.
Using parameters and rules allows the appropriate buttons to be displayed during the design process.
Review the ilxButtonPanel API to see all the available functions.