sfaust
sfaust

Reputation: 2363

Revit Design Automation Control Open Process with Dynamic File Name

We have a design automation application for Revit that handles models from BIM 360 and we would like to open models using our own process so we can modify what worksets are opened, etc. We have found the link at https://www.autodesk.com/autodesk-university/class/Getting-Started-Design-Automation-Revit-Forge-2019#handout. According to that, though, you have to hard code the name of the rvt file as a specific name in order to open it. However, we have some places that the name of the model is used in the exported data so we would like to keep the name as it originally appeared.

Is it possible to reference the command arguments from within the application? Right now we have our parameter for the model on the activity defined as follows:

    "rvtFile": {
        "zip": false,
        "ondemand": false,
        "verb": "get",
        "description": "Input Revit Model",
        "required":true,
        "localName": "$(rvtFile)"
    },

And the command line looks like this:

"commandLine":["$(engine.path)\\\\revitcoreconsole.exe /i \"$(args[rvtFile].path)\" /al \"$(appbundles[{{ BundleId  }}{{ RevitVersion }}].path)\""]

So the local name is dynamic and is just opened by DA using the command line. However since we want to control the opening process we need to pull the Revit file out of the command line and be able to figure out the path to the file to be opened. I'm not sure how to do this reliably since it's dynamic; any help would be appreciated.

Upvotes: 2

Views: 318

Answers (1)

Rahul Bhobe
Rahul Bhobe

Reputation: 4451

Following the blog announcement, Design Automation for Revit (revitcoreconsoole.exe) by default preserves the worksets for /i \"$(args[rvtFile].path)\" arguments. You no longer have to use the hard coded name on the input file and try opening the model yourself. You should be able to use dynamic file name.

Improved the default behavior for opening and saving models that have worksharing enabled, in order to preserve worksets on open, and support saving the model as a new central.

Upvotes: 1

Related Questions