Is there a reasonably consistent way for a publicly purchaseable app (not just one for internal use), using the Revit API, to determine the discipline (e.g. Architecture, MEP, Structural) of a project?
I don't mean to determine whether or not these software features are avaialable to the user in the software (e.g. MEP buttons are available to the user), but rather that "this project is a structural project," for example.
Thanks for any thoughts.
Solved! Go to Solution.
Solved by arnostlobel. Go to Solution.
Well, given the lack of any more ideas, I guess I'll have to write this off as yet another "Unfortunately, the Revit API can't do that."
Bummer.
Well, well, well 😉
There is no API, for there is no inherent approach in Revit to do so either. A “Discipline” is not a property of a project (model), because a project of any discipline can be in theory created in Revit of any other discipline. It is not uncommon to take a model that was originally created in Revit Architecture, open in in Revit Structure to perform analysis and modify structural properties as needed, and after saving the model then open it again in Revit MEP to add ducks and pipes and such. Now, what should the model say its Discipline is?
A Discipline of a model really is nothing else than the template the model started with. It does not even have to be one of the template Revit is installed with. It’s perfectly reasonable for users to create their own templates which may be any combination of families and elements from any Revit discipline.
As there is no clear and perfectly accurate way to determine a project’s discipline, it can still be guessed and that can be done via the API, I suppose. I assume one may iterate through families currently present in a model and based on what kinds of families are find then take an educated guess on what the dominant discipline of the model may be. However, such an application should be written to also determine a model as “multi-discipline.”
Thank you
Arnošt Löbel
Sr. Principal Engineer
Autodesk, Revit R&D
Hi Arnošt.
Thank you very much for helping us understand how this works. As developers, we're not always aware of the ins and outs of how users use Revit and how they can change what an original intent was.
When a customer says to us "Report whether this is an Architectural, Stuctural or MEP project" and we see there are templates available for these types of projects, it was only natural for us to presume there was a way to tell what template was used to start a project, which may have been enough in this case. But even if that could be detected, if someone started with a different template than what the project turned into, we'd actually wind up reporting bad information, which is not good either.
Thanks again for clearing this up.
@CoderBoy wrote:
...As developers, we're not always aware of the ins and outs of how users use Revit ...
You can say that again, CoderBoy. Welcome to my world! 🙂
I am glad I coudl shade some light on the problem. We prefectly well understand that not everything can be comprehended from documentation alone (assuming documentation is even available for a topic), particularly in such a complex software like Revit. That is why we have forums like this one.
Good luck with your applications
Arnošt Löbel