Isolated Pick Model Elements(ordered)

@john_pierson
I’ve been tasked with updating at least 3 (maybe more soon) graphs from Rhythm 2018 to Rhythm 2023. Mainly that the names of nodes they were originally written with seem to no longer be included. I’ve checked simple search and your github for a change log. I was wondering if there might be any guide to know which nodes I should replace them with. I’ve tried using Isolated Select Model Elements in this case but if I select walls and save, when I open the graph again it’s been reset

Do you need the “ordered” aspect of the node?

If not, I suggest migrating to the OOTB node Select Model Elements of Category

@john_pierson
yes, they are supposed to pick them in order

Alrighty, let me take a look. More than likely I will just give you a CPython3 script to use for 2023+ here.

I have been on a mission of removing DYFs from Rhythm because of backwards and forward compatibility, and I might have dropped that one before getting the replacement done.

1 Like

So here is the python for that node:

import clr
import msvcrt

clr.AddReference("RevitAPIUI")
from  Autodesk.Revit.UI import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
TaskDialog.Show('Isolated Selection','Pick ' + (IN[1].lower()) + ' in desired order, then press ESC to finish')
sel1 = uidoc.Selection
obt1 = Selection.ObjectType.Element

class CustomISelectionFilter(Selection.ISelectionFilter):
        def __init__(self, nom_categorie):
                self.nom_categorie = nom_categorie
        def AllowElement(self, e):
                if e.Category.Name == self.nom_categorie:
                        return True
                else:
                        return False
        def AllowReference(self, ref, point):
                return true
msg1 = 'Pick '+ IN[1] +' in desired order then press ESC to finish.'
out1 = []
flag = True

while flag:
        try:
                el1 = doc.GetElement(sel1.PickObject(obt1,CustomISelectionFilter(IN[1]), msg1).ElementId)
                out1.append(el1.ToDSType(True))
        except:
                flag = False
                
                OUT = out1

and how it is used:

1 Like

@john_pierson
Thank you, very much appreciated