Rebar diameter

Hi everyone,

Is there anybody who can show me how to get the rebar diameter by API ?
Seems like diameter is not a part of the rebar class. I think I need the rebarshape class.

Thx,
Dennis

A rebar is made up of several families or element types. Rebar Shape, RebarBarType, RebarHook and so on. The diameter is a parameter of the RebarBarType. You can use GetParameterValueByName to access the parameters. Take a look at these node from BIM4Struc:

If you want to use python and access it directly from API, do something like this:

def getRebarDiameter(rebar):
	bartypeId = rebar.GetTypeId()
	type = doc.GetElement(bartypeId)
	diameter = type.BarDiameter
	return diameter
1 Like

Thanks !

Hello Einar,

Is there a similar way to find the rebar shape code ?
I’m having trouble to read that value using API.
For example the Name / Shape code of a stirrup is 51

What have you tried so far?

Here is a suggestion:

def getRebarShapeName(rebar):
	shapeId = rebar.RebarShapeId
	element = doc.GetElement(shapeId)
	name = element.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString()
	return name
1 Like

mwah…I forgot the “BuiltInParameter” part… Staring too long at this screen.
Thx Einar !!

Hi EInar,

Is there a similar way to get a curve list of a rebar (a,b,c,d, etc) ?
I’ve tried the BIM4STRUC node but that didn’t work. It will be better if I find of piece of Python script to do this.

Hi @d.kelfkens

You will find your answer here How can we read a rebar set?

I don’t understand the question… What didn’t work with the node you tried?

I’m trying to read the values a to g (for a bar bending schedule) from a rebar family.

You can use the GetParameters(name) method or get_Parameter(Guid).

aParameter =  rebar.GetParameters("a")
aValue = aParameter[0].AsValueString()

Is it possible that getRebarShapeName(rebar) changed in Revit 2019 ?
My script (which I haven’t used for a while) isn’f functioning anymore.

Yes, things have changed since they introduced “free form rebar”. I guess you can use

get_Parameter(BuiltinParameter.REBAR_SHAPE).AsValueString()