Odd Question about Revit API and C#'s interoperability with other languages

Odd Question about Revit API and C#'s interoperability with other languages

JPMorrow
Explorer Explorer
1,061 Views
3 Replies
Message 1 of 4

Odd Question about Revit API and C#'s interoperability with other languages

JPMorrow
Explorer
Explorer

Hi,

 

I work at an electrical contracting company that makes heavy use of Revit, and they hired me about a year and a half years ago to basically see how I could use my degree in Computer Science to bring something to the Drafting/BIM world. So I have just about chewed threw most of the Revit API and gained a comfortable understanding about how to manipulate it using all of the great flexibility of c# and finally settling on WPF as a vehicle for a GUI.

 

So I went to work building 'Bill of Material' programs for this company,  in order to quickly and messily generate materials lists for the projects we are about to build and how much it would cost in time and labor. With the key being quickly because that was what we were targeting to reduce, is how much time our estimating department spends estimating.

 

So, fast forward to the present. I have basically solidified my position programming at this company, namely because I am starting to work on systems for them that automate and eliminate a lot of what our small team of Drafters have to do in Revit a certain way, many times, everyday.

 

I got to thinking, "Man, wouldn't it be great if I could somehow get Revit API to work with another language that better matches the workflow that I am trying to achieve and perhaps provide some way to break away from WPF and maybe introduce a GUI built in OpenGL or something."

 

I guess  that is my question then. Is there anyway to read functions out of a .NET .dll in a non-.Net language?

I know someone made a python wrapper but isn't that IronPython, which is .NET?

 

Really I don't care about how hard it is to build such a wrapper for an unmanaged language or if it will take extensive time and testing. I have climbed a lot of mountains that took a lot of time to get to this point, and I will invest more time if I have to. I am just curious if there are any veteran coders who would understand where to go with an idea like this.

 

 

 

 

0 Likes
Accepted solutions (1)
1,062 Views
3 Replies
Replies (3)
Message 2 of 4

Kennan.Chen
Advocate
Advocate
Accepted solution

Since Revit API is just a C++/CLI wrapper around Revit native code, you can technically call native api directly from other languages. But since you are not provided with certain head files, it's hard to get a complete list of apis exported by Revit naive code without doing any reverse engineering.

 

One approach is to wrap Revit .NET API with RPC technology such as socket, HTTP, namedpipe, gRPC and start Revit as a server, which enables you to make Revit API available from another process or even another machine.

Message 3 of 4

TripleM-Dev.net
Advisor
Advisor

If you're only interested in Bill of Material/Quantities why not just export the data from revit to a external application/database (direct or indirectly) ?

 

- Michel

Message 4 of 4

jeremytammik
Autodesk
Autodesk

Hear, hear.

 

I fully concur with Kennan and Michael!

 

Thank you, guys!

 



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

0 Likes