如何使用Revit API(外部命令)在特定门的Revit中创建详细视图?现在我设法创建了DetailView,但是当我在Revit中打开时,它看起来并不是我的预期(参见图片:expected,what I get)。
以下是代码:
IEnumerable<ViewFamilyType> viewFamilyTypes = from elem in new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType))
let type = elem as ViewFamilyType
where type.ViewFamily == ViewFamily.Detail
select type;
//uiDoc.Selection.SetElementIds(new List<ElementId>() { door.Id });
var dim = door.get_BoundingBox(null);
using (Transaction transaction = new Transaction(doc))
{
transaction.Start("Creating Detail View");
BoundingBoxXYZ box = dim;
var detailView = ViewSection.CreateDetail(doc,viewFamilyTypes.First().Id, box);
detailView.Discipline = ViewDiscipline.Architectural;
detailView.DetailLevel = ViewDetailLevel.Coarse;
transaction.Commit();
}
我正在使用Revit 2018, 欢迎任何帮助或建议,以完成我的学生研究。