Ungroup all


#1

Hi all,

I have a project in my office where someone went a little overboard with detail groups. There are probably 500 of them, grouping every detail, as well being used instead of detail components.

There used to be an addin that ungrouped all groups (Case, I think) but it is no longer available.

Can Dynamo be used do something like this?

Thanks!

Chris Mungenast


#2

Try this. Needs a list as an input.

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

Import DocumentManager and TransactionManager

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

Import RevitAPI

clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

import sys
pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)

items = UnwrapElement(IN[0])
elementlist = list()
TransactionManager.Instance.EnsureInTransaction(doc)
for item in items:
elementlist.append(item.UngroupMembers())
TransactionManager.Instance.TransactionTaskDone()
OUT = elementlist