Force Order Of Operations

Hello

How do I force one function or command to execute before another?

I have a script where I create some elements based on some existing elements. Then I want to erase the existing elements. What is happening is that the way the graph is executed the elements get deleted before the new elements get created. Is there a way to tell Dynamo the order of operation?

Thanks!

for now, you can do this using using function.compose().

each function you pass into function.compose() will be called in order from top to bottom.

Are you interacting with revit? If so you’ll want to use transact.end() inside of your functions that you pass. You can make make a set of custom nodes for each operation you want to do, and put them all into function.compose in order you need them to execute.

The resultant value of the first function will be the input to the next one in the chain.

 

this thread might help you:

http://dynamobim.com/forums/topic/changing-family-instance-and-saving-image-issues/

1 Like

Michael

I appreciate your response. I have been using this, but my problem is that the three functions do not necessarily operate on the same objects. The last step is to delete that objects that I used as a basis of creating new objects.

I will look at it and see if I missed something.

Thanks.

Rafael, I haven’t tried this yet, so this is pure speculation but another approach may be to create a chain of functions by using list operations like so:

sequencing

I know this post is over a year old but I am just starting to jump into Dynamo. I have created a new node and am struggling with executing them in order. Can someone please help me sort this out? Thanks!

1 Like

Hello Christopher,

At present you’re probably running into recursion issues. You’re trying to simultaneously delete room tags and create new ones.

Generally with Dynamo it will pick the first graph it picks up (creators/openers) and run through the wires, node by node.

In this case the simplest option is to make 2x graphs, or alternately explore the methods outlined above.

Thank you for the fast response. I have saved as Custom Notes and thought I was passing correctly but I get the following…

Deleting and Adding Tags Error

Hi Christopher,

I have an extremely simple but very powerful node called “Input.Wait” and the only thing it does, is wait for a task to finish before continuing. It will not work for your case, because you’ll first need to add an empty input to your “Add Room Tags” node.

 

 

 

 

 

 

 

2015-12-04_10-54-50

 

 

 

 

 

 

 

 

 

 

 

 

You can chain multiple dummy nodes together to have a fine control of the flow of events. And if necessary, you can even add additional outputs that will be completed from top to bottom order. Try it out and tell me if it works:

 

1 Like

But the Add Room Tags node doesn’t allow for an input…

Image1

That’s why I suggested you add a new dummy input just like I did with “WaitForMe” inside the “Input.Wait” CN :slight_smile:

It’s crude but so far, it’s been working great for me.

I think that will work. I’m having another issue because I don’t want to have to set the view to delete from or add to each time.

Hi @Christopher_Fernande

I am having a similar issue, did you find a way to solve this???

If you did could you share the result for the functions to perfom

My goto solution when showing this sort of stuff to people is to delay the second functions input until after the first function finishes. A code block like this will allow for this.

{SendThis,AfterThisFinishes}[0];

Only question is where it slots into your overall graph. Can you post your current graph?

3 Likes

Hi Dimitar

Could you please tell me the name of the package in which Input.Wait node is?

Thanks

Clockwork has one. Works the same as the codeblock solution I noted above.

Hello,
this all is really interesting and helpful but unfortunately does not work for my case. I am trying to get Revit Space Names into Excel, then within the same Excel and a different sheet next information will be created. Once this has been done, I need to extract this information from the Excel and bring it to the Revit again. Is this possible to do within one script? Many thanks

Yes, I believe it is. Just have to use the methods noted above in the right way. I’d use the WaitFor method right before each of the excel interaction nodes in your case.

Hello @ml31,

For this round trip script I strongly suggest you only run it in Manual Mode as you may run into an infinite loop pending how you have set your script up.

Beyond this, you may also run into issues with Revit Transactions. If using only the passthrough node fails to achieve what you are looking for - then also look at including Transaction.End and Transaction.Start into your script.

2 Likes

Hello,
I had a similar issue and this is how I solved it. Maybe it helps.
I wanted “Mark” values for my elements to have the “Type Mark” in it + a number:

Type Mark 1.1
Type Mark 1.2
Type Mark 1.3

Type Mark 2.1
Type Mark 2.2

Type Mark 3.1

Therefore I needed first to make sure my new values did not have a duplicate already present by chance in the project. I had to delete the existing value first and then assign a new one.

Here is the trick:
Instead of deleting the existing values I just overwrite them with a temporary xxx.n value
Continuing from the same node (here is the operation order) I assign the new correct value.

This is the graph, I am just a rookie with dynamo so do not take it too seriously but so far it works.
(operations in order are in blue)

The PassThrough node was a lifesaver for me! I have a script that imports points from a csv, creates a point group and creates a surface. But it was trying to create the surface from the point group at the same time as creating the point group, and kept getting hung up before creating the surface. But now it works!

Thank you all!

1 Like