I'm writing a console application in C#.net and I was hoping to access the Revit API's by including them as references. I can code OK (all the autocorrect works and finds the contents of the libraries), but when I run the code, it crashes saying I have a x86 or x64 issue. I found other pages showing how to resolve this, but nothing seems to work for me (in either 32- or 64-bit configurations )
But my question isn't really how to resolve that, but rather why am I getting this error? I'm working with all 64-bit API's, so why is there any issue? I would think that referencing a 64-bit Revit API on a 64-bit console application would be compatible.
So, can I even access the Revit COM from a console application?
And, if I can access Revit, how can I get rid of this x64 x86 issue?
Hello,
Can you please give more information on the actual issue? i.e., is there an error message or exception message?
Revit does not have a COM API anymore so I am not sure how you are using the Revit API in an external application.
More details about the what you are doing with the API would help.
Best Regards
Gopinath
I guess if there is no COM API, then that resolves the issue. Any reasons why they don't have COM access? Seems like a terrible lack of functionality.
Just to confirm, something like this isn't possible:
Autodesk.Revit.ApplicationServices.Application RevitApp; RevitApp = (Autodesk.Revit.ApplicationServices.Application)Marshal.GetActiveObject("REVIT.Application");
I'm using 4.0 .net.
Hello,
There was a COM based API for Revit many releases ago but we do not have one anymore. The supported API is a .NET API and it has to run in-process inside Revit. If you could describe what you are trying to achive, I may be able to suggest some alternatives.
Best Regards
Gopinath
There isn't much to say, since if you say COM access is impossible, then I don't have any recourse. I'm trying to create a C# console Application. That won't work without COM access.
Strange, I can access CATIA and Rhino without issue. This is a bummer that Revit isn't as useful in this sense. I'd much rather code my stuff in a simple-to-use EXE, rather than have my clients try and install the crappy addin stuff into their session of Revit.
Moving forward, I'll just have to recompile my code as a Revit plug-in, and access CATIA and Rhino via COM from Revit. I assume that is doable.