This isn’t just to that element. It is any element I model. All of a sudden it just won’t calculate. Even if I switch it to manual and hit run. Nothing updates.
Here is the download link for the files:
It contains the .rvt and .dyn file. I appreciate any help you can offer.
I would say that is because the view is an input, and as it doesn’t change in between runs Dynamo doesn’t re-run that selection node.
Try other selection options, by category for example:
I don’t understand what you mean by that. The element in the view changes, so the view doesn’t change?
I can’t do this by category because I need to select all model elements, regardless of category and then filter by my own project parameter. Apparently by view is the best way to do it.
I also don’t quite understand how All Elements of Category would run any differently than Elements in View. If an element is deleted, its deleted in both of those nodes (or I would expect anyway). Am I missing something?
what @alvpickmans describes is very important. I will also recommend you to use a collection method not based on a view. collecting elements by category is preferable.
This is an issue that has been discussed a lot of times… and I am definite on the ‘byCategory’ track.
In the DanEDU Dynamo package is the two methods I describe in that post developed into nodes you can download an use as you please.
Try wiring a “run me” node in after the view node which you can toggle with a true/false node to force a recalculation. Feeding false through your script shouldn’t hurt things, and refeeding the correct value should update things accordingly.
Hmmm I can try that. But I don’t really understand how that node works. How do I define the “Thing To Do” ?
It doesn’t seem to exist in the Primer and the tool tips when you hover over the input in Dynamo are utterly useless #Bettertooltipsfornon-codingusersplease!
I am trying to use that thread (http://dynamobim.org/forums/topic/get-all-objects-by-parameter/ ) you posted to me but I keep crashing it when I try to connect the python script to element.category. I am not a programmer so I am trying my best not to do this with python nodes. I won’t be able to effectively troubleshoot them.
Then I went to yours and I am trying to develop that node with your script but I dont know how you got Out and Out. Mine only has one out after pasting your definition in.
Is there a way to collect a list or filter by a pre-determined list of categories without python?
I finally got your python script to work (I think) and it successfully filtered out by category the items I wanted. However, the same problem persists. I try to model more elements or delete them and
the list does not update!!
It is exactly the same problem I was having with the original method. Any ideas for how to get this thing running again?
Bad news first: Dynamo won’t do what you’re trying to do by design. You’re asking the program to constantly run a calculation which could be a VERY large data set - imagine running your script on a model with over 50,000,000,000 elements - just selecting that many items would slow you down. Now imagine trying to do that non-stop, every instance of every moment forever. How long do you think your system could keep up? BAD JUJU would result right?
In order to prevent this dynamo doesn’t clear out the cache every time, and pushes the results of a node along acordingly. That means that collection of 50,000,000,000 elements only needs to be done once. Why recalculate all that if nothing has changed. I bold that for a reason. Try copying the view node, pasting a new one, and rewiring the new one in where the old one was. Did your results change? By changing the input you forced the script to rerun. That said, it can be problematic to ask someone to copy/paste, wire and unwire stuff correctly…
Now the good news: you can make dynamo redo something by using the Tool.RunMe node (or a similar code block) in between your “Views” node and your “ElementsInView(s)” node.
Every time you want to rerun the graph change the value to false, let it run, and change it back to true. No this isn’t automatic but it’s the best you’ll get with basic out of the box stuff.
Technically, UI nodes can subscribe to Revit events. One such example is the “All Elements of Category”:
So whenever you don’t have an active command in Revit and you’ve made changes to the document, the node will force-rerun itself. This was actually an issue a while back because it was causing infinite loops. You can (ab)use this feature as your automatic refresh like so:
Here’s quick demo. Look at the total count:
I have to agree that using this on a real project would be detrimentally slow though.
I think what you ask for is something similar to picture below. Adding a node that can run periodically at the beginning will make your graph run every certain specified amount of milliseconds, and using for example the “Spring.Collector.ElementsInView” node, your elements will be updated almost automatically.
With this said, I personally wouldn’t use it in automatic/periodic mode, as it will slow down the workflow and usability of Revit and Dynamo quite a lot in large projects and dynamo graphs.
Hope it helps.
I think Jacob’s response is the solution to use here. If you can’t run it auto, a simple toggle to get it to run is ideal.
The “manual” setting run SHOULD work for this, but it doesn’t.
I can see you have got some nice solutions, the way @Dimitar_Venkov (the editor og Springs package) and @alvpickmans solves the ‘update’ problem is very nice. That said would I still not use a specific view. What if other users in your company want to use the script or you want to use it in another project. At that time is something based on a view not necessarily working (elements not present in view but in other view or just somewhere in the project). Collecting elements by the project (document) will always work. However, it is a matter of taste
What I wanted was, to tell your and others that I have turned the code you mention into two nodes, namely “Element.ByCategory” and “Element.HasMaterialQuantities”. Both nodes are now included in the “DanEDU Dynamo” package.
@erfajo I wound up using a combo of one of the python scripts you referred me to, and the tool.runme to get close.
The python code you use is the new “Element.ByCategory” node
So do I need to use the OST Categories? I have been going out of my mind trying to find the dang Wall Sweeps OST category.
Although the topic has been marked as solved, just as an extra to your selected solution you can use @JacobSmall last example with a Code Block but changing it to something like:
(rerun) ? ThingToDo : ThingToDo;, so you will save a few clicks as it always will get evaluated even if set to false