# Extracting rebar information from Revit

**URL:** <https://forum.dynamobim.com/t/extracting-rebar-information-from-revit/67435>\
**Category:** Revit\
**Created:** [August 23, 2021, 12:26pm UTC](https://forum.dynamobim.com/t/extracting-rebar-information-from-revit/67435 "2021-08-23T12:26:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bskaarer90](https://avatars.discourse-cdn.com/v4/letter/b/e19adc/32.png) [@bskaarer90](https://forum.dynamobim.com/u/bskaarer90)\
**Post date:** [August 23, 2021, 12:26pm UTC](https://forum.dynamobim.com/t/extracting-rebar-information-from-revit/67435/1 "2021-08-23T12:26:00Z")

</div>

Hi!

I’m trying to extract data on location of rebars in a revit project file. For other structural components I have just topology which has worked nicely. When using nodes like element.geometry or element.getlocation i keep ending up with “empty list” for all the rebar elements.  
Any ideas on how to solve that problem?

Thanks!

---

<div class="post-metadata">

**Author:** ![Brendan\_Cassidy](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/brendan_cassidy/32/7685_2.png) [@Brendan\_Cassidy](https://forum.dynamobim.com/u/Brendan_Cassidy)\
**Post date:** [August 23, 2021, 12:48pm UTC](https://forum.dynamobim.com/t/extracting-rebar-information-from-revit/67435/2 "2021-08-23T12:48:28Z")

</div>

Have you done a search on the forum because I have just done one and getting at least two posts that will help.

> [@Location of rebar](https://forum.dynamobim.com/t/location-of-rebar/7651/21):
>
> Kulkul, Many thanks for this. I am a Dynamo novice really. Managed to create and manipulate a few scripts, but what is outlined is beyond me. I wouldn’t know how to amend the following script to accept multiple elements: import clr clr.AddReference(‘RevitAPI’) from Autodesk.Revit.DB import \* from Autodesk.Revit.DB.Structure import \* clr.AddReference(‘RevitNodes’) import Revit clr.ImportExtensions(Revit.GeometryConversion) clr.ImportExtensions(Revit.Elements) clr.AddReference(‘RevitS…

> [@Get Rebar Centerlines](https://forum.dynamobim.com/t/get-rebar-centerlines/57621/4):
>
> @brenofilipe Try this code: import clr clr.AddReference('RevitAPI') from Autodesk.Revit.DB import \* from Autodesk.Revit.DB.Structure import \* clr.AddReference('RevitNodes') import Revit clr.ImportExtensions(Revit.GeometryConversion) ProcessLists = lambda function, lists: [ProcessLists(function, item) if isinstance(item, list) else function(item) for item in lists] ApplyFunction = lambda func, objs: ProcessLists(func, objs) if isinstance(objs, list) else [func(objs)] def Unwrap(item): ret…

---

<div class="post-metadata">

**Author:** ![bskaarer90](https://avatars.discourse-cdn.com/v4/letter/b/e19adc/32.png) [@bskaarer90](https://forum.dynamobim.com/u/bskaarer90)\
**Post date:** [August 27, 2021, 9:05am UTC](https://forum.dynamobim.com/t/extracting-rebar-information-from-revit/67435/3 "2021-08-27T09:05:03Z")

</div>

Thanks for the links, and sorry for poor research. I have applied the following code on rebar

import clr  
clr.AddReference(‘RevitAPI’)  
from Autodesk.Revit.DB import \*  
from Autodesk.Revit.DB.Structure import \*  
clr.AddReference(‘RevitNodes’)  
import Revit  
clr.ImportExtensions(Revit.GeometryConversion)

ProcessLists = lambda function, lists: [ProcessLists(function, item) if isinstance(item, list) else function(item) for item in lists]  
ApplyFunction = lambda func, objs: ProcessLists(func, objs) if isinstance(objs, list) else [func(objs)]

def Unwrap(item):  
return UnwrapElement(item)

if isinstance(IN[0], list):  
rebar = ProcessLists(Unwrap, IN[0])  
else:  
rebar = Unwrap(IN[0])

def task(rc):  
return [r.ToProtoType(True) for r in rc.GetCenterlineCurves(0,0,0,MultiplanarOption.IncludeAllMultiplanarCurves,0)]

OUT = ApplyFunction(task,rebar)

The error:  
TypeError: GetCenterlineCurves() takes exactly 3 arguments (5 given)

When I try to reduce the arguments to 3, i get the same type of error, except it says that the method takes 5 arguments and only 3 is given…

Do you have some tips?

---

<div class="post-metadata">

**Author:** ![Brendan\_Cassidy](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/brendan_cassidy/32/7685_2.png) [@Brendan\_Cassidy](https://forum.dynamobim.com/u/Brendan_Cassidy)\
**Post date:** [September 3, 2021, 9:23am UTC](https://forum.dynamobim.com/t/extracting-rebar-information-from-revit/67435/4 "2021-09-03T09:23:01Z")

</div>

You are inputting a “int” when it requires a “Bool” for some of the arguments(See [GetCenterlineCurves Method (Boolean, Boolean, Boolean, MultiplanarOption, Int32)](https://www.revitapidocs.com/2018/7be7e413-bfac-bbd3-17b6-ff2008771afa.htm)).

Therefore i would suggest you fix this in the first instance.

Also it may be wise for you to see the following code that may be able to help you as you may need to do some other things for shape driven rebar [https://github.com/jeremytammik/the\_building\_coder\_samples/blob/master/BuildingCoder/BuildingCoder/CmdRebarCurves.cs](https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdRebarCurves.cs)
