me again...
i don't know why, but the attribut "ablauf", "material" always receives a new value, even if the face's material is included in the array caled invalid_material. i'll post the code, because i realy don't know how to fix it.
ents.each{|e|
            if e.typename == "Face"
                 start = e.get_attribute "ablauf", "baubeginn"
                 ende = e.get_attribute "ablauf", "bauende"
                 if (e.material) 
                   invalid_materials = ['bau_mat', 'fertig_mat', 'inplanung']
                   unless invalid_materials.include?( e.material.name )
                     mat_vorher = e.material.name
                     e.set_attribute("ablauf", "material", mat_vorher)
                   end
                 end
                 
                 
                 if @woche.to_i >= start.to_i && @woche.to_i < ende.to_i 
                   e.material = bau_mat
                 end
                 if @woche.to_i >= ende.to_i 
                   e.material =fertig_mat
                 end
                 if @woche.to_i < start.to_i 
                   e.material = inplanung
                 end
            end
                 
           }
end
#now the code that reloads the material
def mat_back 
   mod = Sketchup.active_model
   ents = mod.entities 
   mats = mod.materials
   default_mat = mats.add "standardwert"
   default_mat.color = [50,250,50] 
   ents.each{|e|
                  if e.typename == "Face"
                    if (e.get_attribute "ablauf", "material")
                     mat_temp=e.get_attribute "ablauf", "material"
                     e.material=mats[mat_temp]
                    else
                     e.material=default_mat 
                    end
                  end
                 }
end