Update section level in Revit 2020+
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm currently updating a script I created in Revit 2019 to work in versions of Revit 2020 onwards but section views no longer update when changing the level and I hope someone can suggest a fix. I believe it has something to do with the way the basepoint works but I've not found any suggestions on how to fix it.
I created a script that would automatically produce a model by copying an existing Revit file to use as a template and updating the information in it based on some input data. In Revit 2019 I update the base point using the below and then update the levels with "lvl.Elevation = [ insert elevation ]" later in the script and that worked fine.
// Set the base point to ground level
BasePoint basePoint = new FilteredElementCollector(_doc)
.OfClass(typeof(BasePoint))
.WhereElementIsNotElementType()
.Select(x => (BasePoint)x)
.Where(x => !x.IsShared).FirstOrDefault();
basePoint.Pinned = false;
basePoint.get_Parameter(BuiltInParameter.BASEPOINT_ELEVATION_PARAM)
.Set(UnitUtils.ConvertToInternalUnits(_mccSlab.SlabDesign.GroundLvl * 1000 + 50, _docUnits));
basePoint.Pinned = true;
trans.Commit();
In versions of Revit 2020+ sections don't move with the base point, instead the model moves and the sections stay where they are. Does anyone know of a way of moving a section or attaching a section to a level? I've tried "section.location.move" but I get "null" when trying to get the location. Any help is appreciated.
Revit 2019 Example
Revit 2020+ Example