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



Script example 08

GetPointAttributes.scr

This script illustrates how you can access object attribute data for only a specific type of object in the model.

Script Contents (Lang: lua)

-- ------------------------------------
-- GET POINT ATTRIBUTES:
-- Prints out all three attributes for
-- each POINT object in the current 
-- model as a simple table.
-- ------------------------------------

objIndex = -1

repeat

    -- Search for next POINT object.
    objIndex = get("model.nextobject", 
      objIndex, "point", -1, -1, -1
      )
        
    -- Print data if valid.
    if objIndex >= 0 then
        printf("Pt:\t%d\t%f\t%f\t%f", objIndex, 
          get("object.attr1", objIndex)
          get("object.attr2", objIndex)
          get("object.attr3", objIndex)
          )
    end

until (objIndex < 0)

HOW WOULD YOU RATE THIS SCRIPT ?

No votes yet


Navigation

User login

Translate Site To: