Floor contour and location with Python

Hi everyone,
I was trying to get a floor outline contour, assuming it worked just like a wall (or other line driven elements) location curve.
However, the locations I extract with Python are neither curves nor points. When applied to floors, the Element.GetLocation node gives an error as well.

So, does anyone have an idea how to get a floor contour with the API?

Thanks!

It’s a bit tricky but it’s doable with a workaround.

If you use doc.Delete() on the floor you get the list of deleted elements as return. There you will find all the lines that make the floor sketch. Roll back the transaction to un-delete the floor.

1 Like

Oh god… I knew floors were trouble :slight_smile:
How do I roll a transaction back within the same script?

Here is a snipped of the code I use to get the floor contours.

trans = Autodesk.Revit.DB.Transaction(doc, "Temp Transaction")

trans.Start()

delel = doc.Delete(slab.Id)

trans.RollBack()
1 Like

Works like a charm.
Thank you!

In the springs package there is a node called “Springs.Collector.ElementSketch”. This will return the lines that form the floor. Might be a bit easier to use that instead.

2 Likes

Thanks, but I’m making an effort to stick to the API. Hope it’s gonna pay off in the long run.