Revit 2025 - Modify Floor Subelements - Slabshape editor

Revit 2025 - Modify Floor Subelements - Slabshape editor

mvanderlinden_VHB
Explorer Explorer
1,387 Views
2 Replies
Message 1 of 3

Revit 2025 - Modify Floor Subelements - Slabshape editor

mvanderlinden_VHB
Explorer
Explorer

I'm trying to modify a floors subelements in dynamo using a python script. 

 

When I try to use the methode SlabShapeEditor.AddPoint(xyz) or SlabShapeEditor.AddPoints(List<xyz>), I get an error that the points can't be added because of an invalidOperation exception. 

 

I only seems to occur when the points I would like to add are on corners or edges of a floor. 

 

Points that are "inside" the boundary are working fine. 

 

The API does state that

"the newly added point should be inside the element boundary on the x-y plane."

 

So it does make (at least a bit) sense to me. 

 

How do I move the existing boundary points of an slab?

 

The SlabShapeVerticesArray is empty, so i can't seem to use the method modifySubelement.

 

Am I looking at this the wrong way?

 

 

0 Likes
1,388 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

I am neither a slab shape editor or Python expert, but I asked Gemini for you and received an answer that makes a lot of sense to me. Please take a look at it and let us know whether it helps; thank you:

     

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

Sean_Page
Collaborator
Collaborator

Not quite the same, but whenever I have done slab edits for say updating with room boundaries, I have always copied or recreated the entire boundary (curve loops) and set it vs updating or adding points. Definitely may be computationally heavier, but unless you check that the point is inside, it could be a more stable approach.

 

Sketch FloorSketch = Doc.GetElement(floor.SketchId) as Sketch;
                            CurveArrArray prof = FloorSketch.Profile;
                            SketchEditScope es = new SketchEditScope(Doc, "Update Floors");
                            if(es.IsSketchEditingSupported(FloorSketch.Id))
                            {
                                es.Start(FloorSketch.Id);
                                using(Transaction trans = new Transaction(Doc))
                                {
                                    trans.Start("Update");
                                    Doc.Delete(FloorSketch.GetAllElements());

                                    if(room.GetBoundarySegments(calcOptions) is IList<IList<BoundarySegment>> segments)
                                    {
                                        List<CurveLoop> CurveLoops = [];
                                        foreach(IList<BoundarySegment> segment in segments)
                                        {
                                            List<Curve> curves = [];
                                            foreach(BoundarySegment seg in segment)
                                            {
                                                Doc.Create.NewModelCurve(seg.GetCurve(), FloorSketch.SketchPlane);
                                            }
                                        }
                                        trans.Commit();
                                    }
                                    es.Commit(new Utils.FailuresPreprocessor());
                                    count ++;
                                }
                            }
Sean Page, AIA, NCARB, LEED AP
Senionr Partner, Computational Designer, Architect
0 Likes