top of page

Revit - Matching Room Finishes

There are many things that we want to repeat over and over again like copying elements from one location to another. Some of these features are built into Revit, but other things like copying values between elements in the model are not a standard feature in Revit. One such option would be transferring values between rooms.


What we do quite often is create Finish Tags and/or Schedules for rooms. It doesn't matter which we are creating, they both utilize the same parameters. I create a routine that would allow you to select a master room finish and pick all the rooms that I would like the finishes to be copied.


public void FinishMatch()
        {
            var roomFilter = new RoomFilter();
            try // try/catch block with PickObject is used to give the user a way to get out of the infinite loop of while (true)
            // PickObject throws an exception when user aborts from selection
            {
                while (true)
                {
                    var roomTarget = _document.GetElement(_uiDocument.Selection.PickObject(ObjectType.Element, roomFilter, "Select a Room. ESC when finished.").ElementId) as Room;

                    IList<Reference> references = _uiDocument.Selection.PickObjects(ObjectType.Element, roomFilter, "Select a Room. ESC when finished.");
                    //retrieve the parameters of the target Reference

                    foreach (var reference in references)
                    {
                        using (var transaction = new Transaction(_document, "Match Workset"))
                        {
                            transaction.Start();
                            var room = _document.GetElement(reference) as Room;
                            if (roomTarget != null)
                            {
                                var wallFinish = roomTarget.LookupParameter("Wall Finish").AsString();
                                var baseFinish = roomTarget.LookupParameter("Base Finish").AsString();
                                var ceilingFinish = roomTarget.LookupParameter("Ceiling Finish").AsString();
                                var floorFinish = roomTarget.LookupParameter("Floor Finish").AsString();

                                if (room != null)
                                {
                                    var parameterWallFinish = room.LookupParameter("Wall Finish");
                                    var parameterBaseFinish = room.LookupParameter("Base Finish");
                                    var parameterCeilingFinish = room.LookupParameter("Ceiling Finish");
                                    var parameterFloorFinish = room.LookupParameter("Floor Finish");


                                    parameterWallFinish.Set(wallFinish);
                                    parameterWallMaterial.Set(wallMaterial);
                                    parameterBaseFinish.Set(baseFinish);
                                    parameterCeilingFinish.Set(ceilingFinish);
                                    parameterFloorFinish.Set(floorFinish);
                                }
                            }

                            transaction.Commit();
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
class RoomFilter : ISelectionFilter
    {
        public bool AllowElement(Element e)
        {
            return (e.Category.Id.IntegerValue.Equals((int)BuiltInCategory.OST_Rooms));
        }
        public bool AllowReference(Reference r, XYZ p)
        {
            return false;
        }
    }




151 views0 comments

Recent Posts

See All
bottom of page