Posts

Showing posts from January, 2025

Create Dimensions - Rooms

Image
In this post, we discussed creating dimensions with the Revit API. But we only discussed dimensioning walls. Sometimes, however, we want to dimensions to include other elements - balconies, for instance, which are not typically drawn with wall elements. In this case, we can use our room separation lines. def r2(num): return round(num, 2) doc = DocumentManager.Instance.CurrentDBDocument rooms = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms).WhereElementIsNotElementType().ToElements() Once that's done, we can iterate through all these lines to find their maximum extents (for the purposes of this post, I'll assume we just want to dimension the rooms' x extents). leftmost_x = float('inf') rightmost_x = 0 line_left = None line_right = None for line in roomlines: info = line.Location.Curve direction = info.Direction origin = info.Origin if r2...