Revit/Dynamo – crate location points ordered in columns and rows for list elements

Long I was gone but now I’m back and in GRIMSHAW. Youhoo! 🙂

Partly for the office but mainly after hours I created this simple Dynamo script to orginise elements into columns and rows. Original task was to place views on sheets. Sometime there was one view other time 3 or 5. We wanted to make them not overlap. Although, they would need to be manually corrected later.

Presented her solution is doing just a part of this task. It creates points arranged in maximum number of columns and as many rows as there are objects for each similar string inputs on a list.

(In our office exercise this list contained ordered sheet numbers for corresponding list but with views. A node to “place views on sheets” takes a view, a point with coordinates and is placing it on a provided sheet. List of views, points and sheets must be the same length.)

This Dynamo script is creating this list of points. You have an option to specify the insertion/start point coordinates, max number of columns and a distance between columns and rows. But see it by yourself.

If I orginise points by z coordinate the output looks like this:

Levels would represent sheets or could be Revit Levels used to order other objects.

Python code looks like this:

startX = IN[0]
startY = IN[1] 

offsetX = IN[2]
offsetY = IN[3]

no_of_col = IN[4]

list = IN[5]

pointsX = []
pointsY = []


compare = ""
col_no = 1
row_no = 1

for l in list:
	if compare == l:
		if col_no <= no_of_col:
			pointsX.append(startX + offsetX*(col_no-1))
			pointsY.append(startY - offsetY*(row_no-1))
			compare = l
			col_no +=1
		else:
			col_no =2
			pointsX.append(startX)
			row_no +=1
			pointsY.append(startY - offsetY*(row_no-1))
			compare = l
	else:
		pointsX.append(startX)
		pointsY.append(startY)
		col_no =2
		row_no =1
		compare = l

OUT = pointsX, pointsY

You can download the Dynamo file from here.

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.