Main Menu

search

You are here

FreeCAD: Save Macro to Toolbar

[last updated: 2024-02-25]
FreeCAD home page

FreeCAD Macros
-----

  • Add your new macro to a toolbar: (for single-click execution)
    • Open Customize window:
      click menu: Tools --> Customize
      - or - position cursor over toolbar, right-click to open the context menu, select Customize.
      The Customize box will open.
    • Select Macros tab:
      Click the Macros tab at the top.
      Notice the top line/field, labeled Macro:
      We want the HelloWorld macro to be in that field. If some other macro is listed, then click the down-caret at the right end of the field
      to bring up a list of available macros. Select the HelloWorld macro
    • Enter Menu text:
      In the next field, you must enter some text to describe your macro in the menu.
    • The remaining fields (Tool tip, Status text, "what's this, and Accelerator) are optional for documentation/convenience and can be left blank.
    • Select icon for your toolbar button:
      What IS necessary, however, is to select the icon you want to have in your toolbar to execute your new macro.
      Click Pixmap button below the list of entry fields.
      The Choose Icon box will open, listing a few hundred available icons to choose from.
      Click to select one, and the Choose Icon box will close, and your chosen icon will be shown beside the Pixmap button.
      Click Add
      Notice your new macro icon will now be listed in the Setup Custom Macros box on the left side of the Customize box.

    • Select the Workbench/Toolbar where you want to put your new macro:
      • Each FC WB has an associated toolbar.
        You can create/define a custom, add-on toolbar for any workbench.
        If you do that, then your custom macro, that you've added to your custom toolbar,
        will be displayed on the same line as the other icons that are pre-defined for that WB.


        If you want your icon/macro to be available on all workbenches, select Global.

      • Click Toolbars tab at the top of the Customize box.
        Notice the left box, and its header field, which will probably show its default "File" selection.
        Click the down-caret at the right end of the header field to show the drop-down list of options.
        Scroll down and select "Macros"
          Do not be confused:
          There is also a selection named "Macro"
          That's not the one you want.
          You want "Macros"

        Notice your new macro icon will now be shown in the left-hand box.

      • Notice the right-hand window (recall we're at: Tools --> Customize --> Toolbars)
        The header field at the top will show the WB that you have selected for your drawing.
        If you've just opened FC, then it will show the "Start" WB.
        If you want to put your new macro into a different WB, you can select it by clicking on the drop-down caret at the right end of the header field.

      • Notice the right-hand window.
        If it's empty, then you do not have any custom, add-on toolbars defined for this WB,
        so in order to add your macro to this WB, you must create one.
        • Click New (right-side menu)
          A New toolbar box will open, where you can enter your desired name for this new toolbar.
          Click OK

      • Now there will be a line item in the right-hand window, showing the custom, add-on toolbar that you just created.
          Add your macro to the custom toolbar:
        • Select your desired macro in the left-hand window:
          In the header field for the left-hand window, select Macros (remember the plural)
          All your macros should be listed.
          Click to highlight the one you're adding to the toolbar.
        • Select your desired toolbar in the right-hand window:
          In the right-hand window, click to highlight the add-on toolbar of your choice
          (perhaps the one you've just defined, or perhaps one you created previously).
        • Move the macro into the toolbar:
          Click the right-arrow icon in the center between the two windows.
          You should see your macro now listed in the right-hand window,
          under and indented from your chosen custom toolbar.
        • Click close, close and restart FC, and you should see your new macro listed above in your desired toolbar.

      -----------------------------------------------------------------------

    • Other tips for navigating in the Customize window:
        OK, so huge kudos to FC developers for all the work they continue to do, but this UI is difficult.
        So here are some tips that are not obvious that will help you.
      • In Customize --> Toolbars,
        the right-hand window will show a list of custom, add-on toolbars that you've created,
        and underneath each will be a list of the macros that you've added to each toolbar.
        • to delete a toolbar:
          click to highlight/select the toolbar,
          click Delete button on the right side
        • to delete a macro from a toolbar:
          click to highlight/select the macro,
          click the left-pointing arrow in the center between the windows.

      -----------------------------------------------------------------------