|
@@ -6,7 +6,9 @@ using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using Autodesk.Revit.Attributes;
|
|
|
using Autodesk.Revit.DB;
|
|
|
+using Autodesk.Revit.DB.Plumbing;
|
|
|
using Autodesk.Revit.UI;
|
|
|
+using Autodesk.Revit.UI.Selection;
|
|
|
using SAGA.DotNetUtils.Extend;
|
|
|
using SAGA.MBI.Calc;
|
|
|
using SAGA.MBI.DataArrange;
|
|
@@ -78,4 +80,52 @@ namespace SAGA.MBI
|
|
|
// return true;
|
|
|
//}
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 管道系统类型
|
|
|
+ /// </summary>
|
|
|
+ [Transaction(TransactionMode.Manual)]
|
|
|
+ [Regeneration(RegenerationOption.Manual)]
|
|
|
+ public class UpdatePipeSystemCommand : ExternalCommand, IExternalCommandAvailability
|
|
|
+ {
|
|
|
+ public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+
|
|
|
+ var pickElements=ExternalDataWrapper.Current.UiApp.PickElements("请选择水管", new PipeFilter());
|
|
|
+ if (pickElements == null)
|
|
|
+ {
|
|
|
+ return Result.Succeeded;
|
|
|
+ }
|
|
|
+ var pipes = pickElements.OfType<Pipe>();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ MessageShow.Show(e);
|
|
|
+ return Result.Cancelled;
|
|
|
+ }
|
|
|
+ return Result.Succeeded;
|
|
|
+ }
|
|
|
+
|
|
|
+ //public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
|
|
|
+ //{
|
|
|
+ // return true;
|
|
|
+ //}
|
|
|
+
|
|
|
+ public class PipeFilter : ISelectionFilter
|
|
|
+ {
|
|
|
+ public bool AllowElement(Element elem)
|
|
|
+ {
|
|
|
+ return elem is Pipe;
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool AllowReference(Reference reference, XYZ position)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|