I like to auto select the last Revit Object added by the user.
Is there such a Node?
No, I donât think there is a node such as this. However, revit auto-increments the ElementIDs of elements, so you could collect all Elements, these should be sorted by ElementID by default but you could sort them after by key (ElementID), and then get the last element in that list.
@mdhutchinson @Daniel_Woodcock1 âAll Elements In Active Viewâ will give always list based on the elements created order. So you can take the last object by âList.LastItemâ.
That wonât catch view hosted elements like detail components or lines. Or views. Sheets. Viewports. Phases. Renderings. Sketch lines. Element types. Revisions. Or any of the many other types of elements which donât show in 3D views.
A while loop grabbing items by Element Id backwards from 100,000,000 might be the best method⌠depending on what heâs after⌠Perhaps @mdhutchinson can clarify his purpose so we can understand what types of elements he is ok with letting through the filter?
The purposeâŚ
In Revit alone, Iâve not found a way to automate Family Type selection based on a condition. In this case the condition used is very easy to check on, so Iâm looking to Dynamo - to either change the type after the user has placed them, or automatically insert the correct type up front after which the user could move them appropriately.
Iâm thinking Dynamo could do either, but Iâve not started down that road just yet.
The family is a Room Tag with various labels having visibility parameters.
Thoughts?
(Note: I tried visibility controlled exclusively by formula, but have not found that Revit could do this, even though it looks like this would work from within the family editor⌠so Iâve resorted to several Types, one each for each visibility state.)
An IF statement in the family controlling the visibility value wonât work as the value is driven by the tagged element not the value itself. And using multi-parameter labels to not show the null values wonât work long term, as if someone puts in the value and then you decide to change it out you canât recreate null in the Revit UI.
And changing the value at creation is good, but if youâre gonna automate, then you might as well Automate right? And having to write two tools when a single one could do both is foolhardy.
Sooooooo⌠I would build a graph that:
- Gets all rooms in the active view.
- Gets all room tags from the active view.
- Gets the host element for each tag in 2.
- Gets the parameter value from the rooms in 3 that drives the tag type.
- Uses an if function to pull the correct tag type via the family name.
- Sets the tag type in 2 to the new family type in 5.
- Finds rooms in 1 which arenât in 3.
- Gets the parameter value for rooms in 7 to drive the tag type.
- Use the same if function in 5 to pull the correct tag type via the family name.
- Creates a new tag at the location of the rooms in 7 by the types in 9.
Requires no UI beyond âhit run.â This is a big workflow but it would run via player. Just make sure to clean out any element binding before you save it as read only in your player library.