Implementing a Vault API utility in Revit through the Revit API

Implementing a Vault API utility in Revit through the Revit API

Anonymous
Not applicable
1,680 Views
6 Replies
Message 1 of 7

Implementing a Vault API utility in Revit through the Revit API

Anonymous
Not applicable

Hi everyone,

 

My name is Constantin, I work for an engineering consulting company in Montreal area and I'm a self-taught programmer with a solid experience with the AutoCAD API's (except the ObjectARX/C++) and some experience with the Revit API (C# and VB).

 

Lately I have been asked to do some custom programming and try to integrate Revit and Vault for a "simple" task like duplicating the "Insert From File" Revit command, as a custom external application using its own tab in the Revit ribbon menu (no problem with the ribbon integration), command which would be called something like "Insert From Vault File", since it has to open the source file from Vault!

 

It is my understanding that this command should use some Vault API calls from a Revit API utility and I think that this Checking in and out a file demo would be a good point to start, but the problem is that as far as I understand, this is a Vault custom API utility, but I need it to be implemented like a Revit utility, so that it could be triggered from Revit.

 

And here comes my question; is it possible to "manipulate" the Vault API from a Revit API custom command, therefore to implement this Checking in and out a file utility as a Revit custom command? Can you provide some code examples or some inspirational source(s) to suggest?

 

Thank you in advance and I hope I made myself clear enough,

 

Constantin

0 Likes
1,681 Views
6 Replies
Replies (6)
Message 2 of 7

Daniel.Du
Alumni
Alumni

The sample project you saw ("VaultBroswerSample" in Vault SDK) actually is a desktop application, technically speaking, Vault APIs are calling web services to vault server, so I do not see any reason why it cannot be used in Revit plugin (although I am not an expert of revit).



Daniel Du
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 7

Anonymous
Not applicable

I see its been a year plus since this post was created. Did you get anywhere with this project? I have been thinking of doing the same thing and was wondering if you got it to work.

 

Thanks

J.

0 Likes
Message 4 of 7

Anonymous
Not applicable

Hi Jeff,

 

It's been a while since I was struggling to implement this Vault connection using the Revit 2014 API.

 

Yeah, it is feasible and lot easier than I was expecting, even with my programming skills, which is something more of a “monkey see, monkey do” type, rather than something else (at least when it comes about the Vault API) Smiley Very Happy

 

Essentially, the Vault part is related only to the Vault connection and to a striped down version (modified for the Revit files) of the file browser control (Form1) used by Autodesk in the Vault SDK sample titled VaultBrowserSample, which can be found in C:\Program Files (x86)\Autodesk\Autodesk Vault 2014 SDK\VS10\CSharp (or ..\VB for instance).

 

In order to do this, you will need to reference the following libraries:

Autodesk.Connectivity.WebServices;

Autodesk.Connectivity.WebServicesTools;

Autodesk.DataManagement.Client.Framework;

Autodesk.DataManagement.Client.Framework.Vault;

Autodesk.DataManagement.Client.Framework.Vault.Forms;

 

So what I did, was basically to import that browser form and then copy/paste some chunks of code (from the aforementioned Vault SDK sample) related to the whole process and then tweak them in order to fit my particular needs.

 

We decided to go for a quiet background login (using AuthenticationFlags = WindowsAuthentication, in which case the username and the password are ignored), instead of using the standard Vault login form, but this is something that you’ll have to decide for yourself.

 

Other than that, once the warehouse RVT file is reclaimed from the Vault, a copy of the file is made in a specific, then using the plain Revit API, the program will retrieve and list all the available drafting, schedule, reports and sheet views, thus giving the user the opportunity to insert the elements what he needs.

 

When the job is done (or cancelled), the copy of the file is deleted and the Vault connection is closed.

 

And since “a picture is worth a thousand words”, the few attached screen shots will shed some extra light.

 

Hope this helps,

 

Constantin

 

 

 

0 Likes
Message 5 of 7

vidhubala_j
Explorer
Explorer
I am developing a custom Revit add-in and trying to replicate the native "Link from Vault" behavior.
In the built-in Vault Revit add-in, using the "Link" command allows a model to be referenced into the project while it remains Checked-In. However, in my custom implementation, calling the file retrieval process results in an automatic Checkout, which I want to avoid.
Questions:
  1. Is there a specific API method or service exposed that handles "Link from Vault" as a single operation, or is it strictly a two-step process of downloading then linking?
  2. When programmatically calling the file acquisition method, which settings or parameters are required to ensure a "Get" (read-only) operation to the local workspace rather than a "Checkout"?
  3. How does the native add-in determine the local path for the link to ensure it matches the Vault working folder without locking the file for other users?
0 Likes
Message 6 of 7

balachandar_vVF4MG
Contributor
Contributor
I am developing a custom Revit add-in and trying to replicate the native "Link from Vault" behavior.
In the built-in Vault Revit add-in, using the "Link" command allows a model to be referenced into the project while it remains Checked-In. However, in my custom implementation, calling the file retrieval process results in an automatic Checkout, which I want to avoid.
Questions:
  1. Is there a specific API method or service exposed that handles "Link from Vault" as a single operation, or is it strictly a two-step process of downloading then linking?
  2. When programmatically calling the file acquisition method, which settings or parameters are required to ensure a "Get" (read-only) operation to the local workspace rather than a "Checkout"?
  3. How does the native add-in determine the local path for the link to ensure it matches the Vault working folder without locking the file for other users?

 

0 Likes
Message 7 of 7

Markus.Koechl
Autodesk
Autodesk

To download a file with or without check-out, the AquireFileSettings can add the file with the required option (e.g., parameter "checkout"):

AcquireFilesSettings mDownloadSettings = new AcquireFilesSettings(_connection);
// set the default acquisition option to download only; this will apply to all files added to the settings unless specified otherwise
mDownloadSettings.DefaultAcquisitionOption = AcquireFilesSettings.AcquisitionOption.Download;

// set the acquisition option for this specific file according the parameter checkout
if (checkout)
{   // download and checkout
    mDownloadSettings.AddFileToAcquire(mFileIteration, AcquireFilesSettings.AcquisitionOption.Checkout | AcquireFilesSettings.AcquisitionOption.Download);
}
else
{  // download only
    mDownloadSettings.AddFileToAcquire(mFileIteration, AcquireFilesSettings.AcquisitionOption.Download);
}

 I hope this helps.



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes