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)
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?
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.
@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.
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
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.
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…
@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 . 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.
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:
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?