In the Revit 2011, its API functionalities have been split into different DB and UI assemblies and grouped into different namespaces.
For example, now application related services are put into the ApplicationServices namespace; event related functionalities in Events; architecture related in Architecture, structural APIs in Structure; MEP disciplines in their designated respective namespaces. That is good and makes things more organized than before, but also brings a bit extra effort for Revit developers to import and manage them no matter which language is used, C#, VB.NET, or C++.
Though there are many namespaces now, hard to be listed out in this simple post, some are very common and will be used by almost every project. Another matter is that the Revit API also defines an Application type and a Document type just like almost every other API, and this causes ambiguities all the time. We have to identify the two most important types of Revit API. C#, VB.NET and C++ all support namespace alias, and we use this technology to resolve the ambiguity rather than always decorate the types with some long and boring namespace prefix.
Some commonly used Revit API namespaces have been grouped further and two aliases have been defined for both the Application and the Document types below:
C#:
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Events;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.DB.Electrical;
using Autodesk.Revit.DB.Plumbing;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.UI.Events;
using Autodesk.Revit.Collections;
using Autodesk.Revit.Exceptions;
using Autodesk.Revit.Utility;
using RvtApplication = Autodesk.Revit.ApplicationServices.Application;
using RvtDocument = Autodesk.Revit.DB.Document;
VB.NET:
Imports Autodesk.Revit.ApplicationServices
Imports Autodesk.Revit.Attributes
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.DB.Events
Imports Autodesk.Revit.DB.Architecture
Imports Autodesk.Revit.DB.Structure
Imports Autodesk.Revit.DB.Mechanical
Imports Autodesk.Revit.DB.Electrical
Imports Autodesk.Revit.DB.Plumbing
Imports Autodesk.Revit.UI
Imports Autodesk.Revit.UI.Selection
Imports Autodesk.Revit.UI.Events
Imports Autodesk.Revit.Collections
Imports Autodesk.Revit.Exceptions
Imports Autodesk.Revit.Utility
Imports RvtApplication = Autodesk.Revit.ApplicationServices.Application
Imports RvtDocument = Autodesk.Revit.DB.Document
C++:
using namespace Autodesk::Revit::ApplicationServices;
using namespace Autodesk::Revit::Attributes;
using namespace Autodesk::Revit::DB;
using namespace Autodesk::Revit::DB::Events;
using namespace Autodesk::Revit::DB::Architecture;
using namespace Autodesk::Revit::DB::Structure;
using namespace Autodesk::Revit::DB::Mechanical;
using namespace Autodesk::Revit::DB::Electrical;
using namespace Autodesk::Revit::DB::Plumbing;
using namespace Autodesk::Revit::UI;
using namespace Autodesk::Revit::UI::Selection;
using namespace Autodesk::Revit::UI::Events;
using namespace Autodesk::Revit::Collections;
using namespace Autodesk::Revit::Exceptions;
using namespace Autodesk::Revit::Utility;
namespace RvtAppSrv = Autodesk::Revit::ApplicationServices;
namespace RvtDB = Autodesk::Revit::DB;
All these will be done automatically by the RevitAddinWizard.
Recent Comments