Rebar.SetLayout does not work Revit 2019

Hi guys, I am having problems using the node Rebar.SetLayoutAsMaximumSpacing in Revit 2019. It works fine in Revit 2018 but when i try the same code on 2019 version of Revit it does not work. Does anyone know why this is happening?


I’m having the same issue. The node is not doing anything. I checked the node code and everything seems to be fine, so I don’t know what the problem could be.

It’s because of an API change, the set spacing methods are moved to the RebarShapeDrivenAccessor class. In your code you need an addition step, GetShapeDrivenAccessor() from your Rebar.

sda = rebar.GetShapeDrivenAccessor()
sda.SetLayoutAsMaximumSpacing(numberOfBarPositions, arrayLength, barsOnNormalSide, includeFirstBar, includeLastBar)

It worked! Thank you very much. I’ll just copy the entire syntax if anyone has any trouble knowing where to put it.

#Preparing input from dynamo to revit
rebarElement = UnwrapElement(IN[0])
spacing = IN[1]
arrayLength = IN[2]
barsOnNormalSide = IN[3]

#convert from mm to feet:
if IN[6]:
	spacing = spacing/304.8
	arrayLength = arrayLength/304.8

#Change rebar in transaction
sda = rebarElement.GetShapeDrivenAccessor()
sda.SetLayoutAsMaximumSpacing(spacing, arrayLength, barsOnNormalSide, includeFirstBar, includeLastBar)

I was not being able to run it because the parameter names in my node were not the same.

Now with that tweak works :slight_smile:


By the way: There is a node for setting maximum spacing in the Dynamo for Rebar package.

1 Like

Thank you guys!

I think you need to change as well the first Input in the dyf to: