feilong80

Importing a obstacle map in python

Discussion created by feilong80 on Dec 27, 2012
Latest reply on Dec 27, 2012 by feilong80
Hello,

I'm writing a python script to automate some stuff, and one of the things I'd like to automate is setting up an obstacle map.

Importing the obstacle map file is no trouble, but for it to function as an obstacle map, it needs to have the layer attribute
attr obstacle = brightness < 0.5

So after importing the png file and naming it "Obstacle," I'm trying to use the setLayerAttributes command to give this map layer the attribute needed for it to work as an obstacle map, like so:

#set layer attribute for obstacle layer
    obstacle = ce.getObjectsFrom(ce.scene, ce.isLayer, ce.withName("'Obstacle'"))[0]
    ce.setLayerAttributes(obstacle, "attr obstacle = brightness < 0.5")

However, when I run this script, it doesn't seem to assign the layer attribute.

Is this the right way to go about automating obstacle map importing in python?

Outcomes