This repo contains supporting files, scripts and documentation that can help streamline onboarding and running Dynamo graphs in Design automation for Revit.
- Create an
AppBundle
, a collection of dlls that represents a revit cloud addin. - Publish an
Activity
, metadata that describes some of the characteristics of the job that will run your AppBundle, like the inputs and outputs. - Upload files to
Cloud Storage
, the files that will be referenced by the Activity. - Submit a
WorkItem
, a job. - Download the
Results
.
Revit add-in on Design Automation Walkthrough
- Go to APS Developer portal.
- Create an app.
- Grab the Client ID and Client Secret.
- Clone this repo to your local system.
- To use postman, download and install it from here.
- There are 2 files you need to import in the postman app, a collection and an environment file.
- Set the current environment to the loaded DA4DynamoRevit
- Set the work directory in postman to the location where you cloned this repo locally
For general instructions see the Walkthrough.
Below there are instructions on how to use postman to run design automation work items.
Switch to the Execute a Dynamo Revit Add-in
collection and go through the Tasks one by one.
Some of the tasks also contain Delete
commands which can be helpful if you want a clean slate.
-
Task 1 - Convert Revit Add-in.
- The addin is already created and you find it at DynamoRevitDA.zip.
- If you need to use python nodes please also see pythonDependencies.zip.
- If you need to run dynamo packages, you can zip up the packages in a single zipped with the name
packages.zip
. See this example packages.zip.
-
Task 2 – Obtain an Access Token.
- Run the
Get an Access Token
request in theTask 2 - Obtain an Access Token
section of the postman collection.
- Run the
-
Task 3 – Create a Nickname.
- Run the
Create Nickname
request in theTask 3 - Create a Nickname
section of the postman collection.
- Run the
-
Task 4 – Upload the AppBundle.
- Register the AppBundle by running
Register the AppBundle
request. - Upload the AppBundle by running the
Upload the AppBundle
request. - Create an alias for the AppBundle by running the
Create an Alias for the AppBundle
request.
- Register the AppBundle by running
-
Task 5 – Publish an Activity.
- Create a new Activity by running the
Create a New Activity
request. - Create an alias for the Activity by running the
Create an Alias to the Activity
request. Notes:
The activity must use specific parameters to be compatible with the dynamo AppBundle.
-
parameters - the DynamoAddin requires the following parameters (but not limited to):
- An
.rvt
file (get parameter) on which to operate (will be automatically opened as the current revit model). You can use DeleteWalls.rvt as an example. - A
run.json
file (get parameter). This must respect the Player specifications for a GraphRunRequest. You can use run.json as an example. - A
pythonDependencies.zip
(get parameter). This zip can be downloaded from pythonDependencies.zip. It contains the Python.Included.dll and Python.ScyPy.dll normally included with Dynamo out of the box. These must be uploaded separately from Dynamo because they are too large to bundle up with the DynamoAddin (DesignAutomation has a size limit on the AppBundles you can upload set at 100 MB). - A
result.json
(put parameter) can be included. This file will contain the graph run output (as produced by Dynamo Player). - A
result.rvt
(put parameter) can be included in order to download it. This file will contain the provided revit model after the dynamo run.
Here is an example of an activity:
curl -X POST 'https://developer.api.autodesk.com/da/us-east/v3/activities' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer <ACCESS_TOKEN>' \ -d '{ "id": "DeleteWallsActivity13", "commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /i \"$(args[rvtFile].path)\" /al \"$(appbundles[DynamoDATest].path)\"" ], "parameters": { "rvtFile": { "zip": false, "ondemand": false, "verb": "get", "description": "Input Revit model", "required": true, "localName": "$(rvtFile)" }, "runRequest": { "zip": false, "ondemand": false, "verb": "get", "description": "Input Revit model", "required": false, "localName": "run.json" }, "pythonLibs": { "zip": true, "ondemand": false, "verb": "get", "description": "Python libs", "required": false, "localName": "pythonDependencies" }, "dynResult": { "zip": false, "ondemand": false, "verb": "put", "description": "Results", "required": false, "localName": "result.json" }, "rvtResult": { "zip": false, "ondemand": false, "verb": "put", "description": "Results", "required": false, "localName": "result.rvt" } }, "engine": "Autodesk.Revit+2026", "appbundles": [ "DynamoDATest.DynamoDATest+test" ], "description": "Deletes walls from Revit file." }'
- An
- Create a new Activity by running the
-
Task 6 – Prepare Cloud Storage.
- If not already created, run the
Create a Bucket
request to create a bucket for all storage items. - The get parameters described at the previous step must be uploaded as individual files. Run all the requests in the
Task 6 - Prepare cloud storage
folder.- The
.rvt
file - run the tasks inside theRvtFile
subfolder. - The
run.json
file - run the tasks inside theRvtFile
subfolder. - The
run.dyn
file - run the tasks inside theRvtFile
subfolder. - The
pythonpythonDependencies.zip
- run the tasks inside theRvtFile
subfolder. - The
packages.zip
- run the tasks inside thepackages.zip
subfolder.
- The
- If not already created, run the
-
Task 7 - Submit a WorkItem.
- Submit a workitem by running the
Create a WorkItem
request. - Check the work status by running the
Check Status of a WorkItem
request.
Here is an example of an activity:
curl -X POST 'https://developer.api.autodesk.com/da/us-east/v3/workitems' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer <ACCESS_TOKEN>' \ -d '{ "activityId": "DynamoDATest.DeleteWallsActivity7+test", "arguments": { "rvtFile": { "url": "urn:adsk.objects:os.object:dynamodatestbucket/DeleteWalls.rvt", "verb": "get", "headers": { "Authorization": "Bearer <ACCESS_TOKEN>" } }, "runRequest": { "url": "urn:adsk.objects:os.object:dynamodatestbucket/run.json", "verb": "get", "headers": { "Authorization": "Bearer <ACCESS_TOKEN>" } }, "pythonLibs": { "url": "urn:adsk.objects:os.object:dynamodatestbucket/da_files/pythonDependencies.zip", "verb": "get", "headers": { "Authorization": "Bearer <ACCESS_TOKEN>" } }, "dynResult": { "url": `urn:adsk.objects:os.object:dynamodatestbucket/result.json`, "verb": "put", "headers": { "Authorization": `Bearer <ACCESS_TOKEN>` } }, "rvtResult": { "url": `urn:adsk.objects:os.object:dynamodatestbucket/result.rvt`, "verb": "put", "headers": { "Authorization": `Bearer <ACCESS_TOKEN>` } } } }'
- Submit a workitem by running the
-
Task 8 - Download the Results
- Run the
Get S3 Download URL for Resulting RVT file
andDownload Resulting RVT File
tasks to download the revit file. - Run the
Get S3 Download URL for result.json
andDownload Result.json
to download the dynamo output. The result will look like this
- Run the
You can perform above tasks using scripts in this repository.
Important
Copy .env.example
and save it as .env
and fill in the CLIENT_ID
and CLIENT_SECRET
and update other fields as needed.
Important
- Install jq.
- Prepare environment variables.
- You can use direnv to load values from
.env
as environment variables. - Alternatively, you can copy use an
.envrc
file..envrc.example
and save it as.envrc
and source itsource .envrc
to load the environment variables.
- You can use direnv to load values from
You use these bash scripts to perform all of the tasks listed above. e.g ./scripts/get_appbundles.sh
.
-
Task 1 - Convert Revit Add-in
- Download addin -
./scripts/download_artifacts.sh
- Download addin -
-
Task 2 – Obtain an Access Token
- Get access token -
./scripts/get_access_token.sh
- Get access token -
-
Task 3 – Create a Nickname
- Create nickname -
./scripts/create_nickname.sh <nickname>
- Create nickname -
-
Task 4 – Upload the AppBundle
- Register the AppBundle -
./scripts/register_appbundle.sh <app_id>
=> output<appbundle_json>
- Upload the AppBundle. Use DynamoRevitDA.zip. -
./scripts/upload_appbundle.sh <appbundle_json>
. - Create an alias for the AppBundle. -
./scripts/create_appbuldle_alias.sh <app_id> <app_alias>
- Create a new version of the AppBundle. -
./scripts/update_appbundle.sh <app_id>
- Point the alias to the new version of the AppBundle. -
./scripts/update_appbundle_alias.sh <app_id> <app_alias> <app_version>
- Register the AppBundle -
-
Task 5 – Publish an Activity
- Create activity -
./scripts/create_activity.sh <nickname> <app_id> <app_alias> <activity_id>
=> outputactivity.json
- Create activity alias -
./scripts/create_activity_alias.sh <activity_id> <activity_alias>
- Download report. Report will look like this -
./scripts/download_report.sh
- Create activity -
-
Task 6 – Prepare Cloud Storage
- Create bucket -
./scripts/create_bucket.sh <bucket_key>
=> outputbucket.json
- Create signed upload url -
./scripts/create_signed_upload_url.sh <bucket_key> <object_key>
=> output<object_key>_upload.json
- Upload file to bucket -
./scripts/upload_to_bucket.sh <upload_json> <file>
- Complete upload -
./scripts/complete_upload.sh bucket_key> <object_key> <upload_json>
The get parameters described at the previous step must be uploaded as individual files:
- The
.rvt
file - The
run.json
file - The
run.dyn
file - The
pythonpythonDependencies.zip
- Create bucket -
-
Task 7 - Submit a WorkItem
- Create workitem -
./scripts/create_workitem.sh <nickname> <activity_id> <activity_alias> <bucket_key>
=> outputworkitem_<timestamp>.json
- Get workitem status -
./scripts/get_workitem_status.sh <workitem_id>
=> outputworkitem_<workitem_id>.json
- Get report -
./scripts/get_report.sh <workitem_status_json>
=> outputreport.txt
- Create workitem -
-
Task 8 - Download the Results
- Create signed download url -
./scripts/create_signed_download_url.sh <bucket_key> <object_key>
=> output<object_key>_download.json
- Download result -
./scripts/download_result.sh <download_json> <file>
Result will look like this
- Create signed download url -
Important
Install nodejs.
Run npm install
You can also use this js script for all the update tasks once the resources are created. e.g node design_automation.js all
.
- Run
node design_automation.js all
to set up all tasks (from 2 to 8) - You can also run individual tasks, by specifying one or more of the following arguments:
nick
- Creates a nicknamebundle
- Creates an app bundleactivity
- Creates an activityrvt
- Uploads the revit filepython
- Uploads the pythonDependencies.ziprun
- Uploads the run.json requestwork
- Creates and submits a WorkItem requestresult
- Polls for results (ands saves the results locally log.txt, result.json and result.rvt)
Design Automation Tools portal.
Tip
You can also see your AppBundles, Activities and WorkItems in Design Automation Tools portal.
Autodesk Platform Services vscode extension.
Tip
You can browse your APS resources in VSCode with Autodesk Platform Services extension.