'Running' a dynamo script

Hi guys, I am very new to dynamo.
I have created a node ‘all elements at level’ and another one ‘levels’ where I have selected my desired level.
I now want to ‘run’ a dynamo script so it will actually select them in my revit model

At the bottom of my dynamo page it says run completed but I am interested in actually selecting these in the model

Thanks

Selection in dynamo is usually just to tell it from where to extract the data from. I never saw anybody using Dynamo to select elements in the model. I’m curious if there is a way.

If not, you could just create some V/G rule-based filters and use them to hide everything but elements you want to select. However, it would take some effort because all categories have different search criteria. So, for example, walls have parameter “Base Constraint”, while floors have parameter “Level”. You would need a shared parameter for all elements of many different categories. Then, use dynamo to transfer values from several different parameters (by category) to that shared parameter. Then, you can use the shared parameter for V/G filtering in the model itself.

EDIT: it doesn’t have to be a shared parameter. Standard project parameter will work.

Select the elements?
Well you can do what you want with the elements… But why would you want to just get Dynamo to select them and leave them selected?

@AJHAWKINS - post your graph. :slight_smile:

Hello, look at these nodes
Select Model Element (1 elt)
Select Model Elements (> 1 elt)

double click (on the id Number green in dynamo) watch revit window

Don’t forget to consult dynamoprimer and do the exercises suggested (your progress will only be faster)
The videos are very informative too (very gradual)
image

Sincerely
christian.stan

2 Likes

Agree
The primer is great!

1 Like

I read this and wonder if you are looking at setting what is selected in the Revit user interface; if so this should help you get started: How to set as selection in Revit?

1 Like

Reading too fast

here with boilerplate code +

#######OK NOW YOU CAN CODE########

Datas=UnwrapElement(IN[0])

nbid=List[ElementId]([i.Id for i in Datas])

uidoc.Selection.SetElementIds(nbid)
TaskDialog.Show("NB element",str(len(nbid))+ " Elts are selected!")
if len(nbid)>0:
    a="OK"
else:
    a="No selection"

OUT = a

work on API


(so as not to lose control, but Mr. Pierson’s node are much safer to approach work with peace of mind)

Sincerely
christian.stan

1 Like

kk - my question got lost in the thread…

But can someone tell me WHY you’d want to do this.

So could you clarify if you are wanting to select elements yourself or are you wanting for the elements selected by your script to be highlighted in the model?

I cannot speak for @AJHAWKINS , but when I have used this it was to let the users know things which Dynamo had found…

Example One: validate headroom in the stairwell, then pop up a UI with either ‘no stairs have any headroom clearance issues’ or ‘issues found. Review the selected elements for headroom issues’ and the offending elements are selected in the model so the user can decide what to do.

Example two: When generating new objects, let the user know via popup (ten new outlets added to the model. They have been set as your selection, please review the result) and then select them in the UI so the user can identify what was added. (Also works for modifications).

2 Likes

Oooo, noice! I like :smiley:
Next project sorted!

1 Like

@Alien
Similar concept as Example One that @jacob.small stated. I use it as a dimensioning check tool for shop tickets. I have it highlight elements of a certain category, that have not been dimensioned to in a view, so the user can verify that they didn’t dimension to something by mistake.

2 Likes

I added some of this code to one of my work’s pop-ups today…
Highlighting unbounded rooms in a model…

I think it may really annoy some people. :rofl: :partying_face:

I just need to think of which other scripts I can add it too now. :smiling_imp:

I am tempted to add one to highlight sections not on sheets - our models are littered with those…

3 Likes

Some extra examples of ‘super selection’ tools in my pyRevit toolbar at work. All yield a selection to the user:

image

The final 3 are particularly helpful as there isnt a way to identify these types of elements (overridden) to the user, so selecting makes it obvious + they can continue on to isolate them in view or simply reset overrides/unhide etc.

Sheets > title blocks is also very popular with my users. Means you can select sheets in browser and grab their title blocks without opening the sheet. A Revit hack for sure when doing north points, key plans etc.

Hi @AJHAWKINS,

To make Dynamo select elements in Revit you can use a node from the Modelical package. The node is called Element.SelectInRevit and it simply gives you the ability to Input the elements you have listed in Dynamo and have them selected in Revit.

to @Alien: In the past I used this node to let the user check if the position of the prefab elements of the facades of a building were located in the right place. The user could input a reference facade element and the script would return a selection of all the facade elements that were aligned with the ref. element.

2 Likes