Firstly, it is important to know where you can store data after calculations are performed and how to access that data after calculations are finished.
- All objects in Ecotect can hold up to three attributes. What these attributes are will change depending on what you kind of calculations you ask the software to preform.
Accessing the attributes:
get.object.XXX object
set.object.XXX object value
result = get("object.attr1", object)
XXX can equal any of the following....
area | Surface area (m²) - if planar. |
exposure | Surface area exposed to outside conditions (m²) - if planar. |
length | Total length (m) - if linear. |
underground | Surface area exposed to ground conditions (m²) - if planar. |
panelarea | Surface overlapping a WINDOW / DOOR in adjacent zone (m²) |
resolution | Curve resolution for virtual polylines. |
attr1 | Calculated Attribute Number 1. |
attr2 | Calculated Attribute Number 2. |
attr3 | Calculated Attribute Number 3. |
index | Calculated Numerical Index. |
Exporting to Microsoft Excel:
excel("start", "Testing")
-- Fill up 15 rows of data
for i = 1, 15 do
excel("cell", 3, i)
excel("value", i*5)
end
-- Add a formula to the bottom cell.
excel("cell", 5, 16)
excel("value", "=SUM(E1:E15)")
excel("font bold")
-- Make the cell in the 9th row bold and italic.
excel("cell", 5, 9)
excel("font", "bold italic")
Export to a .txt file:
filename = getUserFile(1, "Save Script Output to...")
file = openfile (filename, "w")
write(file, "Print this text to the selected file.")
closefile(file)
if you want to export the contents of ecotect's annalysis grid to a text file your code would look like this. (as outlined in the above tutorial.)
filename = getUserFile(1, "save script output to....");
file = openfile (filename, "w");
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 = line..format("%0.4f, ", value);
write(file, value);
write(file, "\n");
end
print(line)
end
closefile(file);
No comments:
Post a Comment