Autodesk View and Data API

I was away for a few days last week in the beautiful Italian speaking southern part of Switzerland.

Back again, as usual, I am confronted with a host of Revit API issues.

The most important event last week for me by far, though, was the release of the Autodesk View and Data API.

Some of my Autodesk University related tasks and upcoming meetup events are also related to that:

Autodesk View and Data API

As said, Autodesk released its new web based View and Data API.

I will not go into any details, because full documentation and samples are provided:

Full API documentation and access to request an API key is provided by the Autodesk Developer Portal.

Support is available through the Autodesk Community > Web Services API > View and Data API discussion group.

Samples are provided in the GitHub View and Data API sample repositories.

The best way to get started is by hitting the appropriately named 'Get Started' button on developer.autodesk.com and working through the seven simple steps in the Quick Start document:

  1. Register for an API key and create an application
  2. Get your access token
  3. Create a bucket
  4. Upload a file
  5. Set up References Between Multiple Files
  6. Register Your Data with the Viewing Services
  7. Load the URN in the JavaScript viewer

Oops.

I said 'released'. Reading Stephen Preston's welcome message to the forum, I note that "we expect the API to become 'public' very soon". If you'd like to be informed when that happens, then please reply to the Tell me when this API is public thread, making sure to include your name, company and contact details. API keys are currently only provided to pilot program participants.

View and Data API Presentation at Basel.js Meetup and Autodesk University

I'll discuss and demonstrate the new View and Data API at the next Basel.js meetup with the title New 3D Geometry Viewer for Web:

"You may have created fantastic 3D designs. Isn't it frustrating that your website is all in 2D? Now you can very easily embed stunning, interactive, intelligent 3D models into your web page, web application, or desktop application. We'll look at some demos showing what is possible, and cover the simple steps to create a 3D-enabled website."

Stephen Preston is presenting on this topic at Autodesk University 2014 in Las Vegas, and I will do the same at the German-speaking event in Darmstadt.

Autodesk University Advance Passes

By the way, AU attendees can buy Advance Passes before the normal AU registration opens. That gives you the following important benefits:

Advance Pass holders can register starting on August 20, 2014, one week before Open Registration starts on August 27, 2014.

Retrieving Support Information for an Element

Question: I would like to know which element sits on top of the other.

For example, I have a floor element sitting on top of 10 columns. I would like to know which columns support the floor.

Alternatively, if I have 10 columns on top of a floor 'X', I would like to know how to extract the information for each column to know that a floor supports this column and the floor is 'X'.

Please let me know if this is possible in Revit.

Answer: Of course, this is definitely possible in Revit.

In a properly designed structural model, you would simply make use of the analytical model to determine this information, e.g. via the AnalyticalModel.GetAnalyticalModelSupports method.

Each AnalyticalModelSupport class instance represents one support for a structural element in the realm of the Analytical Model.

If your model is not structural or has been incompletely specified, there are a number of different approaches available to determine the neighbouring elements below a given element via ray casting or geometrical analysis.

An overview and examples of several different approaches is provided by the analysis of how to determine supporting columns.

Inserting a Family Symbol from a Type Catalogue

Question: Is there any API support for loading a family and creating a symbol from a type catalogue?

If not, I assume that I can write my own code for parsing the catalogue and create the symbol myself. Can you see a problem with that?

Answer: That sounds perfectly sensible. I see no problem with that whatsoever.

You can load a family, either entirely with all its symbols or just one specific type, using the LoadFamily and LoadFamilySymbol methods. Here are some thoughts and background information on loading selected family types.

By type catalogue, I assume you mean the text file specifying a list of possible dimension combinations?

I do not believe the Revit API provides support for that, so it might indeed be best to parse the file yourself and extract the desired dimensions from it.

You can then load one specific family symbol into the project, duplicate it using the Duplicate method, and set the desired dimensions to the required values.

API Access to Revision Information

Question: I am trying to obtain data relating to the revisions present on a ViewSheet.

I can successfully retrieve what looks like the correct information via GetAllProjectRevisionIds, but the PROJECT_REVISION_REVISION_NUM parameter contains no information, and PROJECT_REVISION_REVISION_ENUMERATION always appears to contain '0' (zero) regardless of the Numeric or Alphabetic selection in Sheet Issues/Revisions.

I used a modified version of Max' revision wrapper class for my tests.

The test sheet in question contains 4 revisions, two of which are alphabetic, and two numeric. The output when I retrieve data using the sample code is:

  Number: Numbering: 0 Description: My description 1, Date: 4/1/14 Sequence: 4
  Number: Numbering: 0 Description: My description 2, Date: 5/1/14 Sequence: 5
  Number: Numbering: 0 Description: My description 3, Date: 6/1/14 Sequence: 6
  Number: Numbering: 0 Description: My description 4, Date: 7/1/14 Sequence: 7

Should I expect to see anything in Number, or do I need to calculate this using the Numbering option and the sequence number? Should I expect to see a different value for Numbering if alpha or numeric values are chosen?

Answer: In versions prior to Revit 2015, the API provided hardly any access at all to revision data.

One of the major Revit 2015 API additions is access to revision information.

I recently implemented a sample application showing how to use this access to read revision data and display it in a dynamically generated Windows form on the fly.

Installing a Revit Add-in

The best way to understand how to install a Revit add-in is to read the Revit API getting started material.

However, this material is targeted at developers.

I wrote a shorter and simpler answer addressing the minimal basics answering a comment by Frédéric on the AutoPDF print utility:

All Revit add-ins are installed in the same way.

They consist of an add-in manifest with the filename extension *.addin.

It is an XML file that you can edit and contains a tag pointing to the .NET add-in assembly DLL.

The add-in manifest must be located in a folder that Revit searches, e.g. the one you mention.

The add-in assembly can be placed anywhere you like.

I place small simple add-ins in the same folder as the add-in manifest.

Then there is no need to specify the full DLL pathname.

I hope this succinct summary is useful for non-developers.

Well, I am back in the rut again now...