Index of list for geometry elements

Hi everyone:

So basically I import some geometry from revit. (stops being native goemtry) and I continue doing some sorting in this Data, Where Im stock at the moment is that i want to match the index from the original geometry to the one that i ordered after.

Any ideas or guidance on this one, thanks

@samuel_barcenas The image is blurry . Could you drop your dyn file?

1 Like

Hi

Im sharing the dyn file and rvt file thanks for your help sorry I couldnt share before.
Please take a look to the script. Basically what i want to do is to match the elements from the first list to assign the number as a parameter back to the elements. The problem is that I havent found a solution to match the index for the elements.

Match list.dyn (24.5 KB)
Test for matching files A.rvt (2.8 MB)

Hi @samuel_barcenas,

Could you clarify a few more things:

  1. What parameter are you trying to write? Tarea? it is not loaded
  2. You have indicated the first list of elements as the one coming out of “All Elements of Category” but in the dyn file you are filtering the walls based on the parameter “Estatus”
  3. what index are you trying to write back? the index of the group they belong to?

Hi Salvator

Im trying to match the list from “sort by function” that gives me the ID from the elements, to the list from “GroupByDistance” that contains a list of the elements group.

So basically the order of the list are different but they are “same elements” So I want to figure out which ID belongs to each group.

Thanks

@samuel_barcenas

Apologies for the late reply.

I’ve added a few lines of code to @Dimitar_Venkov node Springs.Geometry.GroupByDistance

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import Geometry

pts = IN[0]
margin = IN[1]
walls=[UnwrapElement(i) for i in IN[2]]
dist1 = Geometry.DistanceTo

Groups, Queue,Walls = [], [],[]
while pts:
	group, wall = [],[]
	Queue.append(pts.pop())
	wall.append(walls.pop())
	while Queue:
		p1 = Queue.pop()
		group.append(p1)
		for i in xrange(len(pts)-1,-1,-1):
			if dist1(p1, pts[i]) <= margin:
				Queue.append(pts.pop(i) )
				wall.append(walls.pop(i) )
	Walls.append(wall)
OUT = Walls 

1 Like

@samuel_barcenas

IN[2] is the list of walls:

Please mark the topic as solved if this is what you want.

Sorry for the late response Ive been sick for around a week.

Let me test it but according to the image seems good

Thanks

1 Like

Solved

Thanks a lot for your help

1 Like