Filter with a sequence


#1

Hello
Im trying to create a dynamo script that will check if Walls are set in the right modul.


In Denmark brick are set at the modul 60 mm.
so i want item 12 in Element.getparametervaluebyname to be “True” So my question is how do i combine the numbers to get a true value for all number that can be divided with 60

Thank you in advance


#2

An Idea would be to simply divide the length by 60 and the ‘‘test’’ would be whether the result is an integer, for all integers are what you want to read true :slight_smile:


#3

Thanks thats a good idea. is there a standard node that gives a true false value for decimals ?


#4

Got it now :slight_smile: must be a smarter way tbh :smiley:


Thx for your help Jonathan


#5

My solution would be to do like this with a few lines of python :slight_smile:
image

output = []
for i in IN[0]:
	output.append(i==int(i))
OUT = output

#6

Might be easier for you to avoid the python and use a modulo function - search your library for %. Then test for equality with zero. I believe that it looks like this in a code block (can’t test as I am away from the PC this weekend):

Val%60 == 0;


#7

Did not know that one! :smiley: Very cool! Way better than the Python approach :wink:
image


#8

Alternative method here… https://www.reddit.com/r/Revit/comments/8v9ls1/a_dynamo_player_script_for_checking_and/
is to compare the dimension to a range of rounded values that it generates (based on the UK 112.5 standard).

This is my version…

Hope that’s of interest,

Mark


#9

The modulo function exists in Python too, FYI. I just prefer to keep the beginner lessons on the Dynamo side, or people start to think they need a computer science degree to make useful Dynamo content. :slight_smile:

The knowledge of those sort of operators can save you ages of effort in a lot of useful workflows (decimals to fractions, counting only whole instances, ensuring even division by a module, etc), and is one of the reasons why once a week I say ‘Do all of the dynamo Primer, from cover to cover, skipping nothing as the concepts are the important part, not the results.’ Believe it or not, it’s acrually used in section 4.3. :slight_smile:

Note that it’s pretty easy to make this work for your half bricks as well (after all, the 30mm corner doesn’t have to fall on the 60mm grid).