Update section level in Revit 2020+

Update section level in Revit 2020+

Craig.FlemingECA7C
Explorer Explorer
350 Views
2 Replies
Message 1 of 3

Update section level in Revit 2020+

Craig.FlemingECA7C
Explorer
Explorer

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

 

CraigFlemingECA7C_0-1645637000452.png

 

Revit 2020+ Example

 

CraigFlemingECA7C_1-1645637019455.png

 

 

 

 

0 Likes
351 Views
2 Replies
Replies (2)
Message 2 of 3

RPTHOMAS108
Mentor
Mentor

In 2020 they removed the clip. 

 

Prior to that if you had it clipped then it would just change the elevation parameter not the actual base point position. When it was unclipped the position changed along with the elevation parameter but the two values could be out of sync.

 

Now it is behaving similar to the previous unclipped state meaning that the base point has a position which is in sync with the values of it's location parameters.

 

A possible solution would be to use the survey basepoint the way you used to use the project one i.e. set levels relative to the survey basepoint rather than the project one and change elevation parameter on the survey basepoint in the way you previously did for the project one.

 

If your elevation values are relative to sea level i.e. large values then you should be using survey point for that. Project base point was supposed to be fairly local to site.

 

 

0 Likes
Message 3 of 3

Craig.FlemingECA7C
Explorer
Explorer

Thanks for that, it's sort of helped. I've got a work around that gets the levels correct (not sure it's the best way of doing it but it works!).

 

Changing the survey point doesn't work by itself, oddly what I had to do was move the survey point the opposite way and then move the base point to where it should be. I used the below to fix it. The result is a survey point at 0, 0, 0 with a base point at 0, 0, [ correct level ] which is the same way I had it originally. I'm sure if the model is linked and positioned in the future I may get some feedback from my engineers and techs.

 

trans.Start("Update survey point");

// Set the survey point to the inverted ground level
Element surveyPoint = new FilteredElementCollector(_doc)
    .OfCategory(BuiltInCategory.OST_SharedBasePoint)
    .WhereElementIsNotElementType()
    .FirstOrDefault();

surveyPoint.Pinned = false;
surveyPoint.Location.Move(new XYZ(0, 0, -UnitUtils.ConvertToInternalUnits(_mccSlab.SlabDesign.GroundLvl * 1000 + 50, _docUnits)));
surveyPoint.Pinned = true;

trans.Commit();
trans.Start("Update project base point");
                
// 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();

 

0 Likes