To copy Rebars and Rebar container from a shaft to others shown in the image below, I thought to follow steps in @Einar_Raknes script posted here regarding the same issue, but I was unable to extract the the desired parameter All Elements of Category as I mentioned here, so do you think this script is desired in my case, if not which steps should I follow to achieve my desires
Hello, as the rebars are hosts of the concrete element if you copy the element the rebar sets follow.
You will probably have to assign to your elements already present then delete the corresponding host elts
Hello, I tried too
with generic model (the containers follow), so in your example copy element after having scrapped it then make your alternative rotations (already treated later)
(why do you want to make your file heavier if your distribution is the same on levels)
If you only want to use the API here (ClockWork package person node will always be better optimized), than a lame version from me.
I think I was confusing Set and Container
It’s a little less hazy now but not super clear
here are some research done on the API
There is a host for the container
#######OK NOW YOU CAN CODE########
from Autodesk.Revit.DB.Structure import *
rebar_sets=UnwrapElement(IN[0])
elt_host=UnwrapElement(IN[1])
TransactionManager.Instance.EnsureInTransaction(doc)
#Create the container Type
cont_type_balcon=RebarContainerType.GetOrCreateRebarContainerType(doc,'Container du balcon 03')
#Create the container
cont_balcon=RebarContainer.Create(doc,elt_host,cont_type_balcon)
#Append the set for the container
[cont_balcon.AppendItemFromRebar(r) for r in rebar_sets]
TransactionManager.Instance.TransactionTaskDone()
OUT = cont_type_balcon,cont_balcon,{'Host Element':cont_balcon.GetHostId()},[cont_balcon.GetItem(0),cont_balcon.GetItem(1)]
My problem is not related to creation of rebar containers!! …my containers are already created and filled by their corresponding rebar (Have you run my script above to see how things go?)
As I said above, I want to follow @Einar_Raknes sample which seems to me is a similar case and it’s concept is: getting the rebars Ids based on their category from the source element and include them in the target host using "SetHostIdMethod " as is demonstrated in the last part of his script below
but the problem in my case rebars are associated to their containers and I can’t copy them according to the Einar script without extracting them from their containers and I dont know how to do that??
To rephrase what @christian.stan indicated: if your problem is with copying rebar from one mass to another, generate one of each rebar class (rebar container or rebar) with a very simple design, and share that file to build your code against that. Once that is solved you can assemble the various parts and pieces into the full graph by moving the custom nodes to scale (yes, your work should be packed into packages custom nodes, on the package manager or elsewhere) into sequence to create and copy the rebar in one graph.
It’s strange!!..I dont know what’s happened with my revit and dyn files??
when I opened the dyn file I found a duplicated keys of the nodes RebarbarType and RebarhookType I don’t know what this is due to??
Please check below the corrected files that should work
a file with rebars already present between level 1 and 2 that would be good to see if it comes from the version you are using
I’m not sure but maybe Mr. AndyDandy (in his custom node) used the SetAssociatedLevel Method of the LevelAssociatedData Class
As it is a class of v2023 it smells very bad
I don’t know if an element can be copied from one level to another level with the Element TransformUtils class (in the same level yes)
i will try tomorrow if i get a file with rebars
edit: Thanks Mr. Organon, you fixed it