Editing Revit Groups with Dynamo

Maybe this can help:
This was a test challenge i got from a colleague, so its probably gonna need some tweaking. The challenge was to change a yes/no parameter of an instance of a door type, which is in a model group, in a project containing two instances of the same group.

The first python-script collects all groups in the project:

    import clr

    clr.AddReference('ProtoGeometry')
    from Autodesk.DesignScript.Geometry import *

    #Import the Revit API
    clr.AddReference('RevitAPI')
    import Autodesk
    from Autodesk.Revit.DB import *

    #Import DocumentManager and TransactionManager
    clr.AddReference('RevitServices')
    import RevitServices
    from RevitServices.Persistence import DocumentManager
    from RevitServices.Transactions import TransactionManager

    #Import ToDSType(bool) extensions method
    clr.AddReference('RevitNodes')
    import Revit
    clr.ImportExtensions(Revit.Elements)

    #Reference the active Document and application
    doc = DocumentManager.Instance.CurrentDBDocument
    uiapp = DocumentManager.Instance.CurrentUIApplication
    app = uiapp.Application

    from System.Collections.Generic import *

    #Start scripting here:

    col = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_IOSModelGroups).WhereElementIsNotElementType().ToElements()

    #Assign your output to the OUT variable.
    OUT = col

The second one recreates the list structure of the group elements:
import clr

#Start scripting here:

X = IN[0]
Y = IN[1]

result = [x for (y,x) in sorted(zip(Y,X))]

OUT = result

Best regards :slight_smile:

4 Likes