Ungroup Elements

Is there a way to ungroup elements in dynamo? Could someone write some python script to do this? Thank you.

Uploading this bad boy to Rhythm now. :slight_smile:

 

It can be dangerous so make sure the groups you tie into the node are ones you want to ungroup.

John, You sir. Are a gentleman! Thank you VERY much! I’ll share why I wanted this module tomorrow! I have one other thing I would like to accomplish out of this. What about ungrouping said group and converting that ungrouped group into an assembly that maintains the same name of said “Group”?

Interesting. Will check out tomorrow!

Thank John. I’ll post some examples to why this could benefit us and others (potentially) tomorrow as well. Great to have people like yourself in the Dynamo community!

I was thinking about this John. It would be better if the module had the ability to add an A… B… And then C… Etc. at the end of each assembly that is the same as the group name because Revit has a hard time creating two identical assemblies with the same exact name. This would allow people to store system families as groups and then to use those groups through this “module” to create assemblies that can be used for eventual barcoding.

Sounds good, time for some string concatenation! :slight_smile:

The API method is here http://revitapisearch.com/html/e0a37a7b-b157-b992-21d2-95f68cc76abd.htm While I’m starting to understand Python more, I’m afraid this one is beyond me. I know what the node needs and what the methods are, but my Python knowledge isn’t there yet. Dimitar? :slight_smile:

See attached image for an example of how to take Elements to Assemblies. This should do the trick… You could follow this up with a renaming python script or group of nodes to rename the Assembly instances to match the group names.

Ben, do you have a package that you will post this to? Or did you want me to bundle it in Rhythm? (With Credit of course)

Feel free to package it up John. I’m not sure I want the responsibility of maintaining and curating a package.

Ben and John,

Thank you for making this community GREAT. I appreciate it very much. This has accomplished a lot for us. Here is a bit of what we’ve done thus far without the python script portion, but it will simplify a lot for us in our modules…

http://therevitsaver.blogspot.com/2016/01/dynamo-qr-coding-assemblies-and.html

Best Regards,

Brian D. Nickel

Just saw steamnodes. Tool.CreateAssembly… Nevermind :slight_smile:

Does this Group.UngroupElements node still exist? I can’t find it

1 Like

image

(Dynamo 1.3.2)

Thank you. Must be because I’m using 1.2.1 (because of other scripts I use, I have to keep this version on Revit 2017)

Hopefully @Andreas_Dieckmann won’t mind, here’s what’s going on inside that node…

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from System.Collections.Generic import *

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

doc = DocumentManager.Instance.CurrentDBDocument
groups = UnwrapElement(IN[0])
elementlist = list()
TransactionManager.Instance.EnsureInTransaction(doc)
for group in groups:
	try:
		ids = group.UngroupMembers()
		ungrouped = list()
		for id in ids:
			ungrouped.append(group.Document.GetElement(id))
		elementlist.append(ungrouped)
	except:
		elementlist.append(list())
TransactionManager.Instance.TransactionTaskDone()

OUT = elementlist

Cheers,

Mark

Make sure to use the clockwork one as I removed mine in later versions.

Thanks guys!

Anybody know of a method to ungroup individual elements from a group?

That’s a big topic. I would say to go ahead and create a new topic for that one.