Location of rebar

Hi,

I’m looking for a node/way to find the position (coordinates) of rebar in a beam.
Seems like “element.getlocation” doesn’t work for rebar.

cheers,
Dennis

2 Likes

Hi Dennis! Take a look at BIM4STRUC package and getcenterlinecurves

Hi Einar !
I’m working on that now.
Not many examples to find on this complex node…

Hi, here’s a recorded webinar (oct. 18): Winning With Dynamo Webinar

Thx, watching it now. Maybe it will help me further.

What version of Revit are you using? The method was changed in Revit 2017 so the node will probably not work in 2016 or earlier releases.

If that’s the case you can have a look at this post;

@Einar_Raknes

That might be the problem then. I’m using Revit 2016.
I’ll try tomorrow on Revit 2017. Thanks for the help !

Your Python script works perfectly. I now get the coordinates of my rebar.
My rebar is a number of stirrups. Do you think it is possible to get the separate coordinates of each stirrup ?
When I use the script I get the coordinates of just one stirrup.

1 Like

It’s not completely straight forward, but have a look here:

In 2017 you could try to feed a list of bar positions to the getcenterlinecurves node

I found another script I had written once, but forgotten about. Think it does what you want:

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('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
view = doc.ActiveView

#Convert input from dynamo to revit
rebar = UnwrapElement(IN[0])

#Set options
mpo = MultiplanarOption.IncludeAllMultiplanarCurves

#Get info from rebar
numOfBars = rebar.NumberOfBarPositions
quantity = rebar.Quantity
layoutRule = rebar.LayoutRule

if numOfBars > 1:
	#Find visible bars and get their centerline curves transformed to correct position
	centerlineCurves = []
	for i in range(numOfBars):
		if not rebar.IsBarHidden(view,i):
			posTransform = rebar.GetBarPositionTransform(i)
			revitCurve = [c.CreateTransformed(posTransform) for c in rebar.GetCenterlineCurves(0,0,0,mpo,0)]
			centerlineCurves.append([r.ToProtoType(True) for r in revitCurve])
	
else:
	centerlineCurves = [r.ToProtoType(True) for r in rebar.GetCenterlineCurves(0,0,0,mpo,0)]
OUT = centerlineCurves
4 Likes

Seems like something is wrong with the number of arguments in the GetCenterlineCurves
(still using Revit 2016 btw)

try to remove mpo

perfect !
Now I need to find the intersection of these coordinates with the beam curveline.
The reason I need this is because I’m trying to export the rebar stirrup positions with their (relative to the beam) x coordinates to textfile.

1 Like

There is off course a simpler way…To determine the distance between the x-coordinates

1 Like


Is there a way to only list the x coordinates of the first curve of each element ?
Another problem is that this method does not work a set of different stirrups.
It gives me the curves of just one set.

1 Like

The easiest solution is to create a custom node:

Ok…I’m getting there. Wrote myself a pythonscript to get all the stirrup curve coordinates.
Now I’m trying to get all the separate distances. This might be a stupid question but is there an easy way to calculate the distance between all these points ? As you can see I know how to do it between the first two points, but I need a list of all distances.

Another option might be to extract just the x values from the points and load those into a python script.
Any ideas ?

1 Like

Solved it !
With a little help from @Einar_Raknes :wink:
Note: This only works on a beam with stirrup rebar. No other rebars.
Next step will be to filter out the stirrups.

Stirrup distances.dyn (11.7 KB)

1 Like

Removing mpo works, but how can the Python Script take multiple model elements and not a single element?

@Gcf_Design Refer this post @Einar_Raknes has described how to handle list with multiple elements.