Message 1 of 4
renaming views when creating levels
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working on a routine for Revit 2015 for creating levels and the corresponding views with a form. I have everything working correctly with regards to this creating levels and views however, I am stuck on naming the views based on a value from the dialog box and either a value from if/then statements or a parameter embedded within the view templates. Any help would be greatly appreciated.
using (Transaction tx = new Transaction(doc)
{ tx.Start("Create New Level"); try { double elevfoot=FrmLvl.ElevFeet; double elevinch=FrmLvl.ElevInch; double elevation = elevinch/12+elevfoot; string lvlname=FrmLvl.Level_Name; string lvlabb=FrmLvl.Level_Abbr; string prefix="PN"; Level level = doc.Create.NewLevel(elevation); level.Name=lvlname; foreach (ViewFamilyType vfp in new FilteredElementCollector(doc) .OfClass(typeof(ViewFamilyType)) .Cast<ViewFamilyType>() .Where(q => q.ViewFamily == ViewFamily.FloorPlan)) { ViewPlan newview = ViewPlan.Create(doc, vfp.Id, level.Id); string VIEWNAME = string.Concat(prefix,lvlabb); newview.Name=VIEWNAME; }}
Thanks