How do I get a list of all elements pre selected in Revit

i would like to get a list of all preselected elements using dynamo. so far all nodes need to click select button and draw a box. I cannnot tab and select connected and unselect some elemets. This is hsouldbe dable but I cant find a node to do this.Can someone tell me if anyone has done it before?

1 Like

Hello @splaw9 and welcome :wink: spring node have one get current selection, could probably help

1 Like

“ꟿ SelectElementsInOrder“ in springs node may help you

with it you can click slection button to select multi familyinstances

as sovitek said, from the spring nodes package

Version of Revit might matter here, as the selection nodes were revised in recent builds.

1 Like

yeah sure, spring is buld with 2.7…here for cpython 3


import clr

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

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

def output1(l1):
	if len(l1) == 1: return l1[0]
	else: return l1

selid = uidoc.Selection.GetElementIds()
OUT = output1([doc.GetElement(id).ToDSType(True) for id in selid])
3 Likes

I have spring nodes 210.1.1 installed but I type in library search "ꟿ SelectElementsInOrder” nothing came out. I found a 3 Springs Nodes packages. as shown below. Did I get the right Spring nodes ? I installed all the 3 packages.

Hi Jacob,

I am using Revit 2024. Dynamo Core 2.19.3.6394 dynamo Revit 2.19.4.13096.

Spring nodes is the one you want.

I finally Found the Springs nodes under Library → Springs→ Revit→ Selection→Current Selection→Current Selection. I will try it out . Thanks everyone or helpful reply.

Elton,

Thanks. That helps to explain What the refresh means. I tried both True and False.Most ofthe time it is better to use true. Thanks

Yes. this script does work. I put it into the python script node but retains some of the template.I will try to examin the script. I previously trie it but didnt suceed.

1 Like

allright, try play around with it :slight_smile: or just use spring

Hi Elton,

The problem with the Collect.CurrentSelection is the need to toggle the true and false to refresh and get a latest elements. Is there an automated way to do this ? Seems not that elegant. Thanks

Force execution in tuneup, or use Dynamo Player.

1 Like

Hi Jacob,

What is force execution in tuneup?

The tuneup view extension has a method to re-execute all nodes. Newer builds have it incorporated by default in the extensions menu. And older builds can install it from the package manager (make sure you get the right build for your Dynamo release).

2 Likes

i never knew about this, i would just switch true / false between runs :smiley:
thanks for the heads up, i learnt something new today!

1 Like