How to ungroup all group elements in a project

How to ungroup all group elements in a project

Anonymous
Not applicable
21,297 Views
9 Replies
Message 1 of 10

How to ungroup all group elements in a project

Anonymous
Not applicable

Is anybody know how to ungroup all group elements and delete all groups?

0 Likes
Accepted solutions (2)
21,298 Views
9 Replies
Replies (9)
Message 2 of 10

ToanDN
Consultant
Consultant

Right click on each Group on the Browser, select all instances in project, ungroup, and repeat.

Or, open a 3D view, unhide everything, select all and filter to keep only the Groups highlighted, ungroup.

 

When done, Purge All and check the Groups you want to Purge, or simply delete them from the Browser.

Message 3 of 10

Anonymous
Not applicable

I am talking about Revit Api. 

0 Likes
Message 4 of 10

ToanDN
Consultant
Consultant

Had no idea.  Why didn't you post on API forum instead?

Message 5 of 10

Troy_Gates
Advocate
Advocate
Accepted solution

Here is a quick macro that will ungroup all placed group instances in the model

 

public void UnGroupAll()
{
	Document doc = this.ActiveUIDocument.Document;
	
	using (Transaction t = new Transaction(doc, "Ungroup All Groups"))
	{
		t.Start();
		
		foreach (GroupType groupType in new FilteredElementCollector(doc).OfClass(typeof(GroupType))
	         .Cast<GroupType>()
	         .Where(gt => gt.Category.Name == "Model Groups" && gt.Groups.Size > 0))
		{
			foreach (Group group in groupType.Groups)
			{
				group.UngroupMembers();
			}
		}
		
		t.Commit();
	}			
}
Message 6 of 10

Anonymous
Not applicable

Can it be applied to a family instead of a project? Even be embedded in Dynamo?

0 Likes
Message 7 of 10

Anonymous
Not applicable

 Hi Troy,

 

Thats great!! What code language is this? Would like to try this out but need to set the code type in the macro dialogue box (revit2018)

 

Thanks in advance! 

 

P

0 Likes
Message 8 of 10

asantman7A9KD
Contributor
Contributor
Accepted solution

So I come across the issue of groups in Revit models quite often - and I need them to go away for FM solutions as they serve no purpose other than clogging models. And typically production end-users do not use a solid naming or implementation when creating them - annoying to say the least. So I used a couple packages in Dynamo and created a small quick script you can run.  You could even add a node to delete them all after its run - I just select all groups in the browser list, right click and delete.

Script attached - Dynamo Version 2.02 - packages labeled within script

Message 9 of 10

jihwan.leeYV77N
Explorer
Explorer

Watch it

Message 10 of 10

dc
Advocate
Advocate

In Revit 2019, when I select all in project, I don't get further options.

0 Likes