Revit API布置卫浴装置
//放置卫浴装置
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdSetPlumb : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Transaction ts = new Transaction(uiDoc.Document, "SetFamily");
ts.Start();
FilteredElementCollector collector = new FilteredElementCollector(uiDoc.Document);
collector.OfCategory(BuiltInCategory.OST_PlumbingFixtures);
FamilySymbol fs = null;
foreach (Element el in collector)
{
fs = el as FamilySymbol;
break;
}
XYZ xyz = uiDoc.Selection.PickPoint();//选择一个点
//根据族符号放置族实例的方法
FamilyInstance fi = uiDoc.Document.Create.NewFamilyInstance(xyz, fs, StructuralType.NonStructural);
ts.Commit();
return Result.Succeeded;
}
}
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdSetPlumb : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Transaction ts = new Transaction(uiDoc.Document, "SetFamily");
ts.Start();
FilteredElementCollector collector = new FilteredElementCollector(uiDoc.Document);
collector.OfCategory(BuiltInCategory.OST_PlumbingFixtures);
FamilySymbol fs = null;
foreach (Element el in collector)
{
fs = el as FamilySymbol;
break;
}
XYZ xyz = uiDoc.Selection.PickPoint();//选择一个点
//根据族符号放置族实例的方法
FamilyInstance fi = uiDoc.Document.Create.NewFamilyInstance(xyz, fs, StructuralType.NonStructural);
ts.Commit();
return Result.Succeeded;
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。