Select all rebar

Select all rebar

KE-engineering
Contributor Contributor
1,884 Views
5 Replies
Message 1 of 6

Select all rebar

KE-engineering
Contributor
Contributor

Hi everyone,

 

Is it possible to select all rebar in a host (in my case a concrete beam) and copy that to another host using VB.Net ?

An example is much appreciated 🙂

 

Cheers,

Dennis

0 Likes
1,885 Views
5 Replies
Replies (5)
Message 2 of 6

matthew_taylor
Advisor
Advisor

Hi Dennis,

It should be. I'm just going to quasi-code this as I'm not near VS right now.

To get the rebar?

 

'get element to copy rebar from
dim elementToCopyRebarFrom as element

'get the built in category of the rebar
dim bic as builtincategory = builtincategory.ost_rebar

dim rebarColl as ienumerable (of familyinstance) = _
new filteredelementcollector(doc).whereelementisnotelementtype.ofclass( _
gettype(familyinstance)).ofcategory(bic).cast(of familyinstance).where( _
function (fi) fi.host.id.integervalue.equals(elementToCopyRebarFrom.id.integervalue) 'you could even limit the overhead on the filteredelementcollector by using a
'bounding box filter as well.

 

 

After that, it's down to can you copy and re-host the rebar to your other beam, or do you have to recreate it?

This bit is beyond my experience, but happily the SDK has a lot of examples of rebar creation. See the Reinforcement,

RebarContainerAnyShapeType, PathReinforcement, NewRebar, NewPathReinforcement, MultiPlanarRebar, etc etc projects.

 

Have a run at it and come back with specific questions if you have them.

 

Let us know how you get on.

 

-Matt


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes
Message 3 of 6

KE-engineering
Contributor
Contributor

Thanks for your reply Matt !
If I get this thing working I'll let you know.

 

0 Likes
Message 4 of 6

manuel.solis.lopez
Contributor
Contributor

 

To collect all rebar in host you can simply use the class RebarHostData

 

var data = Autodesk.Revit.DB.Structure.RebarHostData.GetRebarHostData(host);
var allRebar = data.GetRebarsInHost();

Copy Rebar can be challenging, specially if you consider different kinds of host Elements and Reinforcement objects. But if you want to focus in very specific cases then you could use ElementTransformUtils.CopyElements(...) methods.

 

 

 

 

 

 

Message 5 of 6

jamess166
Advocate
Advocate

Hello, how would you select all the structures, the active view reinforcement bar, thanks in advance

0 Likes
Message 6 of 6

Anonymous
Not applicable

Hi

How i can do this to create container in C#?

0 Likes