Get RebarShape in a rebar shape family file

Get RebarShape in a rebar shape family file

corinne.astori
Advocate Advocate
221 Views
1 Reply
Message 1 of 2

Get RebarShape in a rebar shape family file

corinne.astori
Advocate
Advocate

Hi!

I would like to make changes to a rebar shape family file and I need to get to the RebarShape of that specific shape family.

I open the family file like this:

Document doc = m_app.OpenDocumentFile(fileToOpen);// open the family file of the rebar shape I want to work on

 

Then I would like to obtain the RebarShape that corresponds to this document (file of the shape) in order to use the methods associated with it, like for example rebarShape.SetAllowed(barType, true). How can I get from document to RebarShape?

 

Thank you in advance for your suggestions.

Corinne

0 Likes
Accepted solutions (1)
222 Views
1 Reply
Reply (1)
Message 2 of 2

corinne.astori
Advocate
Advocate
Accepted solution

I finally found the solution and it was easier than expected...I write it here just in case someone else should run into the same question.

I simply retrieved all the rebar shapes in the document with a collector and retained the first one...

IList<RebarShape> allShapes = new FilteredElementCollector(doc).OfClass(typeof(RebarShape)).Cast<RebarShape>().ToList();

RebarShape rebarShape = allShapes.FirstOrDefault();

0 Likes