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



APERTURE ANIMATION

This wizzard is supposed to create openings onto wall surfaces and animate their dimension according to Sun position at a specific day of the year...

in progress...

Script Contents (Lang: lua)

cmd("wizard.load 080215_Wizard_Marc.wzd")
-- Add interactive wizard functions here...
cmd("wizard.show")

--minRad = 125
--maxRad = 500

dayOfyear = get("wizard.Page1.EditBoxDayOfyear.Text")
minRad = get("wizard.Page1.editBoxMinRad.Text")
maxRad = get("wizard.Page1.editBoxMaxRad.Text")

StartTime = tonumber(get("wizard.Page1.EditBoxStartTime.Text"))
EndTime = tonumber(get("wizard.Page1.EditBoxEndTime.Text"))

PauseTime = get("wizard.Page1.EditBoxPause.text")

-- M: select only walls (index 4)
cmd("select.element", 4)

-- M: select specific objects
--cmd("select.index", 1, 3, 5)

-- add the child window
add("child window", 0.5, 0.75, 0.75, 0.2)

childArray = {}

-- Get number of selected objects.
selected_objects = get("selection.count")
objIndex = -1;
objCount = 0;

------------------------------------------------------
-- Add selected object to array.
for i = 1, selected_objects do

    -- Starting at -1, get next object index.
    objIndex = get("selection.next", objIndex);

    if objIndex >= 0 then
        objCount = objCount + 1
        childArray[objCount] = objIndex
    end

end
------------------------------------------------------

------------------------------------------------------
function SetChildExtents(day, hour)

    for i = 1, objCount do
    
        objIndex = childArray[i]

        -- Check for valid object.
        if objIndex >= 0 then
            
            -- result = get("object.area", objIndex)
            -- print (result)
    
            -- cmd("select.index", objIndex)
            -- cmd("calc.solar.day", 2, 1, 3)

            AngleToSun = get("object.angle", objIndex, 2)
            if AngleToSun <= 90 then

                result = get("weather.beamsolar", day, hour)
                print(hour, result)
                if result > maxRad then result = maxRad end
                if result < minRad then result = minRad end
            
                s = 0.1 + (((result-minRad)/(maxRad-minRad)) * 0.8)

                set("object.child.extents", objIndex, 0.5-s/2, 0.5-s/2, s, s)

            end
    
        end

    end

    cmd("view.redraw")
    pause(PauseTime)

end
------------------------------------------------------

------------------------------------------------------
for t = StartTime,EndTime do
    SetChildExtents(dayOfyear, t)
end
------------------------------------------------------

AttachmentSize
080215_Wizard_Marc.zip944 bytes

HOW WOULD YOU RATE THIS SCRIPT ?

No votes yet


Navigation

User login

Translate Site To: