Getbyparameter not working?

dynamo

#1

Hello,

Currently I’m working on a script to change parameters in specific family types but first I need to filter them. I tried to filter them by the parameter “gevellatei”.

The “gevellatei” paramter is a yes/no parameter but somehow it gives a value 0/1 instead true/ false. When filtering it by boolean mask it doesn’t work with a boolean as mask or a number as mask.

Someone knows whats wrong?


#2

Revit stores YESNO parameters as integers 0 or 1 (true or false), but in order to use the FilterByBoolMask node they need to be booleans. You can try to use a code block to “convert” these integers to booleans:

(checkValue == 1) ? true : false;

On your example, it seems that some families do not have that parameter as the output list has some empty values. The code above will consider these empty values as being false as well.


#3

Hi Alvpickmans,

Thank you for your reply! Sorry for my late response. I’ve tried what you have mentioned but the list is empty. (see image below)

Is it because i wrote down the wrong code in the code block?

EDIT:

I think I’ve solved it.

I used the “ReplaceByCondition” node. But somehow this node didnt work with a boolean mask node. So I’ve replace this by a" list.filterbystring" node.

But now I encounter a new problem. Now I have a list with 12 window elements with the parameter “gevellatei” with a yes value (yes/no parameter) with a true value.

I need to filter this list again for the following parameter: “kozijn_merk”.

The workflow idea what I actually want:

  1. Selecting all windows elements (worked)
  2. Filtering all windows elements with the parameter “gevellatei” (worked)
  3. Filtering the output from 2. again but this time with the parameter “kozijn_merk” (not working yet)
  4. seperate the list into each individually elements (with list.seperate maybe??) so I can connect this to the “Element.SetParameterByName”

I’ve tried to explain this in a image (see below).


#4

Hi there,

The thing is that you are trying to get a parameter from a string list, not from an element list.

Cheers

Manel


#5

Hi Manel,

Thanks a lot! This makes the graph also a little less messy. Is there also a possibility to “separate” the end list into single elements, as I described before?


#6

You need to input something to the code block


#7

I don’t really understand what you want to do. Do you want to sort by type?

Cheers

Manel


#8

In the last filtered list I want to change the parameters with set.parametersbyname. In my example project there are 12 items. The problem is when I use “set.parameterbyname”, it changes the parameters from all the 12 elements in that list. So I need to separate the list into 12 single elements.

I thought there was a “list.separate” node, but there wasnt :stuck_out_tongue: So I’ve continued to look for list.chop but that’s not exactly what I’m looking for. I think a reverse node for “list.join” would be the best explanation :thinking:


#9

I think Your requirement as below image.


#10

As far as i know, you can’t split a list in some lists. What you can do is create a sublist inside a list, but not split it automatically.

Cheers

Manel


#11

I am not sure if this be best way to do it or not. But you can groupby a parameter and then separate them by value like below. and then use “set.parameterbyname” on whichever list you want to apply.

Best,
Jalay


#12

The problem is solved! I’ve found a method to let this work (not the most efficient method). For the persons who are interested I’ve uploaded it.

Workflow

Open the script and run it 1 time manually. When the first run is completed, the list.sort node will show a list with numbers. Each number is equal to a “kozijnmerk (purple groups)”.
For example, if the list shows 1-15, 28 and 30, delete the purple groups which you don’t need anymore except the numbers shown in the list.

At last connect the purple groups to the final groups for setting the parameter.

I still think the graph is not the most efficient way. But it works as the way I want. Maybe someone has a good suggestion too simply the graph?

Thanks for helping me out @Manel_Fernandez @alvpickmansLVT_VEBO_Gevellatei.dyn (197.0 KB)