How to sort by "Number" of adaptive points instance in Rhino.Inside Revit

Hi,

I have a list of Revit Reference Point : elements, in Project environment.

I am trying to sort this list based on the placement point “Number”, that it’s a built-in parameter in the Adaptive Family environment, but I am not able to access it from the Project. It looks that from the project is visible just from the RevitUI.

Is there any method to access those “Number” values in grasshopper?

If not do you have any other suggestion on how I can sort those adaptive points in grasshopper?

Unfortunately I have noticed that there is not a relation between the Element ID of the point and it’s placement index.

Thanks in advance for the support.

Hi @Walter7 ,

Yes, it is totally possible to get and sort adaptive points by their placement order using the Revit API. The method returns the list of adaptive placement points in the exact order they were placed, which corresponds to the Number shown in the Revit UI. While this Number is not available as a direct parameter on the points in the project environment, the order of points returned by this method reliably reflects this numbering.

import clr
clr.AddReference('RevitAPI')
clr.AddReference('RhinoInside.Revit')

from Autodesk.Revit.DB import *
from RhinoInside.Revit import Revit

doc = Revit.ActiveDBDocument


point_ids = AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(adaptive_Element)

adaptive_points = [doc.GetElement(pt_id) for pt_id in point_ids]

point_numbers = list(range(1, len(adaptive_points) + 1)) 

Element Dependents will also return the Number of the point.

Hi,

thank you for the reply. Unfortunately my element dependents is giving the “revit reference point”and not “revit instance element”.

Hi @Walter7,
what do you exactly want to extract from the adaptive family?

Hi Muhammad,

I have a list of adaptive family instances as input, I want to extract their adaptive points location with their related reference number

In the project or in adaptive family?

In the project

Have you tried Element Location Node?

Yes, element location is fine for getting the xyz coordinates, but I still miss the reference number. As shown in the first message element id is not related to the placement number

From project environment you can’t directly access their Placement Number. The component returns the list of adaptive placement points in the exact order they were placed, which corresponds to the Number shown in the Revit UI. so you can apply additional logic to get their Numbers.

or else you can define the additional parameter inside your family which can be used to extract the placement numbers based on their ID’s

Initially I had the same idea but unfortunately it looks there is not correspondence between them. Has shown in the first message the element ids does not correspond to the order were they have been placed

for this solution can you explain me a little bit how to do it?

Also, it looks that @Japhy was able to access placement number in project environment.

But I don’t know how he managed to do it.

Can you share the link to the example?

This is the link with the solution by @Japhy

As I said you have to to use additional parameter. In this case if you assign value to the names you will get the same result.

Ok understood then, thank you very much