Retrieve Rebars Attached to Structural Element
Question: How can I get all associated rebars which attach to a structural element such as a column by picking that?
Answer: Jeremy initially suggested workarounds making use of filtered element collectors. Unfortunately, that was not very helpful in this case.
Happily, Einar Raknes came to the rescue pointing out the real solution for this:
You can use the RebarHostData class and the GetRebarsInHost method to retrieve all rebars associated with a rebar host.
To make sure you pick a valid Rebar Host; you can optionally create a selection filter for it like this:
public class RebarHostSelectionFilter : ISelectionFilter { public bool AllowElement( Element e ) { return null != RebarHostData .GetRebarHostData( e ); } public bool AllowReference( Reference r, XYZ p ) { return false; } }
























