I got it working using the code from boostyourbim linked above. The steps I followed:
1. Use MacroManager to create a new C# module.
2. Edit the new module in SharpDevelop.
3. Add RegisterUpdater() to Module_Startup as follows:
private void Module_Startup(object sender, EventArgs e) { RegisterUpdater(); }
4. Add UnregisterUpdater() to Module_Shutdown as above.
5. Just below the boilerplate #endregion, add the boostyourbimcode :
public class FamilyInstanceUpdater : IUpdater { ... } public void RegisterUpdater() { ... } public void UnregisterUpdater() { ... }
Make sure FamilyInstanceUpdater, RegisterUpdater, and UnregisterUpdater are inside the scope of ThisDocument.
For testing, I found it handy to replace boostyourbim's Execute code with:
public void Execute(UpdaterData data) { Document doc = data.GetDocument(); TaskDialog.Show("Revit","hello"); }
6. Save and hit F9 to build the macro. Check the MacroManager to see if the build was successful. For some reason, the build occasionally fails for me. I've found that having AssemblyInfo.cs open in SharpDevelop helps. No idea why.
At this point, the macro should be working. Any time you draw an element, you'll get a little popup that says 'hello'.
If you close your project with a successfully built macro, the macro will run automatically the next time you open the project.
I'm sure lots of improvements can be made. For instance, Jeremy recommended using DocumentOpened. And my version currently works for columns and beams, but not for walls. Any input would be appreciated.
Meanwhile, thanks very much to Jeremy for taking a look and to boostyourbim for their code. Hope this helps someone.