Editing Revit Groups with Dynamo

Hi All,

I have come to a point where I need some assistance with an “Ungroup - Edit parameter - ReGroup” script for Revit groups. I have it working to edit the parameter value (in this case the material) but feeding the different lists of elements and group names wont let me create the exact same groups again after i have edited the parameters. I am using the clockwork groups nodes. It only groups all the elements from the previous groups into one new group. This all stems from needing to change the material value of X into Y for the entire project, and as some elements with this material are in groups, I have run into this problem. I have a script that sucessfully chnages X to Y for all other elements excluding grouped ones. Any ideas?Ungroup-Change-Regroup.dyn (29.2 KB)

Continuing the discussion from Changing parameters of elements in Model Groups:

2 Likes

Hey Erwan, could you send a screenshot? I can’t open your graph (seems corrupted or too old version).

Hi, thanks for the reply. it was made in 0.9.1 (we still have people using this edition in our office) here is a picture.

1 Like

I suppose this can help: I successfully changed parameter values of walls into a group with ElementsInGroup from SteamNodes (no need to ungroup).

2 Likes

Hi,
Yes this works with Walls, but does not work when trying to alter a parameter of a beam family (Start Level Offset / Structural Material) i wonder why that is… any thoughts?

Hi @Ewan_Opie

It is difficult to say why without looking at your graph. Could you please drop screenshot of your graph. Thanks :slight_smile:

Hi, Here is what i was trying as mentioned above.


Also I have simplified the original script/graph so its a bit easier to see. Still cant regroup multiple instances of the same group and others though.

@Ewan_Opie It is working from my side.

1 Like

@Kulkul Yep that works for when you have 1 group type or 1 instance of each group type. It doesnt address the initial problem i was having around editing groups when there are more than 1 instance of the same group type.

@Ewan_Opie It is working for multiple groups with more than 1 instance also.

1 Like

Hi all, this workflow will maybe help too: filtering elements by ID’s.

1 Like

Have you tried with mulitple instances of the same group?

With this ID’s filtering method, it works with multiple instances of groups but the inputs of List.ContainsItem need to be inverted.

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

I have prepared the exact same series of nodes and get this result. I have attached a file containing the families and the dyn. Bit perplexed to as why it doesnt work for me.Dynamo 1.2.1.0 and Revit 2017.

group test R17.rvt (1.4 MB)

latest forum test.dyn (7.4 KB)

I hadn’t this problem yesterday, but after downloading and testing your files, I do get this error now, even with my own graphs! Would I have missed something? It would be very nice if someone had an explanation…

Update: I succeded in setting the Mark parameters

@Yna_Db @Einar_Raknes @Ewan_Opie I think you need to ungroup and regroup your group as shown by @Martin_Spence1. Revit doesn’t like if you copy group multiple times for some reason :confused:. I think this happens when you copy group or else it works as expected. I tried creating multiple groups with one instances and it works fine. Below is the process in action.

1 Like

What Kulkul shows works as long as you only have one instance of each group. You can test this in Revit (without Dynamo) and you will see that very often Revit gives a warning that “changing things in groups without editing the group is disallowed…but I’ll allow it since you only have one instance of that group…”. Go back and read the original post and look at the discussion between me and Dimitar…this was the exact conclusion and the solution as well.

The trick is to get all of the groups of the same type - duplicate that type as many times as needed so that you can have many single instance groups (so 20 instances of “Group 1” become “Group 1”, “Group 1_a”, “Group 1_b”, …). Then make the change to the elements as needed (it will be allowed since there are 20 unique group types). Then end that transaction and start another transaction in Dynamo and switch all of the duplicated groups back to “Group 1” and delete the now uneccesary duplicate groups and you should be in good shape. From the original post this is how you reset the group types:

6 Likes

Hi Ben and all.
The duplicate workflow does work but i am still experiencing a slight error. I have 3 groups in my test file and the first changes the material fine, but the other two do not. They all seem to be assessed as part of the duplicate and rename procedure. Version 0.9.1 Duplicate and Change Parameter in Group.dyn (27.2 KB)

Ah, so the problem lies with the duplicate node, it only duplicates the first item fed into it and so if i have created group 1 (a,b,c) and group 2 (a,b,c) the group 2 duplicates are duplicates of the group 1 type. Any thoughts?

For people who wanna try a different (simpler) approach.

I took the UNGroup REGroup approach. So far it works for a SINGLE Group.
I am working on it so it works for more than one Group.

UngroupChangeEleRegroup.dyn (85.1 KB)

1 Like