- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I would like to ask how it would be possible to open the file or multiple files from the Autodesk document in Revit via Revit API. I tried to use the OpenAndActiveDocument Method for a local file and it worked, so I would like to ask if this method works then how to get the Cloudfile path? How to get the File Path in the AutodeskDoc?
here is a sample
"
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.Attributes;
using System;
namespace OpenAutodeskDocFiles
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class Class1 : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiApp = commandData.Application;
string filePath = @Anonymous;
try
{
UIDocument uiDoc = uiApp.OpenAndActivateDocument(filePath);
TaskDialog.Show("Document Activated", "Successfully activated: " + uiDoc.Document.Title);
}
catch (Exception ex)
{
TaskDialog.Show("Error", "Failed to open and activate document: " + filePath + "\n" + ex.Message);
return Result.Failed;
}
return Result.Succeeded;
}
}
}
thanks
Solved! Go to Solution.