Wednesday, 22 July 2015

Running a Macro from a Ribbon Button

Follow these steps:

1. Right click on any button on the Ribbon and select Customize the Ribbon... from the context menu that appears.

SNAGHTMLf92b49

Or, from the Solid Edge title bar, click the Customize button which appears as a small arrow pointing down and select Customize... from the menu.

image

2. In the Customize dialog and on the right side, a tree view is seen with expandable and collapsible nodes like folders in Windows Explorer.

Each node represent a tab on the ribbon viz. Home, Sketching, Inspect, Tools, View, etc.

image

To add a new group, expand a node, say the View node, and select Style. Then click the New Group button if you want to create a new group.

3. A new group node is added after the Style group and before the Window group. This means the node after which you need to place the group should be picked first. The new group is create just below i.e. after the one that is currently picked when clicking the New Group button.

18_thumb1 Select the node and press F2 to edit the name of the node. Type a new name and press <ENTER>.

In this example, the node that represents the group is named Search since the example demonstrates adding the
search macro in this group.

image You can directly create a button in an existing group without creating a new group fro adding a button.

4. Select the Search node and from the left side of the dialog, select Macros from the list for 'Choose commands from..'

19_thumb2

5. Click the Browse... button at the bottom of the list and navigate to the folder where you saved the macro downloaded from this site or compiled one of your own.

Keep the Search node selected and pick the .exe File name from the list on the left Then click the Add >> button which adds the command to the Search group.

21_thumb2

Difference between pre-ST and ST versions when assigning a button icon

In SE ST 4 or lower, a dialog appears prompting to pick a image or icon for the button. You can copy this image 20_thumb2 and save to your computer and pick it from there. This binocular icon is assigned to the Search button.

22_thumb2

6. If you are on SE ST 4 or higher, simply placing the image in the same folder as the exe works. the rule is - both the exe and image name should be the same.

24_thumb1

7. right-click the search.exe node twice and change the settings to Large button and No text successively.

23_thumb2

7. Click OK ad select Yes in the prompt that appears for saving the theme.

The Search button in large size and without text is found sitting neatly in the Search group between in the Style and Window groups:

25_thumb2

To assign a universal shortcut Ctrl+F to this button, follow these steps:

1. Right-click on the Search button and select Customize the Ribbon...  to open the Customize dialog again.

2. Take the Keyboard tab and follow the sequence as depicted below to set the keyboard shortcut Ctrl+F to the Search command:

26_thumb2


Index of all Solid Edge Tips, Tutorials and Videos...