Model Elements Collected Do Not Update on Automatic

#1

Hi,

When I was developing a definition, the automatic setting would filter in walls as I built them, and delete them when I deleted them. For some reason my definition when I opened it today will not actually run automatically. I delete elements in my model, and it is still calculating them.

How do I reestablish that connection?

Thanks,

Kevin

0 Likes

#2

I am surprised this hasn’t gotten any responses. It seems rather elementary…

To verify for all of you, the automatic setting IS turned on! :grinning:

Any thoughts anyone?

0 Likes

#3

I know it is annoying, but always provide the needed files… Someone might answer you along the way, or maybe not.

It is very annoying for us helping others that we have to reinvent the wheel every time we use our spare time to help someone… thats why this post was written

0 Likes

#4

Thanks Erfajo. Maybe this will help clarify.

I have an element in my model:

Then I delete that element, but it does not recalculate:

Thoughts?

0 Likes

#5

No not at all… but I will leave it to others who might have a solution based on what you have provided.

0 Likes

#6

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.

0 Likes

#7

Here is the download link for the files:

It contains the .rvt and .dyn file. I appreciate any help you can offer.

Thanks!

Kevin

0 Likes

#8

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:

1 Like

#9

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.

0 Likes

#10

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?

0 Likes

#11

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.

0 Likes

#12

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.

0 Likes

#13

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 :frowning: #Bettertooltipsfornon-codingusersplease!

0 Likes

#14

Erfajo,

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[0] and Out[1]. 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?

0 Likes

#15

@erfajo

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?


0 Likes

#16

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.

0 Likes

#17

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.

3 Likes

#18

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.

0 Likes

#19

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.

0 Likes

#20

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 :slight_smile:

You can reuse @Dimitar_Venkov or @alvpickmans solution in any way you collect something for keeping the collection updated :slight_smile:

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.

0 Likes