The time is overdue to migrate the Visual Studio Revit Add-In Wizards to Revit 2017.
This time, instead of a simple flat migration like in previous years, I decided to set up a new Visual Studio C# .NET Revit add-in project manually, by hand, completely from scratch, just to see whether anything significant changed since I did that last, and to ensure that the wizard is really using all the required Visual Studio settings.
I tried it out in by implementing a buildingSMART BCF API sample client.
Basically, that requires the following steps:
Class1
to Command
To try out these steps, I made use of a brand new sample project that I implemented in response to the Revit API discussion forum thread inquiring about support for the BCF API:
Question: Can anyone answer if Revit supports the BCF API to allow for third party integrations?
Answer: I searched the Internet for 'bcf api' and found the BuildingSMART BCF-API GitHub repository.
Is that what you are talking about?
Being a REST API, you can use it perfectly well from your own .NET add-ins.
The BCF API GitHub repo points to a C# client, the BcfApiExampleClient.
You can try integrating that very code into a Revit add-in and see how it goes.
Out of interest, I took a slightly deeper look.
I see that BCF stands for BIM Collaboration Format.
I also see that the C# sample can easily be integrated into a Revit add-in.
Question: Does the Revit API create the JSON for BCF or would we be required to create it ourselves via the add-in?
Answer: I was not aware of BCF until you raised this question, and I am pretty sure that Revit does nothing to support it.
If it is BCF specific, you will probably have to create it with your own custom add-in.
I created a new project to try out converting the BcfApiExampleClient sample to a Revit add-in, RvtBcfApiExampleClient.
It is a pure and simple REST API client.
I had some issues getting both the original sample and my Revit version up and running.
They were resolved over the week-end, however, and both the stand-alone sample client and the new Revit add-in version now work fine.
Here are some screen snapshots running the Revit add-in version:
The first step is the log in to the BIM-IT server:
As usual, this authorisation process returns an access token:
Finally, the sample simply lists all existing projects, of which I possess exactly zero:
If you are interested in diving deeper into the BCF API, please note the comment by Georg Dangl, saying, "in December we had another Hackathon in Munich where Veni Lillkall created a small sample app in C#. That might give you some ideas how to use the BCF API itself."
One interesting aspect of the BCF-API sample is its use of the Kayak framework – an easy way to speak HTTP with .NET, published in 2010 by Benjamin van der Veen, including Kayak sample code:
As said, I used the BCF API client sample project to record exactly how to manually set up a Visual Studio C# .NET Revit add-in from scratch.
Here are the detailed individual steps I performed for this, with links to the corresponding commits in the GitHub repository:
The result is RvtBcfApiExampleClient release 2017.0.0.0, which is just a naked Revit 2017 C# .NET add-in skeleton.
The final working version presented above after fixing the initial problems with the login process is captured in release 2017.0.0.4.
As said, next I will use the generated files to update the Visual Studio Revit add-in wizard for Revit 2017.