EaBIM

标题: Revit API电缆桥架CableTray [打印本页]

作者: 萧闫子    时间: 2014-1-9 12:34
标题: Revit API电缆桥架CableTray

电缆桥架CableTray与风管一样是曲线几何。

  1. <div align="left">using Autodesk.Revit.DB.Electrical;

  2. namespace RevitCodes
  3. {
  4.     [Transaction(TransactionMode.Manual)]
  5.     [Regeneration(RegenerationOption.Manual)]
  6.     public class cmdTest20110905 : IExternalCommand
  7.     {
  8.         public Result Execute(ExternalCommandData cmdData, ref string messages, ElementSet elements)
  9.         {
  10.             UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
  11.             //电缆桥架
  12.             //BuiltInCategory.OST_CableTray;
  13.             Transaction ts = new Transaction(uiDoc.Document, "电缆桥架");
  14.             ts.Start();
  15.             Reference refCable = uiDoc.Selection.PickObject(ObjectType.Element, "选择一个桥架");
  16.             CableTray cableTray = uiDoc.Document.GetElement(refCable) as CableTray;
  17.             LocationCurve lCurve = cableTray.Location as LocationCurve;
  18.             if (lCurve != null)
  19.             {
  20.                 TaskDialog.Show("curve", lCurve.Curve.Length.ToString());
  21.             }

  22.             ts.Commit();
  23.             return Result.Succeeded;
  24.         }
  25.     }
  26. }</div>
复制代码


作者: 筱雅    时间: 2014-2-20 14:47
顶!!!!!!!!!!




欢迎光临 EaBIM (https://eabim.net/) Powered by Discuz! X3.2