Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Introducing a Revit API Framework!

t.almeidaeng
Contributor
Contributor

Introducing a Revit API Framework!

t.almeidaeng
Contributor
Contributor

Hi guys, I have been programming Revit API for at least 8 years now and always tried to find ways to make my work easier, I have always wanted to have data-rich apps that communicate with the cloud, and with the introduction of Autodesk Forge a few years back, I had the need to share even more code between various projects and assemblies. 

 

Today, I'm thrilled to introduce the Onbox Framework, a free and open-source (MIT) to help us build cross-platform Revit Apps in a similar fashion to Angular and ASP.Net Core. It is designed to make it easier to create a jump between these environments without workflow disruptions. It introduces several features out-of-the-box, like dependency injection (IOC Container), state management, asynchronous Revit calls, a component-based MVC library made on top of WPF, and much more! 

 

Here is the reference of the libraries that compose the framework and their NuGet packages, notice that most of the libraries are targeting .Net Standard to be used both on .NetFramework and .Net Core:

 

Onbox.AbstractionsInterfaces of all generic usage on the framework.Net Standard 2.0
Onbox.CoreCore implementations for all generic services.Net Standard 2.0
Onbox.DiIOC container system.Net Standard 2.0
Onbox.Mvc.AbstractionsInterfaces for interacting with Views.Net Standard 2.0
Onbox.MvcImplementation of WPF MVC Views and Components.Net Framework 4.7.2
Onbox.Mvc.Revit.AbstractionsInterfaces for interacting with Revit and Views.Net Standard 2.0
Onbox.Mvc.RevitImplementation of WPF MVC specific to Revit.Net Framework 4.7.2
Onbox.Revit.AbstractionsInterfaces for interacting with Revit.Net Standard 2.0
Onbox.RevitRevit External Applications and Commands.Net Framework 4.7.2
Onbox.StoreState management for Revit MVC / WPF.Net Standard 2.0

 

We have built parts of several applications using some of these libraries, our current working project, Shedmate app is the one that relies on it the most. I would say parts of it because only some libraries existed when we started coding the app. Shedmate is a web-based 3d configurator that needs to process the same data models in different places: Revit, our ASPNet Cloud server, and our front end Angular app. The cool thing here is that we can share services between the Revit and ASP and even run a script to generate our data models in typescript for Angular!

 

Simplicity:

None of the features that Onbox provides out of the box are really trying to be the best ones in the industry. The framework is made with simplicity in mind, we tried to simplify the implementations as much as we could, even when we wanted to provide more functionality, we tried to make it easy to consume simpler versions of the APIs. 

 

Modularity: 

The framework aims for modularity, so the idea here is that you can introduce new functionality by yourself. Our libraries, e.g. Container, Mapper, State Management, Async are tiny and are not trying to solve every single problem or implement every single feature, also they can always be replaced by more mature ones out there. 

 

Flexible:

The framework also aims to be flexible, if you have an existing Revit plugin and want to give Onbox a try, you would just swap the implementation for your ExternalApplication and then for the ExternalCommand(s) you want the container to be injected on. You are good to go!

Testability:

With the loosely coupled architecture that the framework helps you to build, you can then use any testing frameworks like Dynamo's Revit Tester Framework or Geberit's Revit Test Runner. We are even using Design Automation on Forge to unit test our Revit Apps, that way, everything can be integrated into a CI/CD pipeline.

 

Documentation:

Documentation is in its early stages, (yeah I know.. documentation is important). We have a simple Getting Started Guide here and the complete API documentation here. The written tutorials explaining the main concepts are still of the libraries are still in the works, and we will be doing constant updates on it from now on. (now that AU recordings are finally over).

 

Usage and Collaboration:

Everyone is welcome to use it and collaborate! Being MIT licensed, you can take any parts of the framework and modify it to your usage, this is simple, because the libraries are tiny. The same thing for eventual bugs, you can step in and fix them yourself or log an issue on Github. We would appreciate any code pull requests, contributions to the documentation, and publications you make for it. The idea is to have a mature Framework so everyone can collect the benefits.

 

AU 2020:

I'm teaching two classes on AU this year, one is an industry talk (Lessons Learned in Three Years of Forge Dev - SD468705) that talks about our 3 years of Experience using Forge, the issues and problems we faced, and some tips and tricks for you do not waste so much time as we did try to solve them, during the class we explain the benefits of using a loosely coupled architecture for building Revit applications. The other one is a lab (The Cross-Platform Revit - SD468797-L). This one goes through an overview process of building multi-platform Revit apps, we show how to share base code for Revit plugins, Dynamo (Zero touch) nodes, and Design Automation for Revit, and we use the framework do help us to do so. If you are interested in the framework, please attend these classes next month on AU. 😁 

 

Screenshot_11.jpg

 

Reply
2,744 Views
5 Replies
Replies (5)

ricaun
Advisor
Advisor

Really cool Thiago,

 

I already design my Framework to fit my project, has some similar stuff and your code is so clear than mine I loved!

 

Obviously I'm gonna try some code on the OnBox Framework and definitely gonna try to Contribute with the code.

 

The documentation still missing the hardcore stuff, l really intrigued by how the IOC Containers works.

 

Great job, and thanks for sharing!

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

t.almeidaeng
Contributor
Contributor

Hi, @ricaun thanks for your comment.

 

We will be talking much more about IOC containers and how it drives the framework shortly, they are awesome, you are going to love it! We are preparing more documentation tutorials and examples, certainly, we have lots to do in that regard.

 

Our main initial focus will be the advantages of using the framework and how it helps you to: write cleaner, more maintainable code, easy to implement unit testing, and UI handling through MVC pattern. Not to mention easier access to some features in Revit API itself like the RibbonUI, Async code, and even Extensible Storage!

Can't wait to share all of this with the community!

ricaun
Advisor
Advisor

Hello @t.almeidaeng 

 

The IOC containers look amazing and solve a lot of problems, especially with the plugin start growing, and to make a reliable test is a really hard task.

 

Yesterday I try some code and was looking at why the framework is no support Revit 2018, I tried to downgrade, and does not worth it... Next year the Revit 2018 is of the track anyway.

 

This weekend I gonna try some code on the framework, and try some plugin.

 

One thing should be good to add to the framework or an extra package to add the dlls of all versions of the Revit. I gonna open an issue on Github!

 

I gonna make a video definitely!

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes

t.almeidaeng
Contributor
Contributor

Great @ricaun ! make sure to have a look at the project examples while you explore the possibilities:
https://github.com/engthiago/Onbox.GridGenerator.Monolithic for a simple implementation or
https://github.com/engthiago/Onbox.GridGenerator.Modular for cross-platform ready implementation.

 

You mean, add Nuget Packages for different versions of Revit on the Visual Studio Templates (image below)? Or the framework code itself?

Screenshot_1.png

 

ricaun
Advisor
Advisor

@t.almeidaengExamples 😍

 

I mean a Nuget package like this: Revit_All_Main_Versions_API_x64 

 

With this dlls:

  • RevitAPI.dll
  • RevitAPIUI.dll
  • AdWindows.dll (Useful Sometimes)
  • UIFramework.dll (Useful Sometimes)

Like this is not mandatory to have all the Revit version installed on the computer.

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes