NumberToCharacter AZ

NumberToCharacter AZ

This node takes an integer as input.

Returns the “alphabetical equivalent character”,  and a list from A to the alphabetical equivalent character.

It only works from 1 to 26 (A to Z). [See NumberToCharacter AAZZ for higher inputs]

After this, returns a “Out of range” message.

NumberToCharacter AZ_working

The node uses DesignScript to work:

NumberToCharacter AZ_inside

There is a local variable, “a”, which is an alphabetical list.

The input, named index in the code block,  is evaluated to see if it’s less or equal than “a” count:

index<=List.Count(a). This is passed into a formula node as the “Test input”.

If it’s true, then, it retrieves the index, less one, in the alphabet’s list. We subtract one unit because we want to make our input “one based”, instead of “zero based”. 1 will equal to A.

If it’s false, the string “Out of range” is passed to the output node.

For the second output, a new list called “b” is defined. Starting with “a” list, it is “choped” in two lists, been the input the chopping point.

The last step is getting the first list, so a” b[0]” is used and passed to the second output. This second output is also connected to te “Out of Range” string if the condition is not true.

 

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