The code for successfully built document-level macros are stored in the RVT file after you save the RVT file. The project files are removed from the temporary location when you exit Revit.
In the IDE, use the following code for the method:
public void MyFirstMacroDocCS() {Autodesk.Revit.DB.XYZ baseVec = Document.Application.Create.NewXYZ(0.0, 0.0, 1.0); Autodesk.Revit.DB.XYZ upVec = Document.Application.Create.NewXYZ(0.0, 0.0, 1.0); Autodesk.Revit.DB.XYZ origin = Document.Application.Create.NewXYZ(0.0, 0.0, 0.0); Autodesk.Revit.DB.TextAlignFlags align = Autodesk.Revit.DB.TextAlignFlags.TEF_ALIGN_LEFT | Autodesk.Revit.DB.TextAlignFlags.TEF_ALIGN_TOP; string strText = "My First Macro, Doc level, C#!"; double lineWidth = 4.0 / 12.0; Autodesk.Revit.DB.Transaction t = new Autodesk.Revit.DB.Transaction(Document, "NewTextNote");t.Start();Autodesk.Revit.DB.View pView = Document.ActiveView; Document.Create.NewTextNote(pView, origin, baseVec, upVec, lineWidth, align, strText);t.Commit();}
For this example, when you build the project in the Revit macro IDE, also notice that you are building the DocCSharp project. Your document-level C# macro's code resides in ThisDocument.cs. You can use the IDE's Project Explorer to see its temporary location on disk.
The macro placed text box