Force Order Of Operations


#1

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!


#2

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/


#3

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.


#4

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


#5

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!


#6

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.


#7

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


#8

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:

 


Automatically Deleting 3D Views
#9

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


#10

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.


#11

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.


#12

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


#13

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?


#14

Hi Dimitar

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

Thanks


#15

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