A quick and dirty solution could be to add a conditional for the material before accessing the graphite electrode data (size option, length and width) (see picture below)
I have tested it in NX 12.0.2mp5 and it works, but you have to apply the changes when switching the material and pick the...