Running revit from a windows service?

Running revit from a windows service?

Anonymous
Not applicable
947 Views
5 Replies
Message 1 of 6

Running revit from a windows service?

Anonymous
Not applicable

Hi,

 

Im building a web service that starts and runs revit using Process.Start(). However since the normal way of hosting a web service is in IIS or as Windows service, the started window is run in session 0 (using windows 10) so I cant see the window. I dont really mind this if it wasnt for the fact that when I open Revit files using the OpenAndActivate-method revit comes to a halt during the open process. It works if I use OpenDocumentFile, but that hides geometry when exporting. .
Im watching the DialogShowing event and Im dissmissing the windows where you set the open worksets and then it stops. 

If I run my web service as a normal console app, it works. 

 

So, has anyone come across this and has any idea on a solution or how to investigate further?

 

Running a web service as a console app definitely not ideal. 

 

Thanks

 

Erik

 

 

0 Likes
948 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk

Dear Erik,

 

Thank you for your very valid query.

 

Apparently, you have not read all the stuff The Building Coder has to say on this topic:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28b

 

What you are doing is technically possible, and in an uncertain space as far as the official license is concerned.

 

If you are running Revit as a server just to read information from the BIM, there are probably better ways to go already now, either extracting the information you are after yourself and storing it in an external database, or making use of Forge:

 

https://autodesk-forge.github.io

 

If you wish to modify the BIM via an externally accessible service, your safest bet will be to talk with the people responsible for the Forge design automation API and Revit I/O and let them know your needs. Look what it can do for AutoCAD DWG today:

 

https://developer.autodesk.com/en/docs/design-automation/v2/overview

 

What exactly do you wish to achieve with your service?

 

What timeframe are you thinking of?

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi Jeremy, 

 

I havent read all your blog post word by word, but quite a few and most certainly all on Revit IO, I know all public ways (AU, blogs etc) it has been attempted. But I have my own way 😃


I even contacted Jim Quanci after your "What can revit on the cloud do for you" post last year, but that after initial correspondance it came to an halt. 

 

My problem with Forge, when it comes to Revit is that it doesnt do all the things I want it to and when you want to do 100s of Revit files every day, cost is becoming a factor. But we are sure following the Forge development with excitement. And also, we are much stronger in c# than in javascript 😃


Things we are currently looking at doing:

  • Extracting model benchmarks for all models every night (I dont think Forge comes near
  • Converting IFCs back and forth from Revit (I think this can be done in some part, in Forge, right?)
  • Exporting DWGs and PDFs
  • Simplifying Revit models for delivery
  • Generating room drawings. 

Basically everything that we can think of that takes alot of time right now. 

 

We are doing this right now, everything is working and we are adding more features by the day. 
However exporting model geometry seemed to be a harder nut to crack than expected. 

 

The backup plan is to keep the web service in a console window and find ways to ensure it doesnt crash without coming alive again, or finding a way to create an interactive windows service. 

 

 

 

 

0 Likes
Message 4 of 6

jeremytammik
Autodesk
Autodesk

Dear Erik,

Thank you for the update and background information.

 

I am glad you are interested in Forge, touched base with Jim, and are still keeping an eye on it.

 

Congratulations on having all those important services up and running already!

 

May I ask the Forge design automation guys to get in touch with you and hear some real world input on what developers need?

 

Thank you!

 

Your backup plan sounds fine and feasible to me:

 

 

Cheers,


Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 6

jeremytammik
Autodesk
Autodesk

Dear Erik,

 

Thank you for your patience and congratulations on preferring to go your own way.

 

I often do so, too 🙂

 

Just for the sake of completeness, I heard back from the Forge design automation guys, and they say, "Based on what Erik is asking, Design Automation API for Revit will work well for many of his cases."

 

Maybe the optimal solution will end up consisting of a mix of Revit API, Forge, and your own approaches.

 

Regarding running your web service hosting Revit as a console app: while not ideal, it may be the only way to go right now, seeing that Revit still considers itself 100% an end user product with UI and everything.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 6 of 6

Anonymous
Not applicable

Hi Jeremy, 

thank you for your time. 

The forge team can contact me if the like. 

 

I will have another look at the Forge api, however javascript is not my language quite yet... 


0 Likes