Changing parameters of elements in Model Groups

Anyone got a clue how to edit use Dynamo to change parameters of elements that are inside of a group without having to “ungroup”? it’s almost like i need to be able to Run Dynamo with “edit group” opened, but it won’t seem to let me do that either…

Clarification- I’m actually changing family types (beam types). If I were just changing instance text parameters, I could work around the group problem. But changing from one beam type to another, the groups start trying to ungroup themselves even though the end result would be all identical groups since as Revit sequentially starts changing elements the groups fall out of sync for a short time.

I guess you have to do the following steps:

get Group name

get elements in group then ungroup

change type

create new group with previous name

you should look at building coder page to find help on this topic.

I’ve never seen the benefit of Revit groups, to me they’ve always seem cumbersome and extremely bloated and your case kind of adds to my observation. I don’t think there’s an API method for editing a group ( or editing the elements of a group). This link is a bit old, but it seems to agree: http://thebuildingcoder.typepad.com/blog/2010/08/editing-elements-inside-groups.html

So you have a few possible approaches:

1)Define a new group that encompasses the changes(either manually or through the api) and set your groups’ type parameter to the new group’s.

2)Get your list of groups, select the first, duplicate it, make changes(Revit might give you an error but will accept the changes as long as the group has a single instance)

3)Don’t use groups (at least till Autodesk fixes them) because right now they’re more headache than they’re worth. I’ve had a much better experience replacing groups with Revit links.

You can make option 2 to work with the clockwork package:

Capture2

 

 

I agree that groups are a pain and often more trouble than they are worth. But I find that when dealing with just beams and floors, the headaches are fairly minimal and the benefits outweigh trouble.

I had had already manually done the duplicate group method (option 2), but was just fishing to see if anyone knew of a way to open up group editing through the api. Seems like the easiest approach will be to have Dynamo duplicate the groups, make the changes, then reset the duplicated groups back to the original groups.

Thanks for the responses and advice.

So I’ve put together some nodes that duplicate the multiples of the same group so that I have only one “instance” of several identical yet uniquely named groups. I also have a group of nodes that reverse the process back to where I have multiple instances of one group.

The problem I’m now having is that the process of setting parameters and switching family types of the beams inside the groups (in Revit) that resides between the duplicate groups nodes and the reset groups nodes seems to not actually take place until the dyno definition completely runs (end of transaction). I have tried using some convoluted “if” nodes to create a switch and using “pause” nodes to give the beam type switching and beam parameter writing time to complete before the duplicated and renamed groups reset back to the original group, but I am having no luck. It appears that the changes in Revit do not start to apply until the Dynamo runs to completion (at which point the groups are back to the original state and result in the “Ungroup” message).

Any ideas?

Dynamo nodes run concurrently in its latest version. There was a way to control the order of events in older versions, but it was removed. However if, you chain things one after the other, like in the image I posted above, you can still have some marginal control on the flow of events.

Take a look at the images posted below. I thought I had some control on the flow of events because of how I had it set up. My test model has 2 unique groups (Test Group and Test Grupo), 3 instances of each (6 groups total)

Part “A” takes the groups and creates duplicates so that I only have one instance of every uniquely named group (Test Group, Test Group 0, Test Group 1, Test Grupo, Test Grupo 0, Test Grupo 1).

Part “B” is the section that makes all of the changes to the beams in Revit. This is the section that would result in my groups blowing apart except for the fact that there only exists one instance of each group at this point.

Part “C” is the section that takes the duplicated groups (Test Group 0, Test Group 1, Test Grupo 0, Test Grupo 1) and “resets” them back to their original group (Test Group and Test Grupo).

To try to ensure that the Dynamo does not get ahead of itself, after part “B”, I run everything through a couple of “if” nodes to try to ensure that part “B” is run before part “C” ever starts (Second image).

Here’s where things get weird…

If I un-connect part “C”, the whole thing runs fine, except that I have to go back in Revit and manually reset the duplicated groups.

If I leave part “C” connected, I get the message that Revit must “ungroup” in order to make the changes.

What this seems to be telling me is that somehow the part “B” runs in Dynamo (without the part B changes completely occuring in Revit) and then allows everything to pass thru to Part “C”, which then resets the groups while the part “B” changes are still underway in Revit and results in the “Ungroup” error message.

Or…

Does Dynamo run completely to it’s end before changes ever start occuring in Revit - therefore having the group reset in the same dynamo definition will never work since it will effectively never create the duplicated groups in Revit in the first place to allow the grouped element changes to take place.

Group Issue 2

I seem to be having problems selecting groups with the latest daily builds…

My understanding is that every time you press “Run” in Dynamo, it opens a transaction in Revit, goes through its nodes left to right and at the end submits the transaction. While it is inside the transaction, the Revit document is actively changed with each manipulation node. You should be able to control the transactions with the “Transaction.End/Start” nodes, however for the group editing workflow , my experience was that it’s not required to do so.

I think that your workflow is very extensive and it might be hard to troubleshoot. Why not scale down first and see if we can find the problem?

…and Dimitar answers my question without even knowing it.

I’ve only been in Dynamo since December so I’m still a newbie. Transaction.End and Transaction.Start are two nodes I was unaware of, but that did the trick. By placing them back to back, I am now able to force Revit to complete the beam changes within the duplicated groups before starting the process of replacing the duplicated groups with the originals. All works as i had hoped it would.

I am using 0.7.5, so I can’t speak to the issue with daily builds…

Thanks for the help…

Group Transaction

 

Just adding a finding to the “objects in groups” problem.

I encounterd the situation that even just reading some parameters from objects in groups, these groups got ungrouped and deleted.

 

Since this group-problem is known since 2010, we should hope for an API- fix soon?

Best

Thorsten

Hello! I have a question regarding groups again.Do you guys know how can i swap the groups withing dynamo? I would like to change one group with another one maybe by changing their type parameter from Group A to Group B. So i dont want to edit the elements inside the group but just the change the group instance itself. I managed to get the list of groups and their parameters but the " set parameter by name" doesnt seem to work.

Hi Constantin,

There was already an example of this further above, however it was in DS. You can refer to it above for more detail. Here’s a node example:

1 Like

Hi Dimitar, thanks for the feedback! I managed to do it in a similar way. With the first slider i select which group type parameters i want to change while with the second slider i choose from the list of available values of this parameter. I find it confusing that parameter value and parameter name is not the same thing. But i guess i can somehow associate the list of GroupType names with the group type ids I dont know why the Lunchbox component doesn`t work?

The lunchbox node does not work for element storage parameters ( the “Type” parameter stores the group type element). Its intended use is mainly for text number and integer type of parameters.

You could use something like clockwork’s “Elements.FilterByName” node to select a group type by name:

1 Like

I know it’s a old topic but I’m dealing with setting instance parameters for elements inside model group. On the second post Ben wrote “If I were just changing instance text parameters, I could work around the group problem”. The way I found to do this is creating a shared parameter and assign it as a project parameter set to “can vary by group instances” and using it in Dynamo. Is this the only work around or is there a better one?

Gustavo

Gustavo-

The shared text parameter setting vary on group instances is exactly what I was alluding to and is by far the easiest thing you can do. I was changing beam sizes so I had to be able to mess around with the groups themselves…

Ok Ben, thank you very much.

Sorry to bump this one but i have almost gotten a script working regarding an “un-group / edit/ re-group”
I just cannot seem to get the new groups to have the same name as the old ones. Probably a simple fix, but cant see at the moment. Thanks for any help on this :slight_smile:
Ungroup-Change-Regroup.dyn (18.3 KB)