Monday, October 3, 2011

[Revit]– HTML Version of the Silverlight Revit Server Administrator Tool

If you’ve used Revit Server Before, you might recognize this:

image

It’s the Revit Server Administrator Tool which you access by going to http://servername/revitserveradmin it lets you see what Revit Server projects you have present, what files are stored in them, and their version history. It also lets you create, move, copy, delete or lock files and folders.

It’s a vital tool for anyone who runs a Revit Server, and it generally works well, but it has one problem – it’s written in Silverlight. Whatever your opinion on Silverlight may be, it requires an extra installation and won’t run on any mobile devices. This is where the Revit Server API comes in. Using this REST API, I was able to recreate this website in HTML and Javascript. The result looks like this:

image

As my main motivation for this was to give the Revit Server REST API a run through, I’ve not made it absolutely the same, there are some minor visual and functional differences, but for the most part, it behaves in the same way. All of the action buttons are functional, you can see a submission history and folder structure.

For the moment, the main limitations are:

  • When you create or paste a folder, the treeview on the left gets recreated and starts collapsed again. This is fixable, and if there is interest, I’ll polish this up (probably by replacing the treeview library with a new one)
  • The submission history isn’t paged or sortable, its just a table with all the information in it. This should be fixable as well.

I’m interested to hear if anyone is genuinely interested in using this tool in their environment, if so, I’ll keep improving it, if not, then it will serve as a demonstration of the Revit Server API’s capabilities, and will form a part of my AU Virtual session this year.

The website is available on Github, to install it on your server simply download the zip file from that site, and create a folder called ‘html’ in ‘C:\Program Files\Autodesk\Revit Server 2012\Sites\RevitServerAdmin’ on the machine you have Revit Server installed. Put all the files in there, and you should be able to navigate to http://localhost/RevitServeradmin/html/ to access it.

For those interested in the technical details, the page is simple HTML (it’s named Default.aspx even though it isn’t an ASP.NET web page, it’s named this way because this allows us to access it by going to /html/ instead of /html/default.htm), with a CSS stylesheet and some images to replicate the interface of the Silverlight tool. The real work happens in the RevitServer.js file, which, with the help of Jquery, calls the REST web service for each of the various actions that the user performs, and updates the DOM with the results. There is no server side ASP.NET code involved, it’s all Javascript with the Revit Server REST API doing the heavy lifting.

Of course, if you want to use the Revit Server API, you don’t need to use Javascript, you could write a similar thing in C# or VB code and service up in an ASP.NET web page, or just about any language you like as long as they can make HTTP Requests.

If you want to know more about how it all works, or more about the Revit Server API, I’ll be going into more detail in my AU 2011 Virtual session.

4 comments:

Jose Guia said...

I digg it, .. wonder if we can extract a preview of the image.. HMM!

Excellent work so far, I look forward to the class!

Rod Howarth said...

Thanks Jose,

Do you mean a preview of the Revit file? If so, there is a method in the API that lets you get that, however I had some troubles implementing it as it returns a binary stream of the image, rather than a path to an image on disk.

I did try to work around that with Data URI's and some other things but I think in the end we might have to create an intermediary ASP.NET web service that takes the binary stream and saves it as a PNG in a folder and then returns it to the javascript.

I threw it in the 'too hard' basked for now, but will revisit it later on.

Rod

Jose Guia said...

Cool, I'll give it a crack when i grab the code, I wanted to do something similar but haven't had the time .. exciting technology!

BIMmanager said...

its a great post.
Thanks.
for this post.....