[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] public class MyCommand : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { // 1. Get the Document UIApplication uiApp = commandData.Application; Document doc = uiApp.ActiveUIDocument.Document; // 2. Start a Transaction using (Transaction trans = new Transaction(doc, "My Customization")) { trans.Start(); // Your logic goes here (e.g., changing a parameter) trans.Commit(); } return Result.Succeeded; } } Use code with caution. Copied to clipboard 📝 Manifest Files (.addin)
: The primary way to "find" things in your model (like all Walls or Doors). Instant Autodesk Revit 2013 Customization with ...
Revit won't see your code unless you tell it where to look. Create a text file named MyPlugin.addin and place it in C:\ProgramData\Autodesk\Revit\Addins\2013\ . [Autodesk
To help you move faster, would you like a code snippet for a (like auto-renaming levels) or a guide on debugging your code? Copied to clipboard 📝 Manifest Files (
: Add using Autodesk.Revit.DB; and using Autodesk.Revit.UI; at the top. 💻 The Boilerplate Code
(Includes the crucial RevitAPI.dll and RevitAPIUI.dll ).
: Use uiApp.ActiveUIDocument.Selection to interact with what the user clicks.