Seach for x if y

Hi guys!

I’m not sure if this is possible but let me try explain.
I need Dynamo to run a script where it searchs for a Revit-parameter, Ordered, with a value: Yes.
I have 3 zones in my project, 1, 2 and 3. Every zone have three parameter: 1, 2 and 3.
When I run the script Dynamo should mark all the categories in Zone 1 with a ‘Yes’ in the parameter Ordered.
Next, when I run the script again (without editting the script) I need it to mark all the categories in Zone 2 with a ‘Yes’ in the parameter Ordered.

Now I’m editting the parameter in Dynamo from Zone 1 to Zone 2 before I run it or I won’t search in the right zone.

Bump…
Still can’t figure it out.

@Christian_Vestesen Please post what you have so far

Sure.

And I’m still not sure how I can get my other parameter “Ordered” in this formula…
I don’t need a solution, just some guidelines. :slight_smile:

@Christian_Vestesen sorry but I don’t understand what you are trying to achieve. Can you show more of your graph, or drop your dyn.

What categories?

What does this mean?

Montagefase = Zone, sorry.
I need Dynamo to, depended on the value of my parameter “Ordered”, read the Montagefase-parameter.
It can be 1, 2 or 3.
If 1, don’t count 2 and 3 in the calculating.
if 2, don’t count 1 and 3 in the calculating.
if 3, don’t count 1 and 2 in the calculating.

@Christian_Vestesen what’s your desire output if for example zone=1? What categories is “Ordered” associated to? is it an instance parameter?

I have three zones in my building, devided in three zones, 1, 2 and 3.
I would like to count my components in these zones. Ducts, ducts fittings, duct accessories and air terminals.
Ordered is associated to an instance parameter which is a shared parameter associated with my components (Ducts, ducts fittings, duct accessories and air terminals)

Not sure what you mean with this:

@Christian_Vestesen [quote=“Christian_Vestesen, post:1, topic:7311”]
When I run the script Dynamo should mark all the categories in Zone 1 with a ‘Yes’ in the parameter Ordered.
Next, when I run the script again (without editting the script) I need it to mark all the categories in Zone 2 with a ‘Yes’ in the parameter Ordered.
[/quote]

Can you change the Ordered parameters all at once like that:

And with these three ducts I need only of them determined by my if statement.
I just can’t figure out how.

I have searched for multiple if statements in dynamo but no result.

you can use Python:

if Zone==1:
	"don't count 2 and 3"
elif Zone==2:
	"don't count 1 and 3"
elif Zone==3:
	"don't count 1 and 2"
else:
	"do something else"

Also have a look here:

How does it rewrite the python into a code block? :slight_smile:

look or a Python Script node.

Also have a look here:

I’m stuck…

Hi @Christian_Vestesen,

There are a few mistakes in your code but good effort.

I have updated the code. See the comments shown by “#” in the Python IDE.

This script takes a list of numbers between 1 and 3 and a list of something. it will iterate over the list of numbers and return the corresponding element from the list of somethings by using the index value (the number of where it is ordered in the list). I have also split the list into sublists for the ouput.

Also, when writing python in Dynamo, try an avoid using the variable elements, this can be confused with the Revit API (even though you are not using the API it will stop a bad habit before it starts! :slight_smile: )

Cheers,
Dan

Hm.
How can the code you wrote get the elements with zone = 1 if element = “”?
I’m a newbie when it comes to Python Scripts in Dynamo.
I need elements in zone 1 if the parameter “Ordered” is equal to “” (nothing).

Hi @Christian_Vestesen,

This just sorts the elements into separate lists by their zones, you can then get do a test on those elements by getting the value of the “ordered” yes/no parameter, if it is yes then do something if no then do something.

Is that not what you are trying to do?

What are you plugging into your Python script? You are overwriting you variable “elements” so you will on be operating on the IN[2] input. What is “Element”?

Are you trying to count YES for each zone? Here is an example using Comments and Mark to illustrate one possible way:

Hi everybody and thank you for your response!

I hope this helps:

@Daniel_Woodcock1: I can do that with a filt.byboolmask and then true/false. I’m trying make a more dynamic script:
Select elements in Zone 1, IF ordered = “”. Select elements in Zone 2, IF elements in Zone 1 is marked in Ordered with “Yes”. Select elements in Zone 3, IF elements in Zone 2 and 3 is marked in Ordered with “Yes”.