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



Circular Window

This allows a circular or elliptical window to be created on a series of selected surfaces.

Script Contents (Lang: lua)

cmd("wizard.load CircularVoid.wzd")

cmd("wizard.show")



--CIRCULAR VOID
    -- Store wizard values as local variables.
       XRadius = tonumber(get("wizard.Page1.EditXradius.Text"))
       YRadius = tonumber(get("wizard.Page1.EditYradius.Text"))
       XCenter = tonumber(get("wizard.Page1.EditXcenter.Text"))
       YCenter = tonumber(get("wizard.Page1.EditYcenter.Text"))
       ZCenter = tonumber(get("wizard.Page1.EditZcenter.Text"))
       nodeCount = 0

objArray = {}

-- 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 -- Increment first so that index starts at 1.
        objArray[objCount] = objIndex
    end

end

-- -------------------------------
-- Now we can cycle through the array.

for i = 1, objCount do

    objIndex = objArray[i]
    
    -- Check for valid object.
    if objIndex >= 0 then

        -- Select specific object.
        cmd("select.index", objIndex)

    o = add("object window plane", true);
    -- Check for a valid object index.
    if o > -1 then

       for t = 0, 360, 10 do
          x = XCenter + (sin(t) * XRadius);
          y = YCenter + (cos(t) * YRadius);
          add("node", o, 0, x, y, ZCenter)
          nodeCount = nodeCount + 1
       end

   -- Complete the object so ECOTECT
   -- knows to calc equation & normal.
   set("object.done");
--get("object.current", object)
cmd("object.link", objIndex, o)

        end

    end
end

AttachmentSize
CircularWindow.wzd58.72 KB

HOW WOULD YOU RATE THIS SCRIPT ?

No votes yet


Navigation

User login

Translate Site To: