Revit and "space planning" | Material.ByName fails

“Warning: Material.ByName operation failed. Value cannot be null.
Parameter name: name”

Inputs seem ok, yet “Material.ByName” seems unable to process this.

Fig. 1

Fig. 2

Does anyone have a solution for this?

Thanks in advance.

What are you trying to do?

You’re providing a null to Material.ByName. That’s going to fail. You’re getting a null because you seem to be checking for "Staff Support" in a list of colors, which doesn’t exist.


Do I go wrong with the right part of the code block (below screenshot from image you sent me)?

Fig. 1

Thanks in advance.

Without seeing the node preview bubbles we have no idea what’s going on with your data. What you have should work if you have the appropriate structure and a valid key.

Hey @j.boonen it’s been years but this is jogging my memory that the colors are attempting to match against Material assets already existing in the model. What you need to do is create a NEW Material that matches corresponds to those in the Fill Color column of your spreadsheet. The List.MatchWithKeyValues node (potentially now defunct) takes the Excel Color column as an input then matches the color terms from the Code Block against material names in the model in the SAME ORDER.

One more thing to keep in mind. When setting the material to each family instance, the Element.SetParameterByName node is talking to whatever you have your Material parameter named as. In the original family the parameter was named “Fill Color” but may be different in your family.

1 Like


Of course, I can share the data:
202101_BGD_XX_ZZ_M3_A_0036_Huis.rvt → V2 Autodesk Construction Cloud
202101_BGD_XX_ZZ_M3_A_0039_Space-planning-box → V1 Autodesk Construction Cloud
202101_BGD_XX_ZZ_M3_A_0037_Space-planning → V37 Autodesk Construction Cloud
202101_BGD_XX_ZZ_RD_A_0040_Space-planning-programma-Dijkstraat-34 → V3 Autodesk Construction Cloud

Or is your question even more specific?

Thanks in advance.

Source data:
202101_BGD_XX_ZZ_M3_A_0037_Space-planning.dyn (303.5 KB)
202101_BGD_XX_ZZ_M3_A_0039_Space-planning-box.rfa (360 KB)
202101_BGD_XX_ZZ_M3_A_0036_Huis.rvt (5.2 MB)
202101_BGD_XX_ZZ_RD_A_0040_Space-planning-programma-Dijkstraat-34.xlsx (20.9 KB)

I mean we need to see the data in your graph. We can’t see what’s going in or out of your nodes if you don’t show the preview bubbles.