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



Atrium Zone Wizard

This wizard will divide a vertical atrium zone into multiple zones.

Script Contents (Lang: lua)

cmd("wizard.load AtriumZoneWizard.wzd")
cmd("wizard.show")

bottomNodes = {}
subDivisions = get("wizard.page1.NumberofSubdivisions.Text")

top = get("wizard.page1.TopPlaneIndex.Text")
bottom = get("wizard.page1.BottomPlaneIndex.Text")

prefix = get("wizard.page1.ZoneNamePrefix.Text")

--collect all the bottom nodes
function nodeCollector(numNodes)
    for i = 0, numNodes-1 do
        x, y, z = get("object.node.position", 0, i)
        temp = {}
        temp[1] = x
        temp[2] = y
        bottomNodes[i] = temp
    end
end

---------------------MAIN
cmd("select.none")

--get numNodes on bottom
nodeNumber = get("object.nodes", 0)
nodeCollector(nodeNumber)

--get total height
Bx, By, Bz = get("object.node.position", bottom, 0)
Tx, Ty, Tz = get("object.node.position", top, 0)
zoneHeight = Tz - Bz
subzoneHeight = zoneHeight / subDivisions

--create zones
for i = 0, subDivisions-1 do

    zone = add("zone", prefix .. (i + 1))
    flr = add("object", "floor", "plane", true)
    ceiling = flr + nodeNumber + 1

    for j = 0, nodeNumber-1 do
        add("node", flr, j-1, bottomNodes[j][1], bottomNodes[j][2], subzoneHeight*i)
    end
    
    cmd("object.extrude", flr, 0, 0, subzoneHeight)

    if i ~= 0 then
        set("object.material", flr, "void")
    end

    if i ~= (subDivisions - 1) then
        set("object.material", ceiling, "void")
    end


    cmd("view.redraw")

end

cmd("view.redraw")

AttachmentSize
AtriumZoneWizard.zip35.88 KB

HOW WOULD YOU RATE THIS SCRIPT ?

No votes yet


Navigation

User login

Translate Site To: