I would like to create a routine that (when executed from the Dynamo player), takes one item out of a list of items, each time I run it.
For example, the first run, takes the first item, the second run takes the second item, and so on.
I really wanna do something with this item, but that’s not an issue for now, what I’m having trouble with is taking the items step by step.
So the problem you have, is that each run of the player is ‘stand alone’ it isn’t logging what the previous run did.
You could have a user manually input a start number?
Or you could automate that, by having each run read a .txt. file, containing a number starting at 0 and overwrite the file each time with n+1? (up to a defined maximum amount).
Alternatively, perhaps you could run all the sessions in a single graph, but have a pop-up for users which breaks it up through the run? It is hard to know without some more context…
I hope that helps,
Hi there Mark
Thanks a lot, what you propose actually solve the problem, I personally like the 2nd solution, by the .txt file. That gave me an idea I can develop.
Although, I think the last choice it’s my favorite, how do I do in order to develop a pop-up through the run?
Is it by using an “If” node?
The package Data-Shapes lets you build simple interfaces, you can also code simple pop-ups using Python, but I haven’t done that in a while
@christianjgentry I think this is what you are after. You can add the following code to your python script:
from System.Windows.Forms import Form,Label
form = Form()
form.Width = 300
form.Height = 100
label = Label()
label.Text = text
label.Width = 280
label.Height = 70
label.Parent = form
Hope that helps,
If you want a simpler way to do it one by one, and if your “items” are Revit elements, you could use a parameter. Take your list of elements, filter by Parameter equals 1, take the top item. At the end of the script, Set your Parameter of that top item to 1. When you run the script again, it will take the next top item because the previous will be filtered out.
You can also make a “reset” script that will set all the parameters to 0 again.