Revit API电缆桥架CableTray
电缆桥架CableTray与风管一样是曲线几何。
using Autodesk.Revit.DB.Electrical;
namespace RevitCodes
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdTest20110905 : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string messages, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
//电缆桥架
//BuiltInCategory.OST_CableTray;
Transaction ts = new Transaction(uiDoc.Document, "电缆桥架");
ts.Start();
Reference refCable = uiDoc.Selection.PickObject(ObjectType.Element, "选择一个桥架");
CableTray cableTray = uiDoc.Document.GetElement(refCable) as CableTray;
LocationCurve lCurve = cableTray.Location as LocationCurve;
if (lCurve != null)
{
TaskDialog.Show("curve", lCurve.Curve.Length.ToString());
}
ts.Commit();
return Result.Succeeded;
}
}
}
namespace RevitCodes
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdTest20110905 : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string messages, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
//电缆桥架
//BuiltInCategory.OST_CableTray;
Transaction ts = new Transaction(uiDoc.Document, "电缆桥架");
ts.Start();
Reference refCable = uiDoc.Selection.PickObject(ObjectType.Element, "选择一个桥架");
CableTray cableTray = uiDoc.Document.GetElement(refCable) as CableTray;
LocationCurve lCurve = cableTray.Location as LocationCurve;
if (lCurve != null)
{
TaskDialog.Show("curve", lCurve.Curve.Length.ToString());
}
ts.Commit();
return Result.Succeeded;
}
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。