Though there are many namespaces in the AutoCAD .NET API, 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 AutoCAD .NET API also defines an Application type and a Document type just like almost every other API does, and this causes ambiguities all the time. We have to identify the two most important types of AutoCAD .NET API. Fortunately, C#, VB.NET and C++ all support namespace alias, and we use this technology to resolve the ambiguity issue rather than always decorate the types with some long and boring namespace prefixes.
Some commonly used AutoCAD .NET API namespaces have been put together and two aliases have been defined for both the AutoCAD Application and the Document types as follows.
C#:
#region Namespaces
using System;
using System.Text;
using System.Linq;
using System.Xml;
using System.Reflection;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Windows;
using AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application;
using AcadDocument = Autodesk.AutoCAD.ApplicationServices.Document;
using AcadWindows = Autodesk.AutoCAD.Windows;
#endregion
VB.NET:
#Region "Namespaces"
Imports System
Imports System.Text
Imports System.Linq
Imports System.Xml
Imports System.Reflection
Imports System.ComponentModel
Imports System.Collections
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Media.Imaging
Imports System.Windows.Forms
Imports System.IO
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 AcadApplication= Autodesk.Revit.ApplicationServices.Application
Imports AcadDocument= Autodesk.Revit.DB.Document
#End Region
VC++/CLI
#Region "Namespaces"
Imports System
Imports System.Text
Imports System.Linq
Imports System.Xml
Imports System.Reflection
Imports System.ComponentModel
Imports System.Collections
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Media.Imaging
Imports System.Windows.Forms
Imports System.IO
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 AcadApplication= Autodesk.Revit.ApplicationServices.Application
Imports AcadDocument= Autodesk.Revit.DB.Document
#End Region
All these namespaces will be introduced into the appropriate projects properly and automatically if the leading edge AutoCAD .NET Addin Wizard (AcadNetAddinWizard) is used to create the AutoCAD .NET addin projects including C#, VB.NET and Managed C++/CLI. Of course, the corresponding assemblies of both AutoCAD .NET and .NET Framework ones will be automatically referenced into the projects too and their Copy Local properties be set as False properly
Recent Comments