These two scripts show how to cycle through all materials in the current ECOTECT model's material library and set properties such as emissivity or reflectance. These values can be customised as required by editing the values at the start of the script.
SetEmissivity.scr
--[[----------------------------------------------- -- This script cycles through all the materials in -- the current model setting the surface emissivity -- of elements to the value specified at the start. --]]----------------------------------------------- -- Count materials in model. materials = get("model.materials"); printf("Total Materials: %d", materials); -- Set element emissivity values. emissivity = 0.9; for m = 0,materials-1,1 do -- Get element index as a number. element = get("material.type", m); updated = false; -- NOTE: see material.type property -- in Help file for element indexes. if (element == 4) then -- WALL. update = true; elseif (element == 5) then -- PARTITION. update = true; elseif (element == 7) then -- PANEL. update = true; elseif (element == 3) then -- CEILING. update = true; elseif (element == 1) then -- ROOF. update = true; elseif (element == 2) then -- FLOOR. update = true; end -- Show updated materials. if (update == true) then set("material.intemissivity", m, emissivity); set("material.extemissivity", m, emissivity); printf("Updated %-9s %d (%s)", get("material.element", m), m, get("material.name", m) ); end end
SetReflectance.scr
This script adds a little extra complexity by assigning different values based on the different material element types.
--[[----------------------------------------------- -- This script cycles through all the materials in -- the current model setting the internal reflectances -- of elements to the values specified at the start. --]]----------------------------------------------- -- Count materials in model. materials = get("model.materials"); printf("Total Materials: %d", materials); -- Set element reflectance values. -- NOTE: Reflectance values outside range -- 0.0 to 1.0 will be ignored and not changed. externalRef = -1.0; -- Ignored. ceilingRef = 0.7; floorRef = 0.2; wallRef = 0.5; for m = 0,materials,1 do -- Get element index as a number. element = get("material.type", m); updated = false; -- NOTE: see material.type property -- in Help file for element indexes. if (element == 4) then -- WALL. set("material.reflectance", m, wallRef, externalRef); updated = true; elseif (element == 5) then -- PARTITION. set("material.reflectance", m, wallRef, externalRef); updated = true; elseif (element == 7) then -- PANEL. set("material.reflectance", m, wallRef, externalRef); updated = true; elseif (element == 3) then -- CEILING. set("material.reflectance", m, ceilingRef, externalRef); updated = true; elseif (element == 1) then -- ROOF. set("material.reflectance", m, ceilingRef, externalRef); updated = true; elseif (element == 2) then -- FLOOR. set("material.reflectance", m, floorRef, externalRef); updated = true; end -- Show updated materials. if (updated == true) then printf("Updated %-9s %d (%s)", get("material.element", m), m, get("material.name", m) ); end end

