Code Block

Code Blocks are a hugely powerful core node that allow you to do many things by directly entering functions and code in the Code Block.

Code Block – String operations


via @VCDwhiz

Code Block – List methods
In the example below, various Flatten methods are shown in the Code Block. This would be an alternative to using the List.Flatten or Flatten nodes.

Source: https://twitter.com/Jos_ols/status/661822388112384000

More on Code Blocks at http://dynamobim.com/cbns-for-dummies/ such as:

Enumeration

EnumerationNode

Feed a List into this node and it will return a number range, starting at 1 and up to the total count of the given List.

Useful to renumber Revit elements, as in this example, where it helps generating the numbering of certain Rooms in the model:EnumerationWorking

It is built mainly with OOTB nodes and one custom node. It operates a Count method over the list object, and using this value to generate a number range from 1 to the obtained count. Last implementation avoids unexpected behavior when the input list is empty. In that case, now the output is an empty list.

EnumerationRevampedInside

 

Element.FilterByParameterValue

This node gets a list of elements [list], a parameter name[string] and a parameter value [].

Checks if the elements parameter is equal to the given value, and splits the elements list in two: the first been “true” and the second been “false”Element.FilterByParameterValue

This node is built using OOTB nodes with nothing special in it.  But sumarizes a task we do in almost every definition.

Element.FilterByParameterValue_inside

Here follows a little example of this node in action:

We input all the rooms in the project, then get only those having “Comments” parameter equal to “revestir”Element.FilterByParameterValue_inAction