Quick Tip: Module name should not be a Class name

If you create a macro module named “Wall” and then do this:

namespace Wall
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    [Autodesk.Revit.DB.Macros.AddInId("B1079B97-D3BA-430F-9109-F492B7F2891F")]
    public partial class ThisApplication
    {
        public void test()
        {
            Document doc = this.ActiveUIDocument.Document;
            Element e = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).FirstOrDefault();
        }

Everything will be OK. But if you try to use the Revit API class “Wall” in your code, the compiler will be confused because the module is named “Wall” and you will get an error like below.
So keep those module names unique and different!

Capture

Advertisements

2 thoughts on “Quick Tip: Module name should not be a Class name

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s