AnsweredAssumed Answered

adjust attr of CGA rule by python script

Question asked by dreamchy on Feb 13, 2016
Latest reply on May 25, 2016 by CLau-esristaff

Hi guys,

     I want to test how python attr. and para. api work and adjust "height" by python.

so I wrote cga :

attr height = 10

Lot -->   extrude(height) Mass.

and python script:

def addheight():

    objects= ce.getObjectsFrom(ce.selection, ce.isModel)

    for o in objects:

        print o

        h= ce.getAttribute(o, 'height')

        print h

        addh= h+10

        ce.setAttribute(o, 'height', addh)

I hope it can add 10 on height of each building but it returns None. Through debugging, I found "o" is ok (when I choose 5 shapes, 2 shapes without rules, it can report those 3 shapes assigned with rule) 

However, it shows [ ] no attribute in "o" (by getAtrributeSource).

 

so How CAN I get the Attribute defined in the rule by myself and use it in Python Script ????

If Possible, Could anyone help me finish this simple python script???   (just get "height" and add 10 then return the value back to adjust building)????

 

Thanks a lot!!!!

CHEN

Outcomes