Revit API移动风管
[TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class cmdMoveDuct : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
{
UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;
Selection sel = app.ActiveUIDocument.Selection;
Transaction ts = new Transaction(doc, "revit");
ts.Start();
Reference refDuct = sel.PickObject(ObjectType.Element, "duct");
Duct duct = doc.GetElement(refDuct) as Duct;
LocationCurve lCurve = duct.Location as LocationCurve;
lCurve.Move(new XYZ(0, 3, 0));//向上移动3
ts.Commit();
return Result.Succeeded;
}
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。