Assigning material to directshape took long time and more than 25GB memory, but failed at end

I have more than 98 directshapes (meshes) in a revit file. I want to assign materials to them.
It took long time and more than 25GB memory to run, and it failed because it’s out of memory.
1

Revit and DY files is here: https://drive.google.com/open?id=1htv2aFaQK_1Y4L1Jbe-60gBq_IjmTE6A