| wiki.naturalfrequency.com | ECOTECT COMMUNITY WIKI!

Archive site for Autodesk Ecotect Analysis educational resources, notes and tutorials

Scripting: Parametric Grid on Rectangle Object

This wizard allows you to create a rectilinear object of any height and width at any location in space and divide its surface into a series of parametrically scripted grid planes.

The dimensions of the gridded planes can increase or decrease according to how large or small the planes need to be. The grid planes will always be divided evenly across the horizontal and vertical surface of the rectilinear object.

Script Contents (Lang: lua)

```divU = 5
divV = 8

w, h = get("object.extents", 1)
minX, minY, minZ = get("object.extents.min", 1)
maxX, maxY, maxZ = get("object.extents.max", 1)

-- define width and height of window
Width = ((maxX - minX)/divU)
Height = ((maxY - minY)/divV)

function DrawCell(x1, y1, z1, x2, y2, z2)
unit = add("object", "window", "plane", 1)
add("node", unit, 0, x1, y1, z1);
add("node", unit, 1, x2, y2, z1);
add("node", unit, 2, x2, y2, z2);
add("node", unit, 3, x1, y1, z2);
set("object.done");
end

minX = 1000
maxX = 3000
minY = 1000
maxY = 4000
minZ = 0
maxZ = 4000

divU = 10
divV = 25

for u = 1, divU do
for v = 1, divV do
DrawCell(
minX + (((maxX-minX)/divU)*(u-1)),
minY + (((maxY-minY)/divU)*(u-1)),
minZ + (((maxZ-minZ)/divV)*(v-1)),
minX + (((maxX-minX)/divU)*u),
minY + (((maxY-minY)/divU)*u),
minZ + (((maxZ-minZ)/divV)*v)
)
end
end
--end```

AttachmentSize
scripting files.zip1.2 KB