Sunday, October 28, 2007

Friday, October 26, 2007

sun tracking commands

If any one wants to have objects track objects in your file these are good commands to start your research with.

--find the orientation to the sun
--query that result
cmd("object.normal", objNum, 0)
--asumiuth
azm = get("object.angle", objNum, 3)
--altitude
alt = get("object.angle", objNum, 1)

--orient the alt and use the lock angle for the azmith
cmd("object.orient", objNum, azm, angLock)

Friday Class

This is the sript we wrote in class friday. Enjoy....

x,y = get("grid.size")
print("Cells", x, y)

for j = 0, y-1 do

line = ""

for i = 0, x-1 do
value = get("grid.cell", i, j, 0)

line = value

excel("start", "Testing")

excel("cell", j, i)
excel("value", line)

end

end

Tuesday, October 2, 2007

Cycling Through Dates





This script gives builds on the previous example. This example cycles through months and checks the temperature of a wall after doing a spatial comfort calculation.

filename = getUserFile(1, "Save Script Output to...")


file = openfile (filename, "w")

for i = 0,11,1 do

set("model.date", 21, i, 14)
wallTemp = get("object.attr2", 1)
write(file, wallTemp)
write(file, "\n")

end

closefile(file)

For the second iteration of this script we will tell the script to check what happens when you change the material of the surface that we are analyzing. To do this you will need to build an array of material index numbers. To do this you execute the following commands.

matIndex = {}
matIndex[0] = get("material.index", "ConcBlockPlaster")
matIndex[1] = get("material.index", "FramedTimberPlaster")

print(matIndex[1])

set("object.material", 1, matIndex[1])

Now, we need to build this into the existing script that we have been working on by adding a second loop that iterates through the materials.

matIndex = {}
matIndex[0] = get("material.index", "ConcBlockPlaster")
matIndex[1] = get("material.index", "FramedTimberPlaster")

filename = getUserFile(1, "Save Script Output to...")

for x = 0,1,1 do

set("object.material", 1, matIndex[x])

cmd("app.menu", "calculate.comfort", 0)

file = openfile (filename, "a")

for i = 0,11,1 do

set("model.date", 21, i, 14)
wallTemp = get("object.attr2", 1)
write(file, wallTemp)
write(file, "\n")

end
end

closefile(file)