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



Square Spiral

This wizard allows you to create a spiral whose overall shape is dictated by the number of sides, number of rotations, incremental height, width and length of the object desired

Script Contents (Lang: lua)

-- --------------------------------------------------------------------
-- SETUP AND DISPLAY WIZARD INTERFACE FOR SCRIPT.
-- --------------------------------------------------------------------

cmd("wizard.load SquareSpiral.wzd")

cmd("wizard.show")

-- Store wizard values as local variables.

    Depth = tonumber(get("wizard.Page1.DepthEdit.Text"))
    Width = tonumber(get("wizard.Page1.WidthEdit.Text"))


    StartX = tonumber(get("wizard.Page1.StartXEdit.Text"))
    StartY = tonumber(get("wizard.Page1.StartYEdit.Text"))
    StartZ = tonumber(get("wizard.Page1.StartZEdit.Text"))


    Increment = tonumber(get("wizard.Page1.IncrementEdit.Text"))
    NumberSides = tonumber(get("wizard.Page1.NumberSidesEdit.Text"))
    Revolutions = tonumber(get("wizard.Page1.RevolutionsEdit.Text"))

nodeCount = 0
o = add("object line", true)

    -- Check for a valid object index.
--for Increment = 0, total height, incremental height do
--for h =0, Height, Increment do
    if o > -1 then

-- 60 value gives it
       for t = 0, (Revolutions*360), (360/NumberSides) do
          x =  StartX + (sin(t) * Width);
          y = StartY + (cos(t) * Depth);
          z = t/(360/NumberSides)*Increment;

          add("node", o, nodeCount, x, y, z)
          nodeCount = nodeCount + 1
       end
    --end
end

--Number of Sides  360/x 
--Number of Revolutions x*360+45
--Length and Width values are Input Number * Cos(t)
--Total height
--Incremental Height (step)

AttachmentSize
SquareSpiral.wzd3.68 KB

HOW WOULD YOU RATE THIS SCRIPT ?

No votes yet


Navigation

User login

Translate Site To: