Share

Automated Publish Utility for Revit

With Assemble’s automated publish utility for Revit, users can publish a group of models using the Windows command line interface. This saves time when publishing several models on a routine basis. With this utility, you can set up a routine script or batch file to run against a set of projects, models, or model versions.

Note: We try to close the various Revit dialog boxes specific to each model being opened. If we can't close all the opening dialog boxes boxes, the model is skipped and the process moves to the next model.

To publish your set of Revit models

  1. The automated publish utility uses the name of its folder as the Project name. Organize models into folders with the project names. Subfolders are included in the publishing process.

  2. Open the Command prompt and type the following command, substituting your username in the "name@" portion:



 assemble publish "c:\YOUR MODEL FOLDER LOCATION" -s "http://demo.tryassemble.com/" -e "name@assemblesystems.com"
  1. After this command, you are prompted to enter your password. Once you enter your password, the command launches Revit and publishes each model within the selected folder, including any models in subfolders.

  2. Additional options include ignoring links (--ignore-links) and configuring the model name and version name (-c "c:\CONFIG FILE PATH\filename.json").

    Note: When running this command, the publisher steps through each Revit file and opens the appropriate version (Revit 2017-2020 supported). If you do not have the associated version of Revit installed, the model is skipped. If links are not ignored, the process starts with the model that contains the most links.

    img


Required Variables

Publish Directory: “C:\Users\Admin\Documents\BatchPubFolder” Provide the directory path, within quotes. Any Revit files within the directory will be processed.

Site Name: Provide your site name in quotes preceded by “-s” or “--site”:


-s or --site "https://demo.tryassemble.com"

Optional Variables

Ignore Links: -i or --ignore-links

Publish Sheets: -a or --all-sheets

Configure Model and Version Naming: -c “C:\Users\Admin\Documents\ModelNameConfig.json” Provide file path to JSON config file. See Configuration File below.

Project Name

To allow for flexibility, the project name is the name of the folder it's in. This means that you can publish models for multiple projects within the same batch process. If you specify a folder that contains three subfolders (Project A, Project B, and Project C) each containing Revit models, you are publishing to Project A, Project B, and Project C within Assemble. If the project does not exist within Assemble, a new project is created.

Model Name

By default, the model name is the same as the Revit file name. If the model exists within the selected project, a new version is created. If not, a new model is created. If you specify a configuration file, you can use a substring of the file name. See Configuration File below. An example would be to split “Architecture_revision5.rvt” into the model name “Architecture” as defined in the configuration file.

Note: Be careful if your typical model name includes the version or date within the file name. Without using a configuration file, this results in a new model for each version and you will not be able to compare versions within Assemble.

Version Name

By default, the version name will be the timestamp generated when the publish begins. If you specify a configuration file, you can use a substring of the file name. In the same example as above, “Architecture_revision5.rvt” can result in the version name “revision5” as defined in the configuration file.

Configuration File

We are currently using a regular expression (or regex) stored in a JSON file to allow you to parse a model name and version name from Revit. Below is an example of using a regular expression to parse the Revit file name for the model and version:

Models:

Some_Model_XYZ_Rev0.5.rvt

Some_Model_XYZ_Rev0.8.rvt

Regular Expression (JSON):

{

"modelNameExpression": "((?<name>.+)_rev(?<version>.+)\\.rvt)|(?<name>.+)\\.rvt)"

}

Results

Model: Some_Model_XYZ Version: 0.5 and 0.8

Model: Some_Model_ABC Version: 1

In this situation, “modelNameExpression” is the Revit file name and (?.+) is taking the text before “_rev” and (?.+) is taking the text after “_rev” and before .rvt. The second (?.+) after the bar (|) is in the situation that “_rev” is not included in the file name, it will take all text before “.rvt” as the model name. To create your own, you can copy this text into a text editor and specify the delimiting text where you see “_rev” and save the file as “YourFileName.json”

If additional customization assistance is required, please contact https://knowledge.autodesk.com/contact-support.

Was this information helpful?