Toggle Crop Region On/Off Using Element.SetParameterByName

Hello,
I’m having trouble getting my graph to work. It was working previously when I had limited the views to elevations. But now when I try to include all views I get an error saying “no parameter found by that name” for the “crop region visible” parameter which was previously working.
I believe that I have element views with no “crop view” parameter and no “crop region visible” parameter which causes the error. I’m hoping someone knows a way to filter out the element views without these parameters before feeding them into the Element.SetParameterByName (I haven’t been able to find this on the forum yet). Please see my dyn attached. Thanks

Override Interior Elevation Crop Boundaries Lineweight 2018.11.15.dyn (64.9 KB)

There are tons of ways to do this. Here is one example:

1 Like

that worked! Thank you. here’s my updated graph:
Override Interior Elevation Crop Boundaries Lineweight 2018.11.15.dyn (62.5 KB)

There are views that doesn’t contain Crop Region parameter. Here is another possible way to filter views:

2 Likes

could you explain the code block? what does x != “”; mean in this case?

When you fetch a parameter value but the parameter does not exist, the GetParameterValueByName node returns an empty string, or “”. So x != “”; means:

x is the value returned by GetParameterValueByName node,
!= means Not Equal To and
""; is the empty string text. So != is the opposite of equals (==)

Combined, this will return a list of booleans (true or false) for when an element’s parameter value is “” (false) or some value (true).

1 Like

good explanation. thank you.