在 Revit 中创建门的详细视图 api

Creating detail view of doors in Revit api

如何使用 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, 欢迎任何帮助或建议,只是为了完成我的学生研究。

The Building Coder 关于 creating a section view 的文章有帮助吗?