Problem with all elements of category node

Hi,

I’m working on a script which create, modify and delete revit levels from an excel file.

So, the script have to get levels from the curent revit to compare their names and elevations with the excel file before the creation, the modification or the deletion.

I am using the “all elements of category” node to get levels, but I have some troubles during the execution because at the end of the execution, there are all levels at the output of this node, even the news, And I think that this is what create the problem. And another question is why the list at the output change the order of the elements at some execution whitout any apparent justification?

I tested other ways to achieve my script. The first is by using the LunchBox Level Element Collector node, but there is still some troubles with the boolean (when I run the script one time, it’s all right, but at the second time, apparently it doesn’t actualize, and I have to execute the script with false boolean then with the true to succeed). The second way is by using python node, bu apparently the problem is the same as “all elements of categories” node (and, by the way, the .Elevation returns some specials values).

So, I hope that someone could help me with one of these question, it could help to recover my entire script

Thanks,

the link to get the dynamo definition and the excel file : https://drive.google.com/drive/folders/0BwSU20EhFFlRWi0zZTNRbFQ3ME0?usp=sharing

Benoît

Hi Benoit,

can you post any pictures of your Dynamo definition?
Some notes:

  1. The levels will initially be ordered according to their Element IDs. I assume you’d like to order them according to their heights? This is simple to do.

  2. It’s useful to understand a little bit about how Dynamo graphs execute. In “mostly accurate” terms, we can say Dynamo executes each node in order, starting from the left-most node in your definition and working through towards the right until the entire definition has been executed.

If your definition begins by reading all levels in the project, and then creates some new levels, it will initially read just the old levels, and then towards the end it will show both the old and new levels together. However; if you then re-run the definition, it will now refresh all nodes and pick up on the old AND new nodes at all points in your definition. Does this make sense to you?

Thanks

Oliver

2 Likes

Yes it makes sense for me… But I dont understant why it remove some levels…

Another example of my misunderstanding :

before running, revit was empty. After running, there is 7 levels as I wanted. But why in dynamo, for the same two blocs of nodes the results are differents? (the upper “categories-all elements of category” bloc is used to achieve the definition, it is the only difference)

image

So you’re saying the top output shows the levels in Revit when the graph is initially ran (no levels) and the bottom output shows the levels in Revit after the graph has completed (7 levels added).

  • The top makes sense. There are no instances of levels in the project at that point in the graph.
  • You would think the bottom would behave the same, executing as soon as you hit “Run” but this might not be the case. I believe nodes generally execute left to right as well as top to bottom, so it could be that it’s the only part not connected to the main graph above and therefore doesn’t execute until after the rest of the graph is finished.

Even with this unexpected output it seems like your graph is working properly. What is the issue you are having? You want to show the new set of levels in the project (existing + new - deleted)?

Yeah I’d agree - @benoit.viano this is to do with the order that your nodes are running in- it’s nothing to worry about.

In order, I’d say the top Categories node is probably the first node being executed, then All elements of category (initially there are no levels, so none makes sense) THEN levels are being created etc etc. Then towards the end your second Categories node (at the bottom) is being run.

It is possible to query the exact time at which each node fires but it’s not exactly straightforward or easy. This should help you determine precisely where and when Dynamo is executing nodes.

Generally speaking I try to only work in one sequence instead of two or more to avoid this.

List.LastItem({A,B}); in a code block, where A is the previously executed code and B is the input to kick off the next bit of code ensures this.

2 Likes

Could you develop a little @JacobSmall ? I’m not sur to understand exactly this way…

He’s describing a Wait or Passthrough node.
In order to make one part of a graph run after another part you have to make them dependent of each other. I write mine like this:

out = {wait,through};
out[1];

In this case I want Part 2 of my graph to run using the input through but not until after Part 1 has finished. I create a list, out, with the output item from Part 1, wait, and the input for Part 2, through. Then I get through from my list out. Very basic stuff except you force the node to wait until Part 1 is finished because out cannot exist until it has both of its inputs.

1 Like

not to be a spoiler… the “waitFor” trick is the solution, but please observe that where you place it may matter…

1 Like