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