Hi Dynamo Friends,
I am wondering if i can explode rebar container which grouping many rebar sets with different spacings to get the source rebar sets again.
Is there any node or python script to do that ?
Thanks in advanace.
Is there any suggestions.
Thanks in advance.
Is there anyone know is it possible or not to explode rebar container?
Thanks.
If I recall correctly, The Rebar Container object was developed in order to allow Autodesk’s development partners such as Sofistik and Naviate to build more full-featured rebar addons for Revit, that allow flexibility beyond “traditional” rebar sets where all bars are same.
As an API-Only object, you can certainly modify and “Explode” a container of rebar. (Whether or not it can be a set will probably depend on how the individual rebar elements were created.)
Are there “Out of the Box” nodes to do this? I don’t think so.
But you can look through the packages that are out there.
The “official” Structural Design package (published by Tomasz Fudala of Autodesk) is continually updated, but doesn’t appear to have had any container functionality added to it.
The Bim4StrucRebar package developed by Dieter Vermeulen of Autodesk also doesn’t have any container element functionality, but it doesn’t look it’s maintained. The plus side of this package is that the nodes appear to be all completely Dynamo-Based, so you can right click and edit them and get a fully formed Dynamo script for other rebar-based functionality.
The “Dynamo for Rebar” package is open source and on Github. (created and maintained by Thornton Thomasetti) But according to the Package manager, it hasn’t been updated since 2018. It does have some nodes for creating/adding rebar to a container but not for removing.
I expect if you look at the source code, you could modify some of them to remove or explode the container.
But if you just want to dig into doing it yourself via Dynamo or C#, your best place to start is the Revit API Docs website:
I would imagine that the way to do it is grab the rebar container, iterate through the contained items, and remove them from the container. Seems like a “simple” coding task.
Looks like this is largely undeveloped by the greater Dynamo community (the joy of being a structural engineer)…
Good luck!
Also, searching the forum may be a good way to get started on this task. For example, @staylor has some python code in this thread that appears to iterate through the rebar elements in a container to total the length of the bars- it could be modified or expanded to “explode” the container by removing them.
(Edit: I guess this is based on a forums post by @Organon , both links below.)
If you end up getting this working, please share!
@Joe.Charpentier, I really appreciate your time to answering my question.
I have a good knowledge about Revit API but i can only remove item from container but, can not get the source item again as rebar element.
But it seems Revit API does not allow to get beck the source rebar elements again form the rebar container.
Thanks a lot.
When you “remove” the rebar element from the container via the API, does it still exist in the project?
Can you share the code you care currently using?
@Joe.Charpentier , it completely delete the item for the revit doc.
there is a simple code you can try :
container = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
x = container.RemoveItem(container.GetItem(0))
TransactionManager.Instance.TransactionTaskDone()
OUT = x
Well, that behavior is not helpful. It’s not intuitive that it would delete it from the document. I suppose that is why no one has bothered to make a “remove” node in Dynamo.
I guess as part of your loop, you could get the rebar element and duplicate/copy/paste it and then remove it from your container. I know a rebar/rebar set is a super complex element with lots of interactions- Shape type, Bar Type, host, constraints…
I assume if you have not done this already, it’s probably not easy.