List 1 = List 2

I have been trying to do something that I felt should be pretty simple (and maybe it is), but i’m at a loss at this point. To put it simply: I have two lists A and B; I would like to make list A = list B.

I have been trying to collect location data of viewports on a sheet and arrange the location data in a list and when it is in order I would like to simply like to make it equal to another list that I’ve created which is just a list of ordered numbers and replace the view numbers with this new list.

I used the video above as a basis of design however, I have changed a bit of it around to suit my purposes.

Thanks,

Let’s see what you’ve done so far.
It’s unreasonable to expect people to watch an hour long video to figure out what you’re attempting.

2 Likes

Sorry, the portion of the video that i’m referring to is only the last 10 minutes or so (I should have clarified). Here is what I have so far.

I was unable to use either the “get built in” or “set built in” node downloads from Archi-Lab because they broke and I don’t have enough experience with Python yet to fix it.

Thanks!

Edit: Just went back and realized that I missed an entire step. I’ll let you know if this resolved anything.

Ok, I guess I missed a rather big portion as I was trying to simplify the entire process. However, in the end it was necessary. Now i’m just having a less big problem.

In the video he wanted to label the views as 1A, 2B, 3C depending on the column and row, and I’d just like to label them as 1, 2, 3, 4, 5, but i’m having trouble figuring out the easiest way to translate the location into an ordered numerical list from top left to bottom right. Any help would be great!

I’ve posted the images separately below since it won’t let me upload more than one.

Thanks,

Bump

Bump Bump

I’ve posted what i’ve accomplished below. Any direction would be greatly appreciated.

@dwendling Assuming you want to order viewport detail numbers. Try this.
It seems to fail sometimes, saying the parameter is Read Only or numbers already exist.
However, the definition should help guide you.
ViewportNumbering.dyn (9.2 KB)

2 Likes

A code version of the one above…
ViewportNumbering.dyn (4.7 KB)

The Python Component

import clr
#Import Element wrapper extension methods
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
#Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)

p = [[] for _ in xrange(len(IN[0]))]
for c in range(len(IN[0])):
	for i in UnwrapElement(IN[0][c]):
		p[c].append(i.GetBoxOutline().MinimumPoint.ToPoint())

#Assign your output to the OUT variable.
OUT = p

The Design Script Component…

grpLst1=List.GroupByKey(vp,vp.GetParameterValueByName("Sheet Number"))["groups"];
grpLst2=List.GroupByKey(grpLst1<1>,(Math.Round(vpPnt.Y/10))<1>);
grpLst3=(List.GetItemAtIndex(grpLst2<1>,0)<1>);
grpLst4=List.GroupByKey((vpPnt.Y)<1>,(Math.Round(vpPnt.Y/10))<1>);
grpLst5=(List.GetItemAtIndex(grpLst4<1>,0)<1>);

srtLst1=List.SortByKey(grpLst3<1><2>,grpLst5<1><2>);
srtLst2=Flatten(List.GetItemAtIndex(srtLst1<1><2>,0)<1>);
srtLst3=List.Reverse(srtLst2<1>);

r=0;
detNum=(GetKeys(srtLst3<1>)+1+r)+"";
srtLst3<1>.SetParameterByName("Detail Number",detNum<1>);
2 Likes

Hey, thanks for the reply and sorry for the delay. This was extremely helpful in resolving my issue with this definition. I now have something that works perfectly!

1 Like