Macro Automation

eVolve Macro Automation makes creating macros quicker and using them simpler. Utilize eVolve Element Filters to drastically cut down your codebase and allow it to be more universal. Your in-house team can write simple code blocks to handle the work and your team can decide how and when to use it through leveraging custom element filter rules.

Using a Macro

To use, you must first have an existing macro in your project. This macro will only need to handle the "work" needed as the firing mechanism and element collection will be handled by the Automation rule.

Below is a simple example that writes the Room Name of the room an element is in, to a custom shared parameter. Note that this block along with many others can be found here.

Location on the Ribbon

Once you have your Macro in the project, simply click the Macro Automation button from the Utilities panel.

Creating an Automation Rule

  1. Once inside, you will need to create a rule for your Macro. To do this.
    1. Click "Click here to add a new row."
  2. Assign a rule Rank
    1. This is used to sort your rules in the grid as well as assign run orders.
  3. Assign a rule Name
    1. This field allows you to simply name your rule to quickly identify its use.
  4. Pick your Filter Type
    1. You can either choose a simple Category based Filter or a more universal Element Filter. We will continue with an Element Filter for this example.
  5. Create/Choose your Element Filter
    1. Your element filter will be used to decide when to run the macro as well as what to run it on. To see more information on creating element filters see this article.
  6. Select your macro from the available Document Macros
    1. All macros apart of your project will be shown as options. Simply choose the one you would like to use
  7. Choose to set your rule to Auto (Optional)
    1. For macros that you would like to automate, simply click the Auto checkbox. This will ensure that anytime a part that matches your element filter is added or modified in the model, the macro will run.
  8. Enable your macro
    1. To toggle your macro on and off, use the Enabled checkbox.

Technical Notes

  • When a rule is satisfied, the respective Document Macro is queued for execution after the current Revit modify operation is complete.
  • The Macro must be at the project level. No application level macros will be available to use.
  • This feature does not honor dynamo scripts however these can be converted to their code equivalent and be used.
  • The target macro to execute is provided the Revit ElementIds which were captured as part of the process. This information is transmitted via a file named eV-[RuleName].txt (where "RuleName" is the respective Macro Automation rule name) which is placed within the current user's Windows temp folder. This can be used to access the elements from the condition. An example code block is below however it provided in a utility method can be also be found here.
  • //Begin Template
    var addedIds = Array.Empty<ElementId>();
    var modifiedIds = Array.Empty<ElementId>();

    // Extract all the added and modified id's impacted by this rule.
    var elementIdFile = System.IO.Path.Combine(System.IO.Path.GetTempPath(), string.Format("eV-{0}.txt", MacroAutomationRuleName));
    if (System.IO.File.Exists(elementIdFile))
    // File contains added ids on the first line and modified on the second.
    var elementIds = System.IO.File.ReadAllText(elementIdFile).Split(new string[] { Environment.NewLine }, StringSplitOptions.None)
    .Select(ids => ids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))

    addedIds = elementIds[0].Select(id => new ElementId(int.Parse(id))).ToArray();
    modifiedIds = elementIds[1].Select(id => new ElementId(int.Parse(id))).ToArray();

    if (!addedIds.Any() && !modifiedIds.Any())
    // Nothing of consequence.
    //End Template

How did we do?

Powered by HelpDocs (opens in a new tab)

Powered by HelpDocs (opens in a new tab)