Extracting rebar information from Revit

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!

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

3 Likes

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?

You are inputting a “int” when it requires a “Bool” for some of the arguments(See GetCenterlineCurves Method (Boolean, Boolean, Boolean, MultiplanarOption, Int32)).

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