I am trying to open the Revit file from the zip folder in Design Automation for Revit, and getting an error:
> Autodesk.Revit.Exceptions.FileNotFoundException: The filePath:T:\Aces\Jobs\1532f21bb19d4605b941472d4961ed96\input.rvt to be opened doesn't exist.
I've tried with different parameters for "localname" and "pathInZip" but still get this error
I am opening my model with OpenOptions:
var path = ModelPathUtils.ConvertUserVisiblePathToModelPath("input.rvt");
var openOptions = new OpenOptions();
openOptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets;
Document doc = rvtApp.OpenDocumentFile(path, openOptions);
My activity:
{
"commandLine": [
"$(engine.path)\\\\revitcoreconsole.exe /al \"$(appbundles[AppBundle].path)\""
],
"parameters": {
"inputFile": {
"zip":true,
"verb": "get",
"description": "Input Revit model",
"required": true,
"localName":"input.rvt"
}
}
My workitem :
{
"activityId": "activityId",
"arguments": {
"inputFile": {
"pathInZip":"test.rvt",
"url": "https://developer.api.autodesk.com/oss/v2/buckets/my_bucket/objects/test.zip",
"Headers": {
"Authorization": "Bearer {{Bearer}}"
}
}
}
With the definition below, Design Automation will uncompressed the zip to a folder named as "input.rvt", then look for a file named as "test.rvt" inside the folder if needed.
"parameters": {
"inputFile": {
"zip":true,
"verb": "get",
"description": "Input Revit model",
"required": true,
"localName":"input.rvt"
}
"arguments": {
"inputFile": {
"pathInZip":"test.rvt",
"url": "https://developer.api.autodesk.com/oss/v2/buckets/my_bucket/objects/test.zip",
"Headers": {
"Authorization": "Bearer {{Bearer}}"
}
}
About usage of zip
and pathInzip
, you can refer to forge doc -->arguments
-->*
--> XrefTreeArgument
--> pathInZip
Or DWG Sheet Combination failing on AutoDesk Forge to see how you would like to use.
I've changed in My Activity "localname":"input" and in the workItem "pathInZip":"input.rvt" I am sending test.zip file with test.rvt inside. DA4R should unzip it to the folder :"input". After that it should take my file "test.rvt" and work with it. Thats great.Thank you. But what should i do if my file in the zip folder would be not "input.rvt"? I've used "input.rvt" as local param in my AppBundle.I need to change it. I've tried to pass the filename through console args without /i command. That didn't help
My issue is like this one stackoverflow.com/questions/55708612/… How can i set a localname to the file in the zip folder?
If I understand correctly, you have "test.rvt" in the zip as input, but your appbundles want to open a file named as "input.rvt"? If so, unfortunately, Design Automation will just uncompress the zip to a folder defined by "localname" and no renaming would happen on "test.rvt" unless the input is not a zip, but you define its "localname" as "input.rvt". Since the input zip is provided by yourself, could you just make sure renaming "test.rvt" or whatever to be "input.rvt" before posting the WI?
I tried to pass model name,by parameter in the additional json file that is defined in the activity.Then read this model name in the appbundle,and use it as Modelpath. That works fine.
Ok, glad it works. Since the inputs and appbundles are both provided by the customers, customers have much flexibility to play with them. :)