Revit二次开发之创建标高

mac2024-11-12  13

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Autodesk.Revit.DB; using Autodesk.Revit.UI; using Autodesk.Revit.Attributes; using Autodesk.Revit.UI.Selection; namespace ClassLibrary1 { [Autodesk.Revit.Attributes.Transaction(TransactionMode.Manual)] [Autodesk.Revit.Attributes.Regeneration(RegenerationOption.Manual)] public class GetElement : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIDocument uidoc = commandData.Application.ActiveUIDocument; Document doc = uidoc.Document; Selection selection = uidoc.Selection; #region 创建标高 using (Transaction ts = new Transaction(doc)) { ts.Start("创建标高"); Level.Create(doc, 20); ts.Commit(); } TaskDialog.Show("Level", "创建成功"); #endregion return Result.Succeeded; } } }

 

最新回复(0)