Warning: Math.RemapRange operation failed


Hello, I’m new to Revit and Dynmao. I’m using a script to create masses from rooms. The script was shared by @Thomas_Schalnat. At one of the nodes I’m getting the following error message:
Warning: Math.RemapRange operation failed.
Value cannot be null.
Parameter name: source

What can I do to resolve this matter?


Hi Sayed Ahmed,

you’re not far off - it seems your problem is with the List.MatchWithKeyValues node rather than with the Math.RemapRange node. It seems MatchWithKeyValues is probably throwing an error, and not passing anything through to RemapRange (which is the reason for your null error).

Is it possible that you intend to GetKeys on the list of unique items, not the full length of the list? If you’re trying to create a colour range that scales with the length of your uniques list, this would make sense :slight_smile:

My guess is, you’ll be looking to get a list of evenly-spaced numbers in the range 0-1 in order to generate colours per unique Department type? It would be easy to do this by generating a range; for instance in DesignScript if you wrote 0…1…#x in a code block, then insert the List.Count output (length of your list) into the x-variable input. This would then be plugged into value input on your Color Range node.