Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey,
I'm trying to create a DraftingView so I used this code :
using (var tx = new Transaction(document, "Create View")) { tx.Start(); var viewDraftType = new FilteredElementCollector(document) .OfClass(typeof(ViewFamilyType)) .Cast<ViewFamilyType>() .FirstOrDefault(q => q.ViewFamily == ViewFamily.Drafting); if (viewDraftType == null) { tx.RollBack(); return; } var draftView = ViewDrafting.Create(document, viewDraftType.Id); if (draftView == null) { tx.RollBack(); return; } draftView.Name = $"{Init.Gui.MainView.ChartTitle}_Histogramme"; draftView.Scale = 1;
tx.Commit(); }
I tried with this post but I got a null value with the filterdelementcollector. Any idea ?
Thank you !
Solved! Go to Solution.