Reputation: 33
How to create detail view in Revit of specific door using Revit API( external command)? For now I managed to create DetailView, but when I open in Revit that view it is not what I expected(see images: expected , what I get).
Here is the code:
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();
}
I'm using Revit 2018, Any help or suggestion is welcome just to finish my student research.
Upvotes: 1
Views: 695
Reputation: 8294
Do The Building Coder articles on creating a section view help?
Upvotes: 1